// Module included in the following assemblies:
//
// * installing/installing_vsphere/installing-vsphere-installer-provisioned-customizations.adoc
// * installing/installing_vsphere/installing-vsphere-installer-provisioned-network-customizations.adoc
// * installing/installing_vsphere/installing-vsphere-installer-provisioned.adoc
// * installing/installing_vsphere/installing-vsphere-network-customizations.adoc
// * installing/installing_vsphere/installing-vsphere.adoc
// * installing/installing_vsphere/installing-restricted-networks-vsphere.adoc
// * registry/configuring_registry_storage/configuring-registry-storage-vsphere.adoc

:_mod-docs-content-type: PROCEDURE
[id="installation-registry-storage-block-recreate-rollout_{context}"]
= Configuring block registry storage for VMware vSphere

[role="_abstract"]
To allow the image registry to use block storage types such as vSphere Virtual Machine Disk (VMDK) during upgrades as a cluster administrator, you can use the `Recreate` rollout strategy.

[IMPORTANT]
====
Block storage volumes are supported but not recommended for use with image
registry on production clusters. An installation where the registry is
configured on block storage is not highly available because the registry cannot
have more than one replica.
====

.Procedure

. Enter the following command to set the image registry storage as a block storage type, patch the registry so that it uses the `Recreate` rollout strategy, and runs with only `1` replica:
+
[source,terminal]
----
$ oc patch config.imageregistry.operator.openshift.io/cluster --type=merge -p '{"spec":{"rolloutStrategy":"Recreate","replicas":1}}'
----
+
. Provision the persistent volume (PV) for the block storage device, and create a persistent volume claim (PVC) for that volume. The requested block volume uses the ReadWriteOnce (RWO) access mode.
.. Create a `pvc.yaml` file with the following contents to define a VMware vSphere `PersistentVolumeClaim` object:
+
[source,yaml]
----
kind: PersistentVolumeClaim
apiVersion: v1
metadata:
  name: image-registry-storage
  namespace: openshift-image-registry
spec:
  accessModes:
  - ReadWriteOnce
  resources:
    requests:
      storage: 100Gi
----
+
where:
--
`metadata.name`:: Specifies a unique name that represents the `PersistentVolumeClaim` object.
`metadata.namespace`:: Specifies the `namespace` for the `PersistentVolumeClaim` object, which is `openshift-image-registry`.
`spec.accessModes`:: Specifies the access mode of the persistent volume claim. With `ReadWriteOnce`, the volume can be mounted with read and write permissions by a single node.
`spec.resources.requests.storage`:: Specifies the size of the persistent volume claim.
--

.. Enter the following command to create the `PersistentVolumeClaim` object from the file:
+
[source,terminal]
----
$ oc create -f pvc.yaml -n openshift-image-registry
----

+
. Enter the following command to edit the registry configuration so that it references the correct PVC:
+
[source,terminal]
----
$ oc edit config.imageregistry.operator.openshift.io -o yaml
----
+
.Example output
[source,yaml]
----
storage:
  pvc:
    claim:
----
+
By creating a custom PVC, you can leave the `claim` field blank for the default automatic creation of an `image-registry-storage` PVC.
