IBM / ibm-satellite-storage

To keep satellite storage vendor's driver deployments and configurations
Apache License 2.0
9 stars 35 forks source link

Local Storage Operator integration with IBM Cloud Satellite Storage #17

Open nkkashyap opened 3 years ago

nkkashyap commented 3 years ago

Storage Solution Description: Local persistent volumes allow you to access local storage devices, such as a disk or partition, by using the standard persistent volume claim interface. Local Storage Operator enables local volumes in your cluster. For further details about the storage solution refer to https://docs.openshift.com/container-platform/4.5/storage/persistent_storage/persistent-storage-local.html

nkkashyap commented 3 years ago

Resource specification files used for verification deployment.yaml

---
apiVersion: v1
kind: List
metadata:
    name: local-volume
    namespace: kube-system
    annotations:
        version: local-volume-45
items:
    - apiVersion: v1
      kind: Namespace
      metadata:
          name: local-storage
    - apiVersion: operators.coreos.com/v1alpha2
      kind: OperatorGroup
      metadata:
          name: local-operator-group
          namespace: local-storage
      spec:
          targetNamespaces:
              - local-storage
    - apiVersion: operators.coreos.com/v1alpha1
      kind: Subscription
      metadata:
          name: local-storage-operator
          namespace: local-storage
      spec:
          channel: "4.5"
          installPlanApproval: Automatic
          name: local-storage-operator
          source: redhat-operators
          sourceNamespace: openshift-marketplace
    - apiVersion: local.storage.openshift.io/v1
      kind: LocalVolume
      metadata:
          name: local-disk
          namespace: local-storage
      spec:
          nodeSelector:
              nodeSelectorTerms:
                  - matchExpressions:
                        - key: storage
                          operator: In
                          values:
                              - "localvol"
          storageClassDevices:
              - storageClassName: "localblock-sc"
                volumeMode: Block
                devicePaths:
                    - /dev/xvde

localvol-pvc.yaml

---
kind: PersistentVolumeClaim
apiVersion: v1
metadata:
  name: localvol-pvc
spec:
  accessModes:
    - ReadWriteOnce
  resources:
    requests:
      storage: 50Gi
  volumeMode: Block
  storageClassName: localblock-sc

localvol-pod.yaml

apiVersion: v1
kind: Pod
metadata:
  name: localvol-pod
spec:
  volumes:
  - name: localpvc
    persistentVolumeClaim:
        claimName: localvol-pvc
  containers:
  - name: devtest
    image: gcr.io/google-samples/node-hello:1.0
    volumeDevices:
    - name: localpvc
      devicePath: /dev/sda
nkkashyap commented 3 years ago

Verification test results Steps to deploy the resource:

1. From IBM Cloud Console -> Satellite -> Configurations -> Create Configuration
2. From IBM Cloud Console -> Satellite -> Configurations -> Select the Configuration -> Add version and upload the deployment yaml
3. From IBM Cloud Console -> Satellite -> Configurations -> Select the Configuration -> Create Subscription

Output

$ oc get all -n local-storage
NAME                                          READY   STATUS    RESTARTS   AGE
pod/local-disk-local-diskmaker-54v7b          1/1     Running   0          10m
pod/local-disk-local-diskmaker-nkf2f          1/1     Running   0          10m
pod/local-disk-local-provisioner-mdqjf        1/1     Running   0          10m
pod/local-disk-local-provisioner-prtj5        1/1     Running   0          10m
pod/local-storage-operator-577db479fb-7z7tb   1/1     Running   0          10m

NAME                             TYPE        CLUSTER-IP       EXTERNAL-IP   PORT(S)     AGE
service/local-storage-operator   ClusterIP   172.21.188.135   <none>        60000/TCP   10m

NAME                                          DESIRED   CURRENT   READY   UP-TO-DATE   AVAILABLE   NODE SELECTOR   AGE
daemonset.apps/local-disk-local-diskmaker     2         2         2       2            2           <none>          10m
daemonset.apps/local-disk-local-provisioner   2         2         2       2            2           <none>          10m

NAME                                     READY   UP-TO-DATE   AVAILABLE   AGE
deployment.apps/local-storage-operator   1/1     1            1           10m

NAME                                                DESIRED   CURRENT   READY   AGE
replicaset.apps/local-storage-operator-577db479fb   1         1         1       10m
$ oc get pv
NAME                CAPACITY   ACCESS MODES   RECLAIM POLICY   STATUS      CLAIM        STORAGECLASS    REASON   AGE
local-pv-8a72fc8d   50Gi       RWO            Delete           Available                localblock-sc            10m
local-pv-8c400223   50Gi       RWO            Delete           Available                localblock-sc            10m
nkkashyap commented 3 years ago

Test results

$ oc create -f ./localvol-pvc.yaml 
persistentvolumeclaim/localvol-pvc created
$ oc get pvc
NAME           STATUS    VOLUME   CAPACITY   ACCESS MODES   STORAGECLASS    AGE
localvol-pvc   Pending                                      localblock-sc   10s
$ oc create -f ./localvol-pod.yaml 
pod/localvol-pod created
Neerajs-MacBook-Pro:local-storage nkashyap$ oc get pv,pvc
NAME                                 CAPACITY   ACCESS MODES   RECLAIM POLICY   STATUS      CLAIM                  STORAGECLASS    REASON   AGE
persistentvolume/local-pv-8a72fc8d   50Gi       RWO            Delete           Available                          localblock-sc            11m
persistentvolume/local-pv-8c400223   50Gi       RWO            Delete           Bound       default/localvol-pvc   localblock-sc            11m

NAME                                 STATUS   VOLUME              CAPACITY   ACCESS MODES   STORAGECLASS    AGE
persistentvolumeclaim/localvol-pvc   Bound    local-pv-8c400223   50Gi       RWO            localblock-sc   38s
nkkashyap commented 3 years ago

Storage Class

$ oc get sc localblock-sc
NAME            PROVISIONER                    RECLAIMPOLICY   VOLUMEBINDINGMODE      ALLOWVOLUMEEXPANSION   AGE
localblock-sc   kubernetes.io/no-provisioner   Delete          WaitForFirstConsumer   false                  19m

PVC Created using the above Storage Class

$ oc get pvc
NAME           STATUS   VOLUME              CAPACITY   ACCESS MODES   STORAGECLASS    AGE
localvol-pvc   Bound    local-pv-8c400223   50Gi       RWO            localblock-sc   18m

POD using the above PVC

$ oc get pods
NAME           READY   STATUS    RESTARTS   AGE
localvol-pod   1/1     Running   0          17m
nkkashyap commented 3 years ago

Local-Volume Template Test Create configuration from the configuration template in forked repo https://github.com/nkkashyap/ibm-satellite-storage/tree/local-vol/config-templates/redhat/local-volume/4.5

$ ibmcloud sat storage config create --name localvol-conf --template-name local-volume --template-version 4.5 -p "label-key=storage" -p "label-value=localvol" -p "devicepath=/dev/xvde" --source-org nkkashyap --source-branch "local-vol"
Creating storage configuration for satellite...
OK
Storage configuration 'localvol-conf' was successfully created with ID '4c1689a5-9922-43cb-b8e3-07e0a8fa88f6'.

Apply the local volume configuration to a cluster

$ ibmcloud sat storage attachment create --name local-vol --cluster-group devtest --configuration localvol-conf
Creating attachment...
OK
Attachment local-vol was successfully created with ID c619ab70-76db-4374-9ee3-cb62b8f5c874.

Verify the resource deployment

$ oc get all -n local-storage
NAME                                          READY   STATUS    RESTARTS   AGE
pod/local-disk-local-diskmaker-qnb9g          1/1     Running   0          40s
pod/local-disk-local-diskmaker-xgph4          1/1     Running   0          40s
pod/local-disk-local-provisioner-4v8r7        1/1     Running   0          40s
pod/local-disk-local-provisioner-phmcp        1/1     Running   0          40s
pod/local-storage-operator-577db479fb-dz976   1/1     Running   0          44s

NAME                             TYPE        CLUSTER-IP      EXTERNAL-IP   PORT(S)     AGE
service/local-storage-operator   ClusterIP   172.21.162.98   <none>        60000/TCP   43s

NAME                                          DESIRED   CURRENT   READY   UP-TO-DATE   AVAILABLE   NODE SELECTOR   AGE
daemonset.apps/local-disk-local-diskmaker     2         2         2       2            2           <none>          41s
daemonset.apps/local-disk-local-provisioner   2         2         2       2            2           <none>          41s

NAME                                     READY   UP-TO-DATE   AVAILABLE   AGE
deployment.apps/local-storage-operator   1/1     1            1           45s

NAME                                                DESIRED   CURRENT   READY   AGE
replicaset.apps/local-storage-operator-577db479fb   1         1         1       46s
$ oc get pv
NAME                CAPACITY   ACCESS MODES   RECLAIM POLICY   STATUS      CLAIM   STORAGECLASS    REASON   AGE
local-pv-8a72fc8d   50Gi       RWO            Delete           Available           localblock-sc            54s
local-pv-8c400223   50Gi       RWO            Delete           Available           localblock-sc            53s
nkkashyap commented 3 years ago

PR: https://github.com/IBM/ibm-satellite-storage/pull/18