Fix a duplicate Dev Workspace Operator after a cluster upgrade

Fix a duplicate Dev Workspace Operator installation that can occur when an OLM restart or OpenShift cluster upgrade leaves multiple Operator entries in a Replacing or Pending loop.

Before you begin

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 Administration > CustomResourceDefinitions.

    Note:

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

  3. Remove the Dev Workspace Operator subscription:
    $ oc delete sub devworkspace-operator \
    -n <devworkspace_operator_namespace>

    where:

    <devworkspace_operator_namespace>
    The project where the Dev Workspace Operator is installed. For OpenShift Dev Spaces 3.29, this is typically openshift-devspaces. For standalone Dev Workspace Operator installations, this is openshift-operators.
  4. Get the Dev Workspace Operator CSVs in the <devworkspace_operator.vX.Y.Z> format:
    $ oc get csv | grep devworkspace
  5. Remove each Dev Workspace Operator CSV:
    $ oc delete csv <devworkspace_operator.vX.Y.Z> \
    -n <devworkspace_operator_namespace>
  6. Re-create the Dev Workspace 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
      startingCSV: devworkspace-operator.v0.41.0
    EOF
    installPlanApproval

    Automatic or Manual.

    Important:

    For installPlanApproval: Manual, in the Administrator perspective of the OpenShift web console, go to Operators > Installed Operators and select the following for the Dev Workspace Operator: Upgrade available > Preview InstallPlan > Approve.

Results

  • In the Administrator perspective of the OpenShift web console, go to Operators > Installed Operators and verify the Succeeded status of the Dev Workspace Operator.