|
| 1 | +// Module included in the following assemblies: |
| 2 | + |
| 3 | +// * networking/network_observability/installing-operators.adoc |
| 4 | + |
| 5 | +:_mod-docs-content-type: PROCEDURE |
| 6 | +[id="network-observability-updating-migrating_{context}"] |
| 7 | += Migrating removed stored versions of the FlowCollector CRD |
| 8 | + |
| 9 | +Network Observability Operator version 1.6 removes the old and deprecated `v1alpha1` version of the `FlowCollector` API. If you previously installed this version on your cluster, it might still be referenced in the `storedVersion` of the `FlowCollector` CRD, even if it is removed from the etcd store, which blocks the upgrade process. These references need to be manually removed. |
| 10 | + |
| 11 | +There are two options to remove stored versions: |
| 12 | + |
| 13 | +. Use the Storage Version Migrator Operator. |
| 14 | +. Uninstall and reinstall the Network Observability Operator, ensuring that the installation is in a clean state. |
| 15 | + |
| 16 | +.Prerequisites |
| 17 | +* 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`. |
| 18 | +
|
| 19 | +.Procedure |
| 20 | +. Verify that the old `FlowCollector` CRD version is still referenced in the `storedVersion`: |
| 21 | ++ |
| 22 | +[source,terminal] |
| 23 | +---- |
| 24 | +$ oc get crd flowcollectors.flows.netobserv.io -ojsonpath='{.status.storedVersions}' |
| 25 | +---- |
| 26 | +. 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. |
| 27 | +.. *Option 1: Kubernetes Storage Version Migrator*: Create a YAML to define the `StorageVersionMigration` object, for example `migrate-flowcollector-v1alpha1.yaml`: |
| 28 | ++ |
| 29 | +[source,yaml] |
| 30 | +---- |
| 31 | +apiVersion: migration.k8s.io/v1alpha1 |
| 32 | +kind: StorageVersionMigration |
| 33 | +metadata: |
| 34 | + name: migrate-flowcollector-v1alpha1 |
| 35 | +spec: |
| 36 | + resource: |
| 37 | + group: flows.netobserv.io |
| 38 | + resource: flowcollectors |
| 39 | + version: v1alpha1 |
| 40 | +---- |
| 41 | +... Save the file. |
| 42 | +... Apply the `StorageVersionMigration` by running the following command: |
| 43 | ++ |
| 44 | +[source,terminal] |
| 45 | +---- |
| 46 | +$ oc apply -f migrate-flowcollector-v1alpha1.yaml |
| 47 | +---- |
| 48 | +... Update the `FlowCollector` CRD to manually remove `v1alpha1` from the `storedVersion`: |
| 49 | ++ |
| 50 | +[source,terminal] |
| 51 | +---- |
| 52 | +$ oc edit crd flowcollectors.flows.netobserv.io |
| 53 | +---- |
| 54 | +.. *Option 2: Reinstall*: Save the Network Observability Operator 1.5 version of the `FlowCollector` CR to a file, for example `flowcollector-1.5.yaml`. |
| 55 | ++ |
| 56 | +[source,terminal] |
| 57 | +---- |
| 58 | +$ oc get flowcollector cluster -o yaml > flowcollector-1.5.yaml |
| 59 | +---- |
| 60 | +... Follow the steps in "Uninstalling the Network Observability Operator", which uninstalls the Operator and removes the existing `FlowCollector` CRD. |
| 61 | +... Install the Network Observability Operator latest version, 1.6.0. |
| 62 | +... Create the `FlowCollector` using backup that was saved in Step b. |
| 63 | + |
| 64 | +.Verification |
| 65 | +* Run the following command: |
| 66 | ++ |
| 67 | +[source,terminal] |
| 68 | +---- |
| 69 | +$ oc get crd flowcollectors.flows.netobserv.io -ojsonpath='{.status.storedVersions}' |
| 70 | +---- |
| 71 | +The list of results should no longer show `v1alpha1` and only show the latest version, `v1beta1`. |
0 commit comments