Migrate removed stored versions of the FlowCollector CRD

Manually remove the deprecated v1alpha1 version from the FlowCollector custom resource definition (CRD) storedVersion list to prevent upgrade errors and successfully migrate to Network Observability Operator 1.6.

There are two options to remove stored versions:

  1. Use the Storage Version Migrator Operator.

  2. Uninstall and reinstall the Network Observability Operator, ensuring that the installation is in a clean state.

Prerequisites
  • You have an older version of the Operator installed, and you want to prepare your cluster to install the latest version of the Operator. Or you have attempted to install the Network Observability Operator 1.6 and run into the error: Failed risk of data loss updating "flowcollectors.flows.netobserv.io": new CRD removes version v1alpha1 that is listed as a stored version on the existing CRD.

Procedure
  1. Verify that the old FlowCollector CRD version is still referenced in the storedVersion:

    $ oc get crd flowcollectors.flows.netobserv.io -ojsonpath='{.status.storedVersions}'
  2. If v1alpha1 appears in the list of results, proceed with Step a to use the Kubernetes Storage Version Migrator or Step b to uninstall and reinstall the CRD and the Operator.

    1. Option 1: Kubernetes Storage Version Migrator: Create a YAML to define the StorageVersionMigration object, for example migrate-flowcollector-v1alpha1.yaml:

      apiVersion: migration.k8s.io/v1alpha1
      kind: StorageVersionMigration
      metadata:
        name: migrate-flowcollector-v1alpha1
      spec:
        resource:
          group: flows.netobserv.io
          resource: flowcollectors
          version: v1alpha1
      1. Save the file.

      2. Apply the StorageVersionMigration by running the following command:

        $ oc apply -f migrate-flowcollector-v1alpha1.yaml
      3. Update the FlowCollector CRD to manually remove v1alpha1 from the storedVersion:

        $ oc edit crd flowcollectors.flows.netobserv.io
    2. Option 2: Reinstall: Save the Network Observability Operator 1.5 version of the FlowCollector CR to a file, for example flowcollector-1.5.yaml.

      $ oc get flowcollector cluster -o yaml > flowcollector-1.5.yaml
      1. Follow the steps in "Uninstalling the Network Observability Operator", which uninstalls the Operator and removes the existing FlowCollector CRD.

      2. Install the Network Observability Operator latest version, 1.6.0.

      3. Create the FlowCollector using backup that was saved in Step b.

Verification
  • Run the following command:

    $ oc get crd flowcollectors.flows.netobserv.io -ojsonpath='{.status.storedVersions}'

    The list of results should no longer show v1alpha1 and only show the latest version, v1beta1.