Chapter 5. Upgrading OpenShift Dev Spaces

This chapter describes how to upgrade from CodeReady Workspaces 2.15 to OpenShift Dev Spaces 3.0.

5.1. Upgrading the dsc management tool

This section describes how to upgrade the dsc management tool.

5.2. Upgrading CodeReady Workspaces 2.15 on Red Hat OpenShift

The workspace engine and authentication system used in CodeReady Workspaces 2.15 and earlier versions are deprecated. Due to this deprecation, upgrading CodeReady Workspaces 2.15 involves running upgrade scripts.

5.2.1. Manually upgrading CodeReady Workspaces 2.15 to OpenShift Dev Spaces 3.0.1 on Red Hat OpenShift

You can manually upgrade CodeReady Workspaces 2.15 to OpenShift Dev Spaces 3.0.1 on Red Hat OpenShift.

Prerequisites

Procedure

  1. Download 1-prepare.sh.

    1-prepare.sh shuts down CodeReady Workspaces and RH-SSO, fetches the existing users' data, and dumps the CodeReady Workspaces database.

  2. Download 2-migrate.sh.

    2-migrate.sh fetches CodeReady Workspaces RH-SSO and database data, and repopulates the database with updated data.

  3. Download 3-subscribe.sh.

    3-subscribe.sh deletes CodeReady Workspaces Operator and RH-SSO resources, updates the CheCluster CR, and creates a new OpenShift Dev Spaces Operator subscription.

  4. Download 4-wait.sh.

    4-wait.sh waits until OpenShift Dev Spaces is ready, which can take more than 5 minutes.

  5. Set the environment variables to use in the upgrade scripts:

    export INSTALLATION_NAMESPACE=openshift-workspaces 1
    export PRODUCT_ID=red-hat-openshift-devspaces
    export PRODUCT_DEPLOYMENT_NAME=devspaces
    export PRODUCT_OPERATOR_NAME=devspaces-operator
    export PRODUCT_OLM_STABLE_CHANNEL=stable
    export PRODUCT_OLM_CATALOG_SOURCE=redhat-operators
    export PRODUCT_OLM_PACKAGE=devspaces
    export PRODUCT_OLM_STARTING_CSV=devspacesoperator.v3.0.1
    export PRE_MIGRATION_PRODUCT_OPERATOR_NAMESPACE=openshift-workspaces 2
    export PRE_MIGRATION_PRODUCT_SHORT_ID=codeready
    export PRE_MIGRATION_PRODUCT_DEPLOYMENT_NAME=codeready
    export PRE_MIGRATION_PRODUCT_OPERATOR_NAME=codeready-operator
    export PRE_MIGRATION_PRODUCT_CHE_CLUSTER_CR_NAME=codeready-workspaces
    export PRE_MIGRATION_PRODUCT_IDENTITY_PROVIDER_DEPLOYMENT_NAME=keycloak
    export PRE_MIGRATION_PRODUCT_SUBSCRIPTION_NAME=codeready-workspaces
    1
    openshift-workspaces or another project where CodeReady Workspaces was previously installed.
    2
    openshift-workspaces or another project where CodeReady Workspaces was previously installed.
  6. Run the upgrade scripts:

    $ chmod +x ./1-prepare.sh ./2-migrate.sh ./3-subscribe.sh ./4-wait.sh; \
      ./1-prepare.sh && ./2-migrate.sh && ./3-subscribe.sh && ./4-wait.sh

Verification

  • In the OpenShift Dev Spaces dashboard, go to AboutServer Version to verify that it is 3.0.

5.2.2. Rolling the upgrade back to CodeReady Workspaces 2.15 on Red Hat OpenShift

If upgrading CodeReady Workspaces 2.15 to OpenShift Dev Spaces 3.0.1 on Red Hat OpenShift fails, you can run a rollback script to restore CodeReady Workspaces 2.15.

Prerequisites

  • OpenShift Container Platform 4.10 or OpenShift Dedicated 4.10 or Red Hat OpenShift Service on AWS (ROSA) 4.10.

Procedure

  1. Download the rollback.sh script.
  2. Set the environment variables to use in the rollback.sh script:

    export INSTALLATION_NAMESPACE=openshift-workspaces 1
    export PRODUCT_ID=red-hat-openshift-devspaces
    export PRODUCT_SHORT_ID=devspaces
    export PRODUCT_DEPLOYMENT_NAME=devspaces
    export PRE_MIGRATION_PRODUCT_OPERATOR_NAMESPACE=openshift-workspaces 2
    export PRE_MIGRATION_PRODUCT_DEPLOYMENT_NAME=codeready
    export PRE_MIGRATION_PRODUCT_SUBSCRIPTION_NAME=codeready-workspaces
    export PRE_MIGRATION_PRODUCT_CHE_CLUSTER_CR_NAME=codeready-workspaces
    export PRE_MIGRATION_PRODUCT_OPERATOR_NAME=codeready-operator
    export PRE_MIGRATION_PRODUCT_OLM_PACKAGE=codeready-workspaces
    export PRE_MIGRATION_PRODUCT_OLM_CHANNEL=latest
    export PRE_MIGRATION_PRODUCT_OLM_CATALOG_SOURCE=redhat-operators
    export PRE_MIGRATION_PRODUCT_OLM_STARTING_CSV=crwoperator.v2.15.4
    1
    openshift-workspaces or another project where CodeReady Workspaces was previously installed.
    2
    openshift-workspaces or another project where CodeReady Workspaces was previously installed.
  3. Run the rollback.sh script.

    $ chmod +x ./rollback.sh; ./rollback.sh

Verification

  • In the CodeReady Workspaces dashboard, go to AboutServer Version to verify that it is 2.15.

5.3. Specifying the update approval strategy for the Red Hat OpenShift Dev Spaces Operator

The Red Hat OpenShift Dev Spaces Operator supports two upgrade strategies:

Automatic
The Operator installs new updates when they become available.
Manual
New updates need to be manually approved before installation begins.

You can specify the update approval strategy for the Red Hat OpenShift Dev Spaces Operator by using the OpenShift web console.

Prerequisites

  • An OpenShift web console session by a cluster administrator. See Accessing the web console.
  • An instance of OpenShift Dev Spaces that was installed by using Red Hat Ecosystem Catalog.

Procedure

  1. In the OpenShift web console, navigate to OperatorsInstalled Operators.
  2. Click Red Hat OpenShift Dev Spaces in the list of installed Operators.
  3. Navigate to the Subscription tab.
  4. Configure the Update approval strategy to Automatic or Manual.

5.4. Upgrading OpenShift Dev Spaces using the OpenShift web console

You can manually approve an upgrade from an earlier minor version using the Red Hat OpenShift Dev Spaces Operator from the Red Hat Ecosystem Catalog in the OpenShift web console.

Prerequisites

Procedure

Verification steps

  1. Navigate to the OpenShift Dev Spaces instance.
  2. The 3.0 version number is visible at the bottom of the page.

5.5. Repairing the DevWorkspace Operator on OpenShift

Under certain conditions, such as OLM restart or cluster upgrade, the Dev Spaces Operator for OpenShift Dev Spaces might automatically install the DevWorkspace Operator even when it is already present on the cluster. In that case, you can repair the DevWorkspace Operator on OpenShift as follows:

Prerequisites

  • An active oc session as a cluster administrator to the destination OpenShift cluster. See Getting started with the CLI.
  • On the Installed Operators page of the OpenShift web console, you see multiple entries for the DevWorkspace Operator or one entry that is stuck in a loop of Replacing and Pending.

Procedure

  1. Delete the devworkspace-controller namespace that contains the failing pod.
  2. Update DevWorkspace and DevWorkspaceTemplate Custom Resource Definitions (CRD) by setting the conversion strategy to None and removing the entire webhook section:

    spec:
      ...
      conversion:
        strategy: None
    status:
    ...
    Tip

    You can find and edit the DevWorkspace and DevWorkspaceTemplate CRDs in the Administrator perspective of the OpenShift web console by searching for DevWorkspace in AdministrationCustomResourceDefinitions.

    Note

    The DevWorkspaceOperatorConfig and DevWorkspaceRouting CRDs have the conversion strategy set to None by default.

  3. Remove the DevWorkspace Operator subscription:

    $ oc delete sub devworkspace-operator \
    -n openshift-operators 1
    1
    openshift-operators or an OpenShift project where the DevWorkspace Operator is installed.
  4. Get the DevWorkspace Operator CSVs in the <devworkspace-operator.vX.Y.Z> format:

    $ oc get csv | grep devworkspace
  5. Remove each DevWorkspace Operator CSV:

    $ oc delete csv <devworkspace-operator.vX.Y.Z> \
    -n openshift-operators 1
    1
    openshift-operators or an OpenShift project where the DevWorkspace Operator is installed.
  6. Re-create the DevWorkspace Operator subscription:

    $ cat <<EOF | oc apply -f -
    apiVersion: operators.coreos.com/v1alpha1
    kind: Subscription
    metadata:
      name: devworkspace-operator
      namespace: openshift-operators
    spec:
      channel: fast
      name: devworkspace-operator
      source: redhat-operators
      sourceNamespace: openshift-marketplace
      installPlanApproval: Automatic 1
      startingCSV: devworkspace-operator.v0.15.2
    EOF
    1
    Automatic or Manual.
    Important

    For installPlanApproval: Manual, in the Administrator perspective of the OpenShift web console, go to OperatorsInstalled Operators and select the following for the DevWorkspace Operator: Upgrade availablePreview InstallPlanApprove.

  7. In the Administrator perspective of the OpenShift web console, go to OperatorsInstalled Operators and verify the Succeeded status of the DevWorkspace Operator.