= SOP Add new capacity to the OCP4 ODF Storage Cluster
This SOP should be used in the following scenario:

- Red Hat OpenShift Container Platform 4.x cluster has been installed
- Additional worker nodes are being added to increase the capacity for the cluster
- These additional worker nodes have storage resources which we wish to add to the Openshift Datafoundation Storage Cluster
- We are adding enough storage to meet the minimum of 3 replicas. eg: 3 nodes, or enough storage devices that the the number is divisble by 3.

== Resources
- [1] https://access.redhat.com/solutions/4246261[How to add OpenShift 4 RHCOS worker nodes in UPI within the first 24 hours]
- [2] https://access.redhat.com/solutions/4799921[How to add OpenShift 4 RHCOS worker nodes to UPI after the first 24 hours]
- [3] https://docs.openshift.com/container-platform/4.8/post_installation_configuration/node-tasks.html[Adding RHCOS worker nodes]
- [4] https://access.redhat.com/documentation/en-us/red_hat_openshift_data_foundation/4.9[Openshift Data Foundation Product Notes]

== Steps

1. Once a new node has been added to the Openshift cluster, we can manage the extra local storage devices on this node from within Openshift itself, providing that they do not contain file paritions/filesystems. In the case of a node being repurposed, please first ensure that all storage devices except `/dev/sda` are partition and filesystem free before starting.

2. From within the Openshift webconsole, or via cli search for all "LocalVolumeDiscovery" objects.
+
----
[root@os-control01 ~][PROD-IAD2]# oc get localvolumediscovery --all-namespaces
NAMESPACE                 NAME                    AGE
openshift-local-storage   auto-discover-devices   167d
----
+
There should really be only a single LocalVolumeDiscovery object called `auto-discover-devices` in the `openshift-local-storage` namespace/project.
+
Edit this object:
+
----
oc edit localvolumediscovery auto-discover-devices -n openshift-local-storage
----
+
Add the hostname for the new node to the list that is already there like:
+
----
...
spec:
  nodeSelector:
    nodeSelectorTerms:
    - matchExpressions:
      - key: kubernetes.io/hostname
        operator: In
        values:
        - worker01.ocp.iad2.fedoraproject.org
        - worker02.ocp.iad2.fedoraproject.org
        - worker03.ocp.iad2.fedoraproject.org
        - worker04.ocp.iad2.fedoraproject.org
        - worker05.ocp.iad2.fedoraproject.org
...
----
+
Write and save the change.

3. From within the Openshift webconsole, or via cli search for all "LocalVolumeSet" objects.
+
There should really be only a single LocalVolumeSet object called `local-block` in the `openshift-local-storage` namespace/project.
+
Edit this object:
+
----
oc edit localvolumeset local-block -n openshift-local-storage
----
+
Add the hostname for the new node to the list that is already there like:
+
----
...
spec:
...
  nodeSelector:
    nodeSelectorTerms:
    - matchExpressions:
      - key: kubernetes.io/hostname
        operator: In
        values:
        - worker01.ocp.iad2.fedoraproject.org
        - worker02.ocp.iad2.fedoraproject.org
        - worker03.ocp.iad2.fedoraproject.org
        - worker04.ocp.iad2.fedoraproject.org
        - worker05.ocp.iad2.fedoraproject.org
...
----
+
Write and save the change.

4. Add the `cluster.ocs.openshift.io/openshift-storage` label to the new node:
+
----
oc label no worker05.ocp.iad2.fedoraproject.org cluster.ocs.openshift.io/openshift-storage=''
----

5. From the Openshift Web console visit `Storage, OpenShift Data Foundation`, then in the `Storage Systems` sub menu, click the 3 dot menu on the right beside the `ocs-storagecluster-storage` object. Choose `Add Capacity` option. From the popup menu that appears, ensure that the storage class `local-block` is selected in the list. Finally confirm with add.

.Note:
For best results, only perform this step once, and after all nodes have been added to the cluster.

