github.com/openshift/installer@v1.4.17/docs/user/openstack/image_registry_with_custom_pvc_backends.md (about)

     1  # Image Registry With A Custom PVC Backend
     2  
     3  Sometimes users need to set the image registry backend volume from a specific availability zone, or with a size other than 100Gi. They can do this as a day2 operation by following next steps as a cluster admin.
     4  
     5  1. Create a custom storage class with provided availability zone
     6  
     7  ```sh
     8  $ export AZ_NAME=volume_availability_zone_name
     9  $ cat <<\EOF | oc apply -f -
    10  apiVersion: storage.k8s.io/v1
    11  kind: StorageClass
    12  metadata:
    13    name: custom-csi-storageclass
    14  provisioner: cinder.csi.openstack.org
    15  volumeBindingMode: WaitForFirstConsumer
    16  allowVolumeExpansion: true
    17  parameters:
    18    availability: $AZ_NAME
    19  EOF
    20  storageclass.storage.k8s.io/custom-csi-storageclass created
    21  ```
    22  
    23  > **Note**
    24  > OpenShift doesn't check that the availability zone exists. So, users must verify that they have entered the correct value.
    25  
    26  2. Create a pvc using the storageclass in `openshift-image-registry-namespace`, change the size of the volume if necessary.
    27  
    28  ```sh
    29  $ cat <<EOF | oc apply -f -
    30  apiVersion: v1
    31  kind: PersistentVolumeClaim
    32  metadata:
    33    name: csi-pvc-imageregistry
    34    namespace: openshift-image-registry
    35    annotations:
    36      imageregistry.openshift.io: "true"
    37  spec:
    38    accessModes:
    39    - ReadWriteOnce
    40    volumeMode: Filesystem
    41    resources:
    42      requests:
    43        storage: 100Gi
    44    storageClassName: custom-csi-storageclass
    45  EOF
    46  persistentvolumeclaim/csi-pvc-imageregistry created
    47  ```
    48  
    49  > **Note**
    50  > Setting the `imageregistry.openshift.io` annotation is important, because otherwise Cluster Image Registry Operator won't be able to consume this PVC.
    51  
    52  3. Replace the original volume claim in the image registry config.
    53  
    54  ```sh
    55  $ oc patch configs.imageregistry.operator.openshift.io/cluster --type 'json' -p='[{"op": "replace", "path": "/spec/storage/pvc/claim", "value": "csi-pvc-imageregistry"}]'
    56  config.imageregistry.operator.openshift.io/cluster patched
    57  ```
    58  
    59  It may take several minutes for the operator to update the backend.
    60  
    61  4. Verify that the new backend is in-use.
    62  
    63  First, check the image registry config status. The claim name should be the same like in the `spec` section.
    64  
    65  ```sh
    66  $ oc get configs.imageregistry.operator.openshift.io/cluster -oyaml
    67  ...
    68  status:
    69      ...
    70      managementState: Managed
    71      pvc:
    72        claim: csi-pvc-imageregistry
    73  ...
    74  ```
    75  
    76  Second, make sure that the PVC's status is Bound
    77  
    78  ```sh
    79  $ oc get pvc -n openshift-image-registry csi-pvc-imageregistry
    80  NAME                   STATUS   VOLUME                                     CAPACITY   ACCESS MODES   STORAGECLASS             AGE
    81  csi-pvc-imageregistry  Bound    pvc-72a8f9c9-f462-11e8-b6b6-fa163e18b7b5   100Gi      RWO            custom-csi-storageclass  11m
    82  ```