Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 25 additions & 6 deletions stable/democratic-csi/examples/freenas-nfs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,31 @@ storageClasses:
mountOptions:
- noatime
- nfsvers=3
secrets:
provisioner-secret:
controller-publish-secret:
node-stage-secret:
node-publish-secret:
controller-expand-secret:

# existingSecrets will look for an existing secret with name/namespace and use the values within for authentication
# the existing secret should contain something similar to with proper references for your secret:
# target:
# name: existingSecretName
# template:
# engineVersion: v2
# data:
# node-db.node.session.auth.authmethod: "CHAP"
# node-db.node.session.auth.username: "{{ .iscsi_username }}"
# node-db.node.session.auth.password: "{{ .iscsi_password }}"
# node-db.node.session.auth.username_in: "{{ .iscsi_username_in }}"
# node-db.node.session.auth.password_in: "{{ .iscsi_password_in }}"
existingSecret:
nfs-chap-secret:
name: existingSecretName
namespace: existingSecretNameSpace

# you can use EITHER an existingSecret or inline secrets below--not both.
# secrets:
# provisioner-secret:
# controller-publish-secret:
# node-stage-secret:
# node-publish-secret:
# controller-expand-secret:

# if your cluster supports snapshots you may enable below
volumeSnapshotClasses: []
Expand Down
16 changes: 14 additions & 2 deletions stable/democratic-csi/templates/storage-classes.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,19 @@ parameters:
{{ $k }}: {{ $v | quote }}
{{- end }}

# this loop is deeply connected to the loop for Secret creation below
{{- if $classRoot.existingSecrets }}
# all or nothing for secrets -> either the chart manages your secret or you need to manually do so
{{- range $k, $v := $classRoot.existingSecrets }}
csi.storage.k8s.io/{{ $k }}-name: {{ $v.name }}
csi.storage.k8s.io/{{ $k }}-namespace: {{ default $root.Release.Namespace $v.namespace }}
{{- end }}
{{- else }}
# if no existingSecrets, this loop (and the Secret creation below) will create them
{{- range $k, $v := $classRoot.secrets }}
csi.storage.k8s.io/{{ $k }}-name: {{ printf "%s-%s-%s" $k $classRoot.name $fullName | trunc 63 | trimSuffix "-" }}
csi.storage.k8s.io/{{ $k }}-namespace: {{ $root.Release.Namespace }}
{{- end }}
{{- end }}

{{- if $classRoot.mountOptions }}
mountOptions:
Expand All @@ -51,10 +59,13 @@ mountOptions:
{{ end }}
{{- end }}

# this loop is deeply connected to the loop for secret parameter settings above
# if any storageClasses, look for existingSecrets (and do nothing) or secrets (and create them)
# exclusive operation -> if existingSecrets found, you must manually create properly formatted secrets.
{{- if .Values.storageClasses -}}
{{- range .Values.storageClasses }}
{{- $classRoot := . -}}
# if you have an existingSecret, we're not creating _any_ secrets for you
{{- if not $classRoot.existingSecrets }}
{{- range $k, $v := $classRoot.secrets }}
---
apiVersion: v1
Expand All @@ -70,3 +81,4 @@ stringData:
{{- end }}
{{- end }}
{{- end }}
{{- end }}
20 changes: 20 additions & 0 deletions stable/democratic-csi/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -299,6 +299,26 @@ storageClasses: []
# # for nfs should be nfs
# fsType:
# mountOptions: []

# existingSecrets:
# anyName: # can be any arbitrary name
# name: existingSecretName
# namespace: existingSecretNamespace

# existingSecrets will look for an existing secret with name/namespace and use the values within for authentication
# the existing secret should contain something similar to with proper references for your secret:
# target:
# name: existingSecretName
# template:
# engineVersion: v2
# data:
# node-db.node.session.auth.authmethod: "CHAP"
# node-db.node.session.auth.username: "{{ .iscsi_username }}"
# node-db.node.session.auth.password: "{{ .iscsi_password }}"
# node-db.node.session.auth.username_in: "{{ .iscsi_username_in }}"
# node-db.node.session.auth.password_in: "{{ .iscsi_password_in }}"
# if you use an existingSecret -- any `secrets` below WILL BE IGNORED.

# secrets:
# provisioner-secret:
# controller-publish-secret:
Expand Down