|
| 1 | +// Module included in the following assemblies: |
| 2 | +// * edge_computing/image-based-upgrade/cnf-preparing-for-image-based-upgrade.adoc |
| 3 | + |
| 4 | +:_mod-docs-content-type: PROCEDURE |
| 5 | +[id="zztp-image-based-upgrade-prep-oadp_{context}"] |
| 6 | += Creating OADP resources for the image-based upgrade with {ztp} |
| 7 | + |
| 8 | +Prepare your OADP resources to restore your application after an upgrade. |
| 9 | + |
| 10 | +.Prerequisites |
| 11 | + |
| 12 | +* Provision one or more managed clusters with {ztp}. |
| 13 | +* Log in as a user with `cluster-admin` privileges. |
| 14 | +* Generate a seed image from a compatible seed cluster. |
| 15 | +* Create a separate partition on the target cluster for the container images that is shared between stateroots. For more information, see "Configuring a shared container directory between ostree stateroots when using {ztp}". |
| 16 | +* Deploy a version of {lcao} that is compatible with the version used with the seed image. |
| 17 | +* Install the OADP Operator, the `DataProtectionApplication` CR, and its secret on the target cluster. |
| 18 | +* Create an S3-compatible storage solution and a ready-to-use bucket with proper credentials configured. For more information, see "Installing and configuring the OADP Operator with {ztp}". |
| 19 | +
|
| 20 | +.Procedure |
| 21 | + |
| 22 | +. Ensure that your Git repository that you use with the ArgoCD policies application contains the following directory structure: |
| 23 | ++ |
| 24 | +-- |
| 25 | +[source,terminal] |
| 26 | +---- |
| 27 | +├── source-crs/ |
| 28 | +│ ├── ibu/ |
| 29 | +│ │ ├── ImageBasedUpgrade.yaml |
| 30 | +│ │ ├── PlatformBackupRestore.yaml |
| 31 | +│ │ ├── PlatformBackupRestoreLvms.yaml |
| 32 | +├── ... |
| 33 | +├── ibu-upgrade-ranGen.yaml |
| 34 | +├── kustomization.yaml |
| 35 | +---- |
| 36 | + |
| 37 | +[IMPORTANT] |
| 38 | +==== |
| 39 | +The `kustomization.yaml` file must be located in the same directory structure as previously shown to reference the `ibu-upgrade-ranGen.yaml` manifest. |
| 40 | +==== |
| 41 | + |
| 42 | +The `source-crs/ibu/PlatformBackupRestore.yaml` file is provided in the ZTP container image. |
| 43 | + |
| 44 | +.PlatformBackupRestore.yaml |
| 45 | +include::snippets/ibu-PlatformBackupRestore.adoc[] |
| 46 | + |
| 47 | +If you use {lvms} to create persistent volumes, you can use the `source-crs/ibu/PlatformBackupRestoreLvms.yaml` provided in the ZTP container image to back up your {lvms} resources. |
| 48 | + |
| 49 | +.PlatformBackupRestoreLvms.yaml |
| 50 | +include::snippets/ibu-PlatformBackupRestoreLvms.adoc[] |
| 51 | +-- |
| 52 | + |
| 53 | +. Optional: If you need to restore applications after the upgrade, create the OADP `Backup` and `Restore` CRs for your application in the `openshift-adp` namespace: |
| 54 | + |
| 55 | +.. Create the OADP CRs for cluster-scoped application artifacts in the `openshift-adp` namespace: |
| 56 | ++ |
| 57 | +.Example OADP CRs for cluster-scoped application artifacts for LSO and {LVMS} |
| 58 | +include::snippets/ibu-ApplicationClusterScopedBackupRestore.adoc[] |
| 59 | + |
| 60 | +.. Create the OADP CRs for your namespace-scoped application artifacts in the `source-crs/custom-crs` directory: |
| 61 | ++ |
| 62 | +-- |
| 63 | +.Example OADP CRs namespace-scoped application artifacts when LSO is used |
| 64 | +include::snippets/ibu-ApplicationBackupRestoreLso.adoc[] |
| 65 | + |
| 66 | +.Example OADP CRs namespace-scoped application artifacts when {lvms} is used |
| 67 | +include::snippets/ibu-ApplicationBackupRestoreLvms.adoc[] |
| 68 | + |
| 69 | +[IMPORTANT] |
| 70 | +==== |
| 71 | +The same version of the applications must function on both the current and the target release of {product-title}. |
| 72 | +==== |
| 73 | +-- |
| 74 | + |
| 75 | +. Create the `oadp-cm` `ConfigMap` object through the `oadp-cm-policy` in a new `PolicyGenTemplate` called `ibu-upgrade-ranGen.yaml`: |
| 76 | ++ |
| 77 | +[source,yaml] |
| 78 | +---- |
| 79 | +apiVersion: ran.openshift.io/v1 |
| 80 | +kind: PolicyGenTemplate |
| 81 | +metadata: |
| 82 | + name: example-group-ibu |
| 83 | + namespace: "ztp-group" |
| 84 | +spec: |
| 85 | + bindingRules: |
| 86 | + group-du-sno: "" |
| 87 | + mcp: "master" |
| 88 | + evaluationInterval: |
| 89 | + compliant: 10s |
| 90 | + noncompliant: 10s |
| 91 | + sourceFiles: |
| 92 | + - fileName: ConfigMapGeneric.yaml |
| 93 | + complianceType: mustonlyhave |
| 94 | + policyName: "oadp-cm-policy" |
| 95 | + metadata: |
| 96 | + name: oadp-cm |
| 97 | + namespace: openshift-adp |
| 98 | +---- |
| 99 | + |
| 100 | +. Create a `kustomization.yaml` with the following content: |
| 101 | ++ |
| 102 | +[source,yaml] |
| 103 | +---- |
| 104 | +apiVersion: kustomize.config.k8s.io/v1beta1 |
| 105 | +kind: Kustomization |
| 106 | + |
| 107 | +generators: <1> |
| 108 | +- ibu-upgrade-ranGen.yaml |
| 109 | + |
| 110 | +configMapGenerator: <2> |
| 111 | +- files: |
| 112 | + - source-crs/ibu/PlatformBackupRestore.yaml |
| 113 | + #- source-crs/custom-crs/ApplicationClusterScopedBackupRestore.yaml |
| 114 | + #- source-crs/custom-crs/ApplicationApplicationBackupRestoreLso.yaml |
| 115 | + name: oadp-cm |
| 116 | + namespace: ztp-group |
| 117 | +generatorOptions: |
| 118 | + disableNameSuffixHash: true |
| 119 | + |
| 120 | + |
| 121 | +patches: <3> |
| 122 | +- target: |
| 123 | + group: policy.open-cluster-management.io |
| 124 | + version: v1 |
| 125 | + kind: Policy |
| 126 | + name: group-ibu-oadp-cm-policy |
| 127 | + patch: |- |
| 128 | + - op: replace |
| 129 | + path: /spec/policy-templates/0/objectDefinition/spec/object-templates/0/objectDefinition/data |
| 130 | + value: '{{hub copyConfigMapData "ztp-group" "oadp-cm" hub}}' |
| 131 | +---- |
| 132 | +<1> Generates the `oadp-cm-policy`. |
| 133 | +<2> Creates the `oadp-cm` `ConfigMap` object on the hub cluster with `Backup` and `Restore` CRs. |
| 134 | +<3> Overrides the data field of `ConfigMap` added in `oadp-cm-policy`. A hub template is used to propagate the `oadp-cm` `ConfigMap` to all target clusters. |
| 135 | + |
| 136 | +. Push the changes to your Git repository. |
0 commit comments