From 3b34cbe01e6aca1aa328ce3396c6b57603c5a94c Mon Sep 17 00:00:00 2001 From: Denilson Nastacio Date: Thu, 23 Feb 2023 08:48:25 -0500 Subject: [PATCH] feat: Support NetApp ONTAP storage classes Signed-off-by: Denilson Nastacio --- README.md | 18 +++++++++++++ config/argocd-cloudpaks/cp-shared/Chart.yaml | 4 +-- .../0050-sync-common-config-map.yaml | 24 ++++++++++++++++++ .../templates/0050-sync-cp4a-config-map.yaml | 25 +++++++++++++++++++ .../templates/0050-sync-cp4s-config-map.yaml | 22 ++++++++++++++++ 5 files changed, 91 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index ea23f1be..c7583046 100644 --- a/README.md +++ b/README.md @@ -8,6 +8,7 @@ - [IBM Cloud Paks](#ibm-cloud-paks) - [GitOps](#gitops) - [Governance Policies](#governance-policies) + - [Storage](#storage) - [Installation](#installation) - [Individual clusters](#individual-clusters) - [Fleet of clusters with governance](#fleet-of-clusters-with-governance) @@ -47,6 +48,23 @@ GitOps is a declarative way to implement continuous deployment for cloud-native Practicing GitOps at scale, with dozens or even hundreds of clusters, benefits from a level of abstraction where each cluster follows a few select policies. This repository contains a simple deployment of governance policies for the deployment of OpenShift GitOps and Cloud Paks to a fleet of clusters. +## Storage + +The instructions in this repository assume the user already has an OpenShift cluster with storage capable of RWO and RWX access mode. +The Argo CD `Application` resources have pre-synchronization hooks that will attempt auto-detection of the storage in the cluster from common storage providers, in decreasing order of precedence: + +| Precedence | OpenShift platform | Storage | Storage classes | +| ---------- | ------------ | ------- | --------------- | +| Highest | All | OpenShift Data Foundation | `ocs-storagecluster-ceph-rbd` (RWO) and `ocs-storagecluster-cephfs` (RWX). | +| High | All | Rook Ceph | `rook-ceph-block` (RWO) and `rook-cephfs` (RWX) | +| Medium | All | NetApp ONTAP (Trident driver) | `trident-csi` (RWO and RWX.) Note about RWO access mode: the synchronization hooks give preference to a storage class named `trident-block-csi` if it can find one in the cluster. | +| Low | IBM Cloud (ROKS classic) | IBM Cloud File Storage | `ibmc-block-gold` (RWO) and `ibmc-file-gold-gid` (RWX) | +| Low | AWS (self-managed and ROSA) | Elastic Block Store and Elastic File System | `gp2` (RWO) and `efs` (RWX) | +| Low | Azure (self-managed and ARO) | Azure Disk (classic) and Azure File System | `managed-premium` (RWO) and `azure-file` (RWX) | + +Note that this is a list of supported storage providers for this repository. +Cloud Paks may support different matrixes of storage vendors. + ## Installation ### Individual clusters diff --git a/config/argocd-cloudpaks/cp-shared/Chart.yaml b/config/argocd-cloudpaks/cp-shared/Chart.yaml index afc8bcc5..5f740b4a 100644 --- a/config/argocd-cloudpaks/cp-shared/Chart.yaml +++ b/config/argocd-cloudpaks/cp-shared/Chart.yaml @@ -16,9 +16,9 @@ type: application # This is the chart version. This version number should be incremented each time you make changes # to the chart and its templates, including the app version. # Versions are expected to follow Semantic Versioning (https://semver.org/) -version: 0.3.1 +version: 0.4.0 # This is the version number of the application being deployed. This version number should be # incremented each time you make changes to the application. Versions are not expected to # follow Semantic Versioning. They should reflect the version the application is using. -appVersion: "1.0" +appVersion: "1.1.0" diff --git a/config/argocd-cloudpaks/cp-shared/templates/0050-sync-common-config-map.yaml b/config/argocd-cloudpaks/cp-shared/templates/0050-sync-common-config-map.yaml index 7c18bf91..e1e2aac9 100644 --- a/config/argocd-cloudpaks/cp-shared/templates/0050-sync-common-config-map.yaml +++ b/config/argocd-cloudpaks/cp-shared/templates/0050-sync-common-config-map.yaml @@ -50,6 +50,30 @@ spec: fi fi + # NetApp/Trident support + if [ -z "${storage_class_rwo}" ] || [ -z "${storage_class_rwx}" ]; then + storage_class_rwx=$(oc get storageclass \ + -o=custom-columns='NAME:metadata.name,PROVISIONER:provisioner,BACKEND-TYPE:parameters.backendType' \ + | grep "csi.trident.netapp.io.*ontap-nas" \ + | head -n 1 \ + | cut -d " " -f 1) || true + storage_class_rwo=$(oc get storageclass \ + -o=custom-columns='NAME:metadata.name,PROVISIONER:provisioner,BACKEND-TYPE:parameters.backendType' \ + | grep "csi.trident.netapp.io.*ontap-san" \ + | head -n 1 \ + | cut -d " " -f 1) || true + + # If the cluster does not have the dedicated block storage class, the NFS + # driver can address most use cases with the exception of "block" volume + # mode, which is not needed for Cloud Paks + if [ -z "${storage_class_rwo}" ] && [ -n "${storage_class_rwx}" ]; then + storage_class_rwo=${storage_class_rwx} + fi + if [ -n "${storage_class_rwo}" ] && [ -n "${storage_class_rwx}" ]; then + echo "INFO: Cluster has ONTAP installed, using ONTAP storage classes." + fi + fi + if [ -z "${storage_class_rwo}" ] || [ -z "${storage_class_rwx}" ] ; then if [[ "${api_url}" == *fyre.ibm.com* ]]; then storage_class_rwo="{{.Values.storageclass.rwo.fyre}}" diff --git a/config/argocd-cloudpaks/cp-shared/templates/0050-sync-cp4a-config-map.yaml b/config/argocd-cloudpaks/cp-shared/templates/0050-sync-cp4a-config-map.yaml index d9b568b7..9e469c7f 100644 --- a/config/argocd-cloudpaks/cp-shared/templates/0050-sync-cp4a-config-map.yaml +++ b/config/argocd-cloudpaks/cp-shared/templates/0050-sync-cp4a-config-map.yaml @@ -56,6 +56,31 @@ spec: fi fi + # NetApp/Trident support + if [ -z "${storage_class_rwo}" ] || [ -z "${storage_class_rwx}" ]; then + storage_class_rwx=$(oc get storageclass \ + -o=custom-columns='NAME:metadata.name,PROVISIONER:provisioner,BACKEND-TYPE:parameters.backendType' \ + | grep "csi.trident.netapp.io.*ontap-nas" \ + | head -n 1 \ + | cut -d " " -f 1) || true + storage_class_rwo=$(oc get storageclass \ + -o=custom-columns='NAME:metadata.name,PROVISIONER:provisioner,BACKEND-TYPE:parameters.backendType' \ + | grep "csi.trident.netapp.io.*ontap-san" \ + | head -n 1 \ + | cut -d " " -f 1) || true + + # If the cluster does not have the dedicated block storage class, the NFS + # driver can address most use cases with the exception of "block" volume + # mode, which is not needed for Cloud Paks + if [ -z "${storage_class_rwo}" ] && [ -n "${storage_class_rwx}" ]; then + storage_class_rwo=${storage_class_rwx} + fi + + if [ -n "${storage_class_rwo}" ] && [ -n "${storage_class_rwx}" ]; then + echo "INFO: Cluster has ONTAP installed, using ONTAP storage classes." + fi + fi + if [ -z "${storage_class_rwo}" ] || [ -z "${storage_class_rwx}" ] ; then if [[ "${api_url}" == *fyre.ibm.com* ]]; then storage_class_rwo="{{.Values.storageclass.rwo.fyre}}" diff --git a/config/argocd-cloudpaks/cp-shared/templates/0050-sync-cp4s-config-map.yaml b/config/argocd-cloudpaks/cp-shared/templates/0050-sync-cp4s-config-map.yaml index cc71d289..1237c55f 100644 --- a/config/argocd-cloudpaks/cp-shared/templates/0050-sync-cp4s-config-map.yaml +++ b/config/argocd-cloudpaks/cp-shared/templates/0050-sync-cp4s-config-map.yaml @@ -57,6 +57,28 @@ spec: fi fi + # NetApp/Trident support + if [ -z "${storage_class_rwo}" ]; then + storage_class_rwo=$(oc get storageclass \ + -o=custom-columns='NAME:metadata.name,PROVISIONER:provisioner,BACKEND-TYPE:parameters.backendType' \ + | grep "csi.trident.netapp.io.*ontap-san" \ + | head -n 1 \ + | cut -d " " -f 1) || true + # If the cluster does not have the dedicated block storage class, the NFS + # driver can address most use cases with the exception of "block" volume + # mode, which is not needed for Cloud Paks + if [ -z "${storage_class_rwo}" ]; then + storage_class_rwo=$(oc get storageclass \ + -o=custom-columns='NAME:metadata.name,PROVISIONER:provisioner,BACKEND-TYPE:parameters.backendType' \ + | grep "csi.trident.netapp.io.*ontap-nas" \ + | head -n 1 \ + | cut -d " " -f 1) || true + fi + if [ -n "${storage_class_rwo}" ]; then + echo "INFO: Cluster has ONTAP installed, using ONTAP storage class." + fi + fi + if [ -z "${storage_class_rwo}" ]; then if [[ "${api_url}" == *fyre.ibm.com* ]]; then storage_class_rwo="{{.Values.storageclass.rwo.fyre}}"