|
| 1 | +// Module included in the following assemblies: |
| 2 | +// |
| 3 | +// * scalability_and_performance/ztp_far_edge/ztp-talm-updating-managed-policies.adoc |
| 4 | + |
| 5 | +:_content-type: PROCEDURE |
| 6 | +[id="talm-prechache-user-specified-images-preparing-crs_{context}"] |
| 7 | +== Creating the custom resources for pre-caching |
| 8 | + |
| 9 | +You must create the `PreCachingConfig` CR before or concurrently with the `ClusterGroupUpgrade` CR. |
| 10 | + |
| 11 | +. Create the `PreCachingConfig` CR with the list of additional images you want to pre-cache. |
| 12 | ++ |
| 13 | +[source,yaml] |
| 14 | +---- |
| 15 | +apiVersion: ran.openshift.io/v1alpha1 |
| 16 | +kind: PreCachingConfig |
| 17 | +metadata: |
| 18 | + name: exampleconfig |
| 19 | + namespace: default <1> |
| 20 | +spec: |
| 21 | +[...] |
| 22 | + spaceRequired: 30Gi <2> |
| 23 | + additionalImages: |
| 24 | + - quay.io/exampleconfig/application1@sha256:3d5800990dee7cd4727d3fe238a97e2d2976d3808fc925ada29c559a47e2e1ef |
| 25 | + - quay.io/exampleconfig/application2@sha256:3d5800123dee7cd4727d3fe238a97e2d2976d3808fc925ada29c559a47adfaef |
| 26 | + - quay.io/exampleconfig/applicationN@sha256:4fe1334adfafadsf987123adfffdaf1243340adfafdedga0991234afdadfsa09 |
| 27 | +---- |
| 28 | +<1> The `namespace` must be accessible to the hub cluster. |
| 29 | +<2> It is recommended to set the minimum disk space required field to ensure that there is sufficient storage space for the pre-cached images. |
| 30 | + |
| 31 | +. Create a `ClusterGroupUpgrade` CR with the `preCaching` field set to `true` and specify the `PreCachingConfig` CR created in the previous step: |
| 32 | ++ |
| 33 | +[source,yaml] |
| 34 | +---- |
| 35 | +apiVersion: ran.openshift.io/v1alpha1 |
| 36 | +kind: ClusterGroupUpgrade |
| 37 | +metadata: |
| 38 | + name: cgu |
| 39 | + namespace: default |
| 40 | +spec: |
| 41 | + clusters: |
| 42 | + - sno1 |
| 43 | + - sno2 |
| 44 | + preCaching: true |
| 45 | + preCachingConfigRef: |
| 46 | + - name: exampleconfig |
| 47 | + namespace: default |
| 48 | + managedPolicies: |
| 49 | + - du-upgrade-platform-upgrade |
| 50 | + - du-upgrade-operator-catsrc-policy |
| 51 | + - common-subscriptions-policy |
| 52 | + remediationStrategy: |
| 53 | + timeout: 240 |
| 54 | +---- |
| 55 | + |
| 56 | ++ |
| 57 | +[WARNING] |
| 58 | +==== |
| 59 | +Once you install the images on the cluster, you cannot change or delete them. |
| 60 | +==== |
| 61 | + |
| 62 | ++ |
| 63 | +. When you want to start pre-caching the images, apply the `ClusterGroupUpgrade` CR by running the following command: |
| 64 | ++ |
| 65 | +[source,terminal] |
| 66 | +---- |
| 67 | +$ oc apply -f cgu.yaml |
| 68 | +---- |
| 69 | + |
| 70 | +{cgu-operator} verifies the `ClusterGroupUpgrade` CR. |
| 71 | + |
| 72 | +From this point, you can continue with the {cgu-operator} pre-caching workflow. |
| 73 | + |
| 74 | +[NOTE] |
| 75 | +==== |
| 76 | +All sites are pre-cached concurrently. |
| 77 | +==== |
| 78 | + |
| 79 | +.Verification |
| 80 | + |
| 81 | +. Check the pre-caching status on the hub cluster where the `ClusterUpgradeGroup` CR is applied by running the following command: |
| 82 | ++ |
| 83 | +[source,terminal] |
| 84 | +---- |
| 85 | +$ oc get cgu <cgu_name> -n <cgu_namespace> -oyaml |
| 86 | +---- |
| 87 | + |
| 88 | ++ |
| 89 | +.Example output |
| 90 | +[source,yaml] |
| 91 | +---- |
| 92 | + precaching: |
| 93 | + spec: |
| 94 | + platformImage: quay.io/openshift-release-dev/ocp-release@sha256:3d5800990dee7cd4727d3fe238a97e2d2976d3808fc925ada29c559a47e2e1ef |
| 95 | + operatorsIndexes: |
| 96 | + - registry.example.com:5000/custom-redhat-operators:1.0.0 |
| 97 | + operatorsPackagesAndChannels: |
| 98 | + - local-storage-operator: stable |
| 99 | + - ptp-operator: stable |
| 100 | + - sriov-network-operator: stable |
| 101 | + excludePrecachePatterns: |
| 102 | + - aws |
| 103 | + - vsphere |
| 104 | + additionalImages: |
| 105 | + - quay.io/exampleconfig/application1@sha256:3d5800990dee7cd4727d3fe238a97e2d2976d3808fc925ada29c559a47e2e1ef |
| 106 | + - quay.io/exampleconfig/application2@sha256:3d5800123dee7cd4727d3fe238a97e2d2976d3808fc925ada29c559a47adfaef |
| 107 | + - quay.io/exampleconfig/applicationN@sha256:4fe1334adfafadsf987123adfffdaf1243340adfafdedga0991234afdadfsa09 |
| 108 | + spaceRequired: "30" |
| 109 | + status: |
| 110 | + sno1: Starting |
| 111 | + sno2: Starting |
| 112 | +---- |
| 113 | + |
| 114 | ++ |
| 115 | +The pre-caching configurations are validated by checking if the managed policies exist. |
| 116 | +Valid configurations of the `ClusterGroupUpgrade` and the `PreCachingConfig` CRs result in the following statuses: |
| 117 | + |
| 118 | ++ |
| 119 | +.Example output of valid CRs |
| 120 | +[source,yaml] |
| 121 | +---- |
| 122 | +- lastTransitionTime: "2023-01-01T00:00:01Z" |
| 123 | + message: All selected clusters are valid |
| 124 | + reason: ClusterSelectionCompleted |
| 125 | + status: "True" |
| 126 | + type: ClusterSelected |
| 127 | +- lastTransitionTime: "2023-01-01T00:00:02Z" |
| 128 | + message: Completed validation |
| 129 | + reason: ValidationCompleted |
| 130 | + status: "True" |
| 131 | + type: Validated |
| 132 | +- lastTransitionTime: "2023-01-01T00:00:03Z" |
| 133 | + message: Precaching spec is valid and consistent |
| 134 | + reason: PrecacheSpecIsWellFormed |
| 135 | + status: "True" |
| 136 | + type: PrecacheSpecValid |
| 137 | +- lastTransitionTime: "2023-01-01T00:00:04Z" |
| 138 | + message: Precaching in progress for 1 clusters |
| 139 | + reason: InProgress |
| 140 | + status: "False" |
| 141 | + type: PrecachingSucceeded |
| 142 | +---- |
| 143 | + |
| 144 | ++ |
| 145 | +.Example of an invalid PreCachingConfig CR |
| 146 | +[source,yaml] |
| 147 | +---- |
| 148 | +Type: "PrecacheSpecValid" |
| 149 | +Status: False, |
| 150 | +Reason: "PrecacheSpecIncomplete" |
| 151 | +Message: "Precaching spec is incomplete: failed to get PreCachingConfig resource due to PreCachingConfig.ran.openshift.io "<pre-caching_cr_name>" not found" |
| 152 | +---- |
| 153 | + |
| 154 | +. You can find the pre-caching job by running the following command on the managed cluster: |
| 155 | ++ |
| 156 | +[source,terminal] |
| 157 | +---- |
| 158 | +$ oc get jobs -n openshift-talo-pre-cache |
| 159 | +---- |
| 160 | + |
| 161 | ++ |
| 162 | +.Example of pre-caching job in progress |
| 163 | +[source,terminal] |
| 164 | +---- |
| 165 | +NAME COMPLETIONS DURATION AGE |
| 166 | +pre-cache 0/1 1s 1s |
| 167 | +---- |
| 168 | + |
| 169 | +. You can check the status of the pod created for the pre-caching job by running the following command: |
| 170 | ++ |
| 171 | +[source,terminal] |
| 172 | +---- |
| 173 | +$ oc describe pod pre-cache -n openshift-talo-pre-cache |
| 174 | +---- |
| 175 | + |
| 176 | ++ |
| 177 | +.Example of pre-caching job in progress |
| 178 | +[source,terminal] |
| 179 | +---- |
| 180 | +Type Reason Age From Message |
| 181 | +Normal SuccesfulCreate 19s job-controller Created pod: pre-cache-abcd1 |
| 182 | +---- |
| 183 | + |
| 184 | +. You can get live updates on the status of the job by running the following command: |
| 185 | ++ |
| 186 | +[source,terminal] |
| 187 | +---- |
| 188 | +$ oc logs -f pre-cache-abcd1 -n openshift-talo-pre-cache |
| 189 | +---- |
| 190 | + |
| 191 | +. To verify the pre-cache job is successfully completed, run the following command: |
| 192 | ++ |
| 193 | +[source,terminal] |
| 194 | +---- |
| 195 | +$ oc describe pod pre-cache -n openshift-talo-pre-cache |
| 196 | +---- |
| 197 | + |
| 198 | ++ |
| 199 | +.Example of completed pre-cache job |
| 200 | +[source,terminal] |
| 201 | +---- |
| 202 | +Type Reason Age From Message |
| 203 | +Normal SuccesfulCreate 5m19s job-controller Created pod: pre-cache-abcd1 |
| 204 | +Normal Completed 19s job-controller Job completed |
| 205 | +---- |
| 206 | + |
| 207 | +. To verify that the images are successfully pre-cached on the {sno}, do the following: |
| 208 | + |
| 209 | +.. Enter into the node in debug mode: |
| 210 | ++ |
| 211 | +[source,terminal] |
| 212 | +---- |
| 213 | +$ oc debug node/cnfdf00.example.lab |
| 214 | +---- |
| 215 | + |
| 216 | +.. Change root to `host`: |
| 217 | ++ |
| 218 | +[source,terminal] |
| 219 | +---- |
| 220 | +$ chroot /host/ |
| 221 | +---- |
| 222 | + |
| 223 | +.. Search for the desired images: |
| 224 | ++ |
| 225 | +[source,terminal] |
| 226 | +---- |
| 227 | +$ sudo podman images | grep <operator_name> |
| 228 | +---- |
0 commit comments