Skip to content

Commit

Permalink
feat: Support NetApp ONTAP storage classes
Browse files Browse the repository at this point in the history
Signed-off-by: Denilson Nastacio <[email protected]>
  • Loading branch information
nastacio committed Mar 3, 2023
1 parent 2a7cfbc commit 3b34cbe
Show file tree
Hide file tree
Showing 5 changed files with 91 additions and 2 deletions.
18 changes: 18 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions config/argocd-cloudpaks/cp-shared/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Original file line number Diff line number Diff line change
Expand Up @@ -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}}"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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}}"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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}}"
Expand Down

0 comments on commit 3b34cbe

Please sign in to comment.