Uploaded image for project: 'Red Hat OpenShift Dev Spaces (formerly CodeReady Workspaces) '
  1. Red Hat OpenShift Dev Spaces (formerly CodeReady Workspaces)
  2. CRW-3221

OCP admin user fails to deploy application to openshift from DS workspace

XMLWordPrintable

    • False
    • None
    • False
    • Release Notes
    • Hide
      = Admin users must select the destination OpenShift project to deploy applications to OpenShift

      Currently, the `admin` users are unable to deploy applications from a Dev Spaces workspace to OpenShift because those users' default projects are not the same as the Dev Spaces workspace project. This problem affects all devfiles that project an example command to deploy the application to OpenShift, including Node JS or Red Hat Fuse. This problem does not affect non-administrative user accounts on OpenShift because such users only have access to one project, which is the default `__<username>__-devspaces` namespace.

      .Workaround

      * Run the `oc project admin-devspaces` command as the `admin` user.
      * Alternatively, use the environment variable and run `oc project $DEVWORKSPACE_NAMESPACE` to select the Dev Spaces namespace as the `admin` user.
      Show
      = Admin users must select the destination OpenShift project to deploy applications to OpenShift Currently, the `admin` users are unable to deploy applications from a Dev Spaces workspace to OpenShift because those users' default projects are not the same as the Dev Spaces workspace project. This problem affects all devfiles that project an example command to deploy the application to OpenShift, including Node JS or Red Hat Fuse. This problem does not affect non-administrative user accounts on OpenShift because such users only have access to one project, which is the default `__<username>__-devspaces` namespace. .Workaround * Run the `oc project admin-devspaces` command as the `admin` user. * Alternatively, use the environment variable and run `oc project $DEVWORKSPACE_NAMESPACE` to select the Dev Spaces namespace as the `admin` user.
    • Known Issue
    • Done
    • Workaround Exists
    • Hide

      1. Open the terminal
      2. Run the `oc project admin-devspaces` command, or to use the env var, run `oc project $DEVWORKSPACE_NAMESPACE`

      Note that as of 3.2, the default namespace is selected automatically when you run the deploy command.

      Show
      1. Open the terminal 2. Run the `oc project admin-devspaces` command, or to use the env var, run `oc project $DEVWORKSPACE_NAMESPACE` Note that as of 3.2, the default namespace is selected automatically when you run the deploy command.
      1. Login into DS as OCP user with admin rights
      2. Start Java Fuse or Node JS sample workspace
      3. Run the deploy to OC command in the workspace

      Deploy to openshift doesn't work out of the box when Dev Spaces is installed and using as kubeadmin user, because there is no default project when admin user is logging into OpenShift, so there is not OpenShift project to deployed to:

      Red Hat Fuse devfile

      Red Hat Fuse devfile
      [INFO] --- openshift-maven-plugin:7.10.0.fuse-sb2-7_10_0-00014-redhat-00001:build (default) @ fuse-rest-http-booster ---
      [INFO] oc: Using OpenShift build with strategy S2I
      [INFO] oc: Running in OpenShift mode
      [INFO] oc: Running generator spring-boot
      [INFO] oc: spring-boot: Using Docker image registry.redhat.io/fuse7/fuse-java-openshift-jdk11-rhel8:1.10 as base / builder
      [INFO] oc: [fuse-rest-http-booster:latest] "spring-boot": Created docker source tar /projects/fuse-rest-http-booster/target/docker/fuse-rest-http-booster/latest/tmp/docker-build.tar
      [INFO] oc: Creating BuildServiceConfig fuse-rest-http-booster-s2i for Source build
      [INFO] oc: Creating ImageStream fuse-rest-http-booster
      [ERROR] oc: Failed to execute the build [Unable to build the image using the OpenShift build service]
      [INFO] ------------------------------------------------------------------------
      [INFO] BUILD FAILURE
      [INFO] ------------------------------------------------------------------------
      [INFO] Total time:  7.105 s
      [INFO] Finished at: 2022-08-04T07:11:56Z
      [INFO] ------------------------------------------------------------------------
      [ERROR] Failed to execute goal org.jboss.redhat-fuse:openshift-maven-plugin:7.10.0.fuse-sb2-7_10_0-00014-redhat-00001:build (default) on project fuse-rest-http-booster: Failed to execute the build: Unable to build the image using the OpenShift build service: Namespace not specified. But operation requires namespace. -> [Help 1]
      [ERROR] 
      [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
      [ERROR] Re-run Maven using the -X switch to enable full debug logging.
      [ERROR] 
      [ERROR] For more information about the errors and possible solutions, please read the following articles:
      [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
      
      oc project
      [user@workspace1931f90a3c65496a-58bc8d857c-bkxqs fuse-rest-http-booster]$ oc whoami 
      admin
      [user@workspace1931f90a3c65496a-58bc8d857c-bkxqs fuse-rest-http-booster]$ oc project
      No project has been set. Pass a project name to make that the default

      Node JS devfile

      This applies to all devfiles that have deploy-to-openshift step.

      There is no such a problem for non-admin users, because they are logged into OpenShift having user specific project by default:

      non-admin user login command
      $ oc login --token=sha256~rrwTzU_IyEdffI8STZX0lYK7yqUGW4BnTID2YbvOmlw --server=https://api.ocp410-ltst-ds.crw-qe.com:6443
      Logged into "https://api.ocp410-ltst-ds.crw-qe.com:6443" as "user" using the token provided.
      
      You have one project on this server: "user-devspaces"
      

              vsvydenk Valerii Svydenko
              sachinitagi Sachin Itagi
              Max Leonov Max Leonov
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Created:
                Updated:
                Resolved: