|
| 1 | +// Module included in the following assemblies: |
| 2 | +// |
| 3 | +// scalability_and_performance/ztp-advanced-policy-config.adoc |
| 4 | + |
| 5 | +:_module-type: PROCEDURE |
| 6 | +[id="ztp-configuring-pgt-image-registry_{context}"] |
| 7 | += Configuring the image registry using PolicyGenTemplate CRs |
| 8 | + |
| 9 | +You can use `PolicyGenTemplate` to apply to create the PV and PVC and patch `imageregistry` configuration. Select the appropriate `PolicyGenTemplate` for each `source-cr`. See Additional Resources for more help. |
| 10 | + |
| 11 | +.Prerequisites |
| 12 | + |
| 13 | +* You have installed and configured Zero Touch Provisioning (ZTP). For information about this, see the topic on ZTP in Additional resources. |
| 14 | +
|
| 15 | +.Procedure |
| 16 | + |
| 17 | +. Configure the storage class, persistent volume claim, persistent volume, and image registry configuration in the appropriate `PolicyGenTemplate` CR. For example, to configure an individual site, use the following YAML: |
| 18 | ++ |
| 19 | +[source,yaml] |
| 20 | +---- |
| 21 | +sourceFiles: |
| 22 | + # storage class |
| 23 | + - fileName: StorageClass.yaml |
| 24 | + policyName: "sc-for-image-registry" |
| 25 | + metadata: |
| 26 | + name: image-registry-sc |
| 27 | + annotations: |
| 28 | + ran.openshift.io/ztp-deploy-wave: "100" <1> |
| 29 | + # persistent volume claim |
| 30 | + - fileName: StoragePVC.yaml |
| 31 | + policyName: "pvc-for-image-registry" |
| 32 | + metadata: |
| 33 | + name: image-registry-pvc |
| 34 | + namespace: openshift-image-registry |
| 35 | + annotations: |
| 36 | + ran.openshift.io/ztp-deploy-wave: "100" <2> |
| 37 | + spec: |
| 38 | + accessModes: |
| 39 | + ReadWriteMany |
| 40 | + resources: |
| 41 | + requests: |
| 42 | + storage: 100Gi |
| 43 | + storageClassName: image-registry-sc |
| 44 | + volumeMode: Filesystem |
| 45 | + # persistent volume |
| 46 | + - fileName: ImageRegistryPV.yaml <3> |
| 47 | + policyName: "pv-for-image-registry" |
| 48 | + metadata: |
| 49 | + annotations: |
| 50 | + ran.openshift.io/ztp-deploy-wave: "100" <4> |
| 51 | + # image registry config |
| 52 | + - fileName: ImageRegistryConfig.yaml <5> |
| 53 | + policyName: "config-for-image-registry" |
| 54 | + complianceType: musthave <5> |
| 55 | + metadata: |
| 56 | + annotations: |
| 57 | + ran.openshift.io/ztp-deploy-wave: "100" <6> |
| 58 | + spec: |
| 59 | + storage: |
| 60 | + pvc: |
| 61 | + claim: "image-registry-pvc" |
| 62 | +---- |
| 63 | +<1> Set the appropriate value for `ztp-deploy-wave` depending on whether you are configuring image registries at the site, common, or group level. `ztp-deploy-wave: "100"` is appropriate for an individual site. ZTP deploy waves are used to order how policies are applied to the spoke cluster. All policies created by `PolicyGen` have a ztp deploy wave by default. |
| 64 | +<2> Set the appropriate value for `ztp-deploy-wave` as in note 1. |
| 65 | +<3> This assumes that `mount_point` is set to `/var/imageregistry` in `SiteConfig` using StorageClass `image-registry-sc` (see the topic on configuring disk partitioning with `SiteConfig`). |
| 66 | +<4> Set the appropriate value for `ztp-deploy-wave` as in note 1. |
| 67 | +<5> Configure registry to point to the PVC created above. |
| 68 | +<6> Set the appropriate value for `ztp-deploy-wave` as in note 1. |
| 69 | + |
| 70 | +.Verification |
| 71 | + |
| 72 | +. Check that the `Config` CRD of the group `imageregistry.operator.openshift.io` instance is not reporting errors. Run the following command: |
| 73 | + |
| 74 | +. Check that the `PersistentVolumeClaim` on the managed cluster is populated with data. Run the following command: |
| 75 | + |
| 76 | +. Check that the `registry*` pod is up correctly located under the `openshift-image-registry` namespace. |
| 77 | + |
| 78 | +. Verify successful login to the registry with `podman`: |
| 79 | ++ |
| 80 | +[source,terminal] |
| 81 | +---- |
| 82 | +$ oc login -u kubeadmin -p <password_from_install_log> https://api-int.<cluster_name>.<base_domain>:6443 |
| 83 | +---- |
| 84 | ++ |
| 85 | +[source,terminal] |
| 86 | +---- |
| 87 | +$ podman login -u kubeadmin -p $(oc whoami -t) image-registry.openshift-image-registry.svc:5000 |
| 88 | +---- |
| 89 | + |
| 90 | +. Check for disk partitioning using `lsblk` to list your blocks: |
| 91 | ++ |
| 92 | +[source,terminal] |
| 93 | +---- |
| 94 | +$ oc debug node/sno-1.example.com |
| 95 | +---- |
| 96 | + |
| 97 | +. When you enter the node, run the following command: |
| 98 | + |
| 99 | +[source,terminal] |
| 100 | +---- |
| 101 | +sh-4.4# lsblk |
| 102 | +NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT |
| 103 | +sda 8:0 0 446.6G 0 disk |
| 104 | + |-sda1 8:1 0 1M 0 part |
| 105 | + |-sda2 8:2 0 127M 0 part |
| 106 | + |-sda3 8:3 0 384M 0 part /boot |
| 107 | + |-sda4 8:4 0 336.3G 0 part /sysroot |
| 108 | + `-sda5 8:5 0 100.1G 0 part /var/imageregistry <1> |
| 109 | +sdb 8:16 0 446.6G 0 disk |
| 110 | +sr0 11:0 1 104M 0 rom |
| 111 | +---- |
| 112 | +<1> This setting will appear if you have successfully listed your block. |
0 commit comments