Skip to content

Commit

Permalink
feat: add labels and annotations for storage classes (#123)
Browse files Browse the repository at this point in the history
* feat: add labels and annotations for storage classes

* chore: bump version to 2.7.0

* chore: correct version
  • Loading branch information
fad3t authored Sep 25, 2023
1 parent 3f3c746 commit b9e7367
Show file tree
Hide file tree
Showing 4 changed files with 84 additions and 45 deletions.
2 changes: 1 addition & 1 deletion charts/nutanix-csi-storage/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
apiVersion: v1
name: nutanix-csi-storage
version: 2.6.4
version: 2.6.5
kubeVersion: ">= 1.17.0-0"
description: Nutanix Container Storage Interface (CSI) Driver
home: https://github.com/nutanix/helm
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ spec:
hostNetwork: true
containers:
- name: csi-provisioner
{{- if semverCompare ">=1.20-0" .Capabilities.KubeVersion.Version }}
{{- if semverCompare ">=1.20-0" .Capabilities.KubeVersion.Version }}
image: {{ .Values.sidecars.provisioner.image }}
{{- else }}
image: {{ .Values.sidecars.provisioner.imageLegacy }}
Expand Down
115 changes: 72 additions & 43 deletions charts/nutanix-csi-storage/templates/ntnx-sc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,27 +5,34 @@
kind: StorageClass
apiVersion: storage.k8s.io/v1
metadata:
name: {{ .Values.volumeClassName }}
{{- if eq .Values.defaultStorageClass "volume" }}
annotations:
storageclass.kubernetes.io/is-default-class: "true"
{{- end }}
name: {{ .Values.volumeClassName }}
annotations:
{{- if eq .Values.defaultStorageClass "volume" }}
storageclass.kubernetes.io/is-default-class: "true"
{{- end }}
{{- with .Values.volumeClassAnnotations }}
{{ toYaml . | nindent 4 }}
{{- end }}
labels:
{{- with .Values.volumeClassLabels }}
{{ toYaml . | nindent 4 }}
{{- end }}
provisioner: {{ include "nutanix-csi-storage.drivername" . }}
parameters:
storageType: NutanixVolumes
csi.storage.k8s.io/provisioner-secret-name: {{ .Values.secretName }}
csi.storage.k8s.io/provisioner-secret-namespace: {{ .Release.Namespace }}
csi.storage.k8s.io/node-publish-secret-name: {{ .Values.secretName }}
csi.storage.k8s.io/node-publish-secret-namespace: {{ .Release.Namespace }}
csi.storage.k8s.io/controller-expand-secret-name: {{ .Values.secretName }}
csi.storage.k8s.io/controller-expand-secret-namespace: {{ .Release.Namespace }}
storageContainer: {{ .Values.storageContainer }}
csi.storage.k8s.io/fstype: {{ .Values.fsType }}
isSegmentedIscsiNetwork: {{ quote .Values.networkSegmentation }}
description: {{ quote (.Values.volumeClassDescription | default .Values.volumeClassName) }}
storageType: NutanixVolumes
csi.storage.k8s.io/provisioner-secret-name: {{ .Values.secretName }}
csi.storage.k8s.io/provisioner-secret-namespace: {{ .Release.Namespace }}
csi.storage.k8s.io/node-publish-secret-name: {{ .Values.secretName }}
csi.storage.k8s.io/node-publish-secret-namespace: {{ .Release.Namespace }}
csi.storage.k8s.io/controller-expand-secret-name: {{ .Values.secretName }}
csi.storage.k8s.io/controller-expand-secret-namespace: {{ .Release.Namespace }}
storageContainer: {{ .Values.storageContainer }}
csi.storage.k8s.io/fstype: {{ .Values.fsType }}
isSegmentedIscsiNetwork: {{ quote .Values.networkSegmentation }}
description: {{ quote (.Values.volumeClassDescription | default .Values.volumeClassName) }}
{{- if eq .Values.lvmVolume true }}
isLVMVolume: "true"
numLVMDisks: {{ quote .Values.lvmDisks }}
isLVMVolume: "true"
numLVMDisks: {{ quote .Values.lvmDisks }}
{{- end }}
allowVolumeExpansion: true
reclaimPolicy: {{ .Values.volumeClassRetention }}
Expand All @@ -37,7 +44,15 @@ apiVersion: snapshot.storage.k8s.io/v1beta1
{{- end }}
kind: VolumeSnapshotClass
metadata:
name: nutanix-snapshot-class
name: {{ .Values.volumeSnapshotClassName }}
annotations:
{{- with .Values.volumeSnapshotClassAnnotations }}
{{ toYaml . | nindent 4 }}
{{- end }}
labels:
{{- with .Values.volumeSnapshotClassLabels }}
{{ toYaml . | nindent 4 }}
{{- end }}
driver: {{ include "nutanix-csi-storage.drivername" . }}
parameters:
storageType: NutanixVolumes
Expand All @@ -54,16 +69,23 @@ deletionPolicy: Delete
kind: StorageClass
apiVersion: storage.k8s.io/v1
metadata:
name: {{ .Values.fileClassName }}
{{- if eq .Values.defaultStorageClass "file" }}
annotations:
storageclass.kubernetes.io/is-default-class: "true"
{{- end }}
name: {{ .Values.fileClassName }}
annotations:
{{- if eq .Values.defaultStorageClass "file" }}
storageclass.kubernetes.io/is-default-class: "true"
{{- end }}
{{- with .Values.fileClassAnnotations }}
{{ toYaml . | nindent 4 }}
{{- end }}
labels:
{{- with .Values.fileClassLabels }}
{{ toYaml . | nindent 4 }}
{{- end }}
provisioner: {{ include "nutanix-csi-storage.drivername" . }}
parameters:
storageType: NutanixFiles
nfsServer: {{ .Values.fileHost }}
nfsPath: {{ .Values.filePath }}
storageType: NutanixFiles
nfsServer: {{ .Values.fileHost }}
nfsPath: {{ .Values.filePath }}
reclaimPolicy: {{ .Values.fileClassRetention }}
{{- end }}

Expand All @@ -74,24 +96,31 @@ reclaimPolicy: {{ .Values.fileClassRetention }}
kind: StorageClass
apiVersion: storage.k8s.io/v1
metadata:
name: {{ .Values.dynamicFileClassName }}
{{- if eq .Values.defaultStorageClass "dynfile" }}
annotations:
storageclass.kubernetes.io/is-default-class: "true"
{{- end }}
name: {{ .Values.dynamicFileClassName }}
annotations:
{{- if eq .Values.defaultStorageClass "dynfile" }}
storageclass.kubernetes.io/is-default-class: "true"
{{- end }}
{{- with .Values.dynamicFileClassAnnotations }}
{{ toYaml . | nindent 4 }}
{{- end }}
labels:
{{- with .Values.dynamicFileClassLabels }}
{{ toYaml . | nindent 4 }}
{{- end }}
provisioner: {{ include "nutanix-csi-storage.drivername" . }}
parameters:
storageType: NutanixFiles
dynamicProv: ENABLED
squashType: {{ .Values.dynamicFileSquashType }}
nfsServerName: {{ .Values.fileServerName }}
csi.storage.k8s.io/provisioner-secret-name: {{ .Values.secretName }}
csi.storage.k8s.io/provisioner-secret-namespace: {{ .Release.Namespace }}
csi.storage.k8s.io/node-publish-secret-name: {{ .Values.secretName }}
csi.storage.k8s.io/node-publish-secret-namespace: {{ .Release.Namespace }}
csi.storage.k8s.io/controller-expand-secret-name: {{ .Values.secretName }}
csi.storage.k8s.io/controller-expand-secret-namespace: {{ .Release.Namespace }}
description: {{ quote (.Values.dynamicFileClassDescription | default .Values.dynamicFileClassName) }}
storageType: NutanixFiles
dynamicProv: ENABLED
squashType: {{ .Values.dynamicFileSquashType }}
nfsServerName: {{ .Values.fileServerName }}
csi.storage.k8s.io/provisioner-secret-name: {{ .Values.secretName }}
csi.storage.k8s.io/provisioner-secret-namespace: {{ .Release.Namespace }}
csi.storage.k8s.io/node-publish-secret-name: {{ .Values.secretName }}
csi.storage.k8s.io/node-publish-secret-namespace: {{ .Release.Namespace }}
csi.storage.k8s.io/controller-expand-secret-name: {{ .Values.secretName }}
csi.storage.k8s.io/controller-expand-secret-namespace: {{ .Release.Namespace }}
description: {{ quote (.Values.dynamicFileClassDescription | default .Values.dynamicFileClassName) }}
allowVolumeExpansion: true
reclaimPolicy: {{ .Values.dynamicFileClassRetention }}
{{- end }}
10 changes: 10 additions & 0 deletions charts/nutanix-csi-storage/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,25 @@ volumeClass: false
volumeClassName: "nutanix-volume"
volumeClassRetention: "Delete"
# volumeClassDescription: ""
# volumeClassAnnotations: {}
# volumeClassLabels: {}

volumeSnapshotClassName: "nutanix-snapshot-class"
# volumeSnapshotClassAnnotations: {}
# volumeSnapshotClassLabels: {}

fileClass: false
fileClassName: "nutanix-file"
fileClassRetention: "Delete"
# fileClassAnnotations: {}
# fileClassLabels: {}

dynamicFileClass: false
dynamicFileClassName: "nutanix-dynamicfile"
dynamicFileClassRetention: "Delete"
# dynamicFileClassDescription: ""
# dynamicFileClassAnnotations: {}
# dynamicFileClassLabels: {}

# Default Storage Class settings
#
Expand Down

0 comments on commit b9e7367

Please sign in to comment.