= SOP Configure the Image Registry Operator

== Resources
- [1] https://docs.openshift.com/container-platform/4.8/registry/configuring_registry_storage/configuring-registry-storage-baremetal.html#configuring-registry-storage-baremetal[Configuring Registry Storage Baremetal]


== Enable the image registry operator
For detailed instructions please refer to the official documentation for the particular version of Openshift [1].

From the `os-control01` node we can enable the Image Registry Operator set it to a `Managed` state like so via the CLI.:

----
oc patch configs.imageregistry.operator.openshift.io cluster --type merge --patch '{"spec":{"managementState":"Managed"}}'
----

Next edit the configuration for the Image Registry operator like so:

----
oc edit configs.imageregistry.operator.openshift.io
----

Add the following to replace the `storage: {}`:

----
...
storage:
  pvc:
    claim:
...
----

Save the config.

The Image registry will automatically claim a 100G sized PV if available. It is best to open a ticket with Fedora Infra and have a 100G NFS share be created.

Use the following template for inspiration, populate the particular values to match the newly created NFS Share.

----
kind: PersistentVolume
apiVersion: v1
metadata:
  name: ocp-image-registry-volume
spec:
  capacity:
    storage: 100Gi
  nfs:
    server: 10.3.162.11
    path: /ocp_prod_registry
  accessModes:
    - ReadWriteMany
  persistentVolumeReclaimPolicy: Retain
  volumeMode: Filesystem
----

To create this new PV, create a persisent volume template file like above and apply it using the Openshift client tool like so:

----
oc apply -f image-registry-pv.yaml
----
