A simple Kubernetes operator that creates, configures, and deletes NetApp ONTAP Storage Virtual Machine (SVM), also know as virtual server (vServer), resources.
This operator uses Red Hat's Operator-SDK to scaffold a controller that manages an Storage Virtual Machines (SVMs) resources in an NetApp ONTAP cluster.
The current version of the operator is v1beta1. V1beta1 migrated Operator-SDK to 1.33.0 and updated go dependencies to avoid critical warnings.
The operator creates and updates:
- an SVM,
- an optional SVM management LIF,
- an optional SVM administrator management credentials (vsadmin),
- an optional NFS configuration with NFS interfaces and NFS exports,
- and an optional iSCSI configuration with iSCSI interfaces.
When the custom resource (CR) is delete, the operator uses a finalizer (called gateway.netapp.com) to delete the SVM and all it configuration when the CR is deleted.
kubectl create -f https://raw.githubusercontent.com/NetApp-Learning-Services/gateway/main/config/deploy/v1beta1/gatewayoperator.yaml
(NOTE: This example is deployed in the gateway namesspaces that gets created when deploying the operator)
apiVersion: v1
kind: Secret
metadata:
name: ontap-cluster-admin
namespace: gateway
type: kubernetes.io/basic-auth
stringData:
username: admin
password: Netapp1!
(NOTE: This example is deployed in the gateway namesspaces that gets created when deploying the operator)
apiVersion: v1
kind: Secret
metadata:
name: ontap-svm-admin
namespace: gateway
type: kubernetes.io/basic-auth
stringData:
username: vsadmin
password: Netapp1!
(NOTE: Make sure you provide the required Cluster administrator's credentials created in step 2 and clusterHost
with the NetApp ONTAP cluster management LIF. Also, the debug
setting in the spec provides additional logging information in the operator's manager
container logs. )
apiVersion: gateway.netapp.com/v1beta1
kind: StorageVirtualMachine
metadata:
name: storagevirtualmachine-testcase
namespace: gateway
spec:
svmName: testVs
clusterHost: 192.168.0.102
debug: false
aggregates:
- name: Cluster2_01_FC_1
management:
name: manage1
ip: 192.168.0.30
netmask: 255.255.255.0
broadcastDomain: Default
homeNode: Cluster2-01
vsadminCredentials:
name: ontap-svm-admin
namespace: gateway
clusterCredentials:
name: ontap-cluster-admin
namespace: gateway
iscsi:
enabled: true
alias: testVs
interfaces:
- name: iscsi1
ip: 192.168.0.51
netmask: 255.255.255.0
broadcastDomain: Default
homeNode: Cluster2-01
nfs:
enabled: true
v3: true
v4: true
v41: true
interfaces:
- name: nfs1
ip: 192.168.0.31
netmask: 255.255.255.0
broadcastDomain: Default
homeNode: Cluster2-01
export:
name: default
rules:
- clients: 0.0.0.0/0
protocols: any
rw: any
ro: any
superuser: any
anon: "65534"
5. Deploy NetApp Astra Trident to manage the SVM resources created by this operator.
Written by Curtis Burchett
This project aims to follow the Kubernetes Operator pattern.
It uses Controllers which provides a reconcile function responsible for synchronizing resources until the desired state is reached on the cluster.
Copyright 2024.
Creative Commons Legal Code, CC0 1.0 Universal