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:
-
Use the Storage Version Migrator Operator.
-
Uninstall and reinstall the Network Observability Operator, ensuring that the installation is in a clean state.
-
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.
-
Verify that the old
FlowCollectorCRD version is still referenced in thestoredVersion:$ oc get crd flowcollectors.flows.netobserv.io -ojsonpath='{.status.storedVersions}' -
If
v1alpha1appears 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.-
Option 1: Kubernetes Storage Version Migrator: Create a YAML to define the
StorageVersionMigrationobject, for examplemigrate-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-
Save the file.
-
Apply the
StorageVersionMigrationby running the following command:$ oc apply -f migrate-flowcollector-v1alpha1.yaml -
Update the
FlowCollectorCRD to manually removev1alpha1from thestoredVersion:$ oc edit crd flowcollectors.flows.netobserv.io
-
-
Option 2: Reinstall: Save the Network Observability Operator 1.5 version of the
FlowCollectorCR to a file, for exampleflowcollector-1.5.yaml.$ oc get flowcollector cluster -o yaml > flowcollector-1.5.yaml-
Follow the steps in "Uninstalling the Network Observability Operator", which uninstalls the Operator and removes the existing
FlowCollectorCRD. -
Install the Network Observability Operator latest version, 1.6.0.
-
Create the
FlowCollectorusing backup that was saved in Step b.
-
-
-
Run the following command:
$ oc get crd flowcollectors.flows.netobserv.io -ojsonpath='{.status.storedVersions}'The list of results should no longer show
v1alpha1and only show the latest version,v1beta1.