Skip to content

Commit

Permalink
using custom template function
Browse files Browse the repository at this point in the history
Signed-off-by: w3aman <[email protected]>
  • Loading branch information
w3aman committed May 2, 2024
1 parent 1495898 commit 7d2a4f5
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
7 changes: 7 additions & 0 deletions deploy/helm/charts/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -146,4 +146,11 @@ Enable zfsController containers leader election if replicas > 1
- "--leader-election"
{{- end }}
{{- end }}
{{- end }}

{{/*
Ensure that the path to kubelet ends with a slash
*/}}
{{- define "zfslocalpv.zfsNode.kubeletDir" -}}
{{- printf "%s/" (.Values.lvmNode.kubeletDir | trimSuffix "/") -}}
{{- end }}
10 changes: 5 additions & 5 deletions deploy/helm/charts/templates/zfs-node.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ spec:
- name: ADDRESS
value: /plugin/csi.sock
- name: DRIVER_REG_SOCK_PATH
value: {{ if hasSuffix .Values.zfsNode.kubeletDir "/" }}{{ .Values.zfsNode.kubeletDir }}{{ else }}{{ .Values.zfsNode.kubeletDir }}/{{ end }}plugins/zfs-localpv/csi.sock
value: {{ printf "%s%s" (include "zfslocalpv.zfsNode.kubeletDir" .) "plugins/zfs-localpv/csi.sock" | quote }}
- name: KUBE_NODE_NAME
valueFrom:
fieldRef:
Expand Down Expand Up @@ -107,7 +107,7 @@ spec:
mountPropagation: "HostToContainer"
readOnly: true
- name: pods-mount-dir
mountPath: {{ if hasSuffix .Values.zfsNode.kubeletDir "/" }}{{ .Values.zfsNode.kubeletDir }}{{ else }}{{ .Values.zfsNode.kubeletDir }}/{{ end }}
mountPath: {{ include "zfslocalpv.zfsNode.kubeletDir" . | quote }}
# needed so that any mounts setup inside this container are
# propagated back to the host machine.
mountPropagation: "Bidirectional"
Expand All @@ -130,15 +130,15 @@ spec:
type: Directory
- name: registration-dir
hostPath:
path: {{ if hasSuffix .Values.zfsNode.kubeletDir "/" }}{{ .Values.zfsNode.kubeletDir }}{{ else }}{{ .Values.zfsNode.kubeletDir }}/{{ end }}plugins_registry/
path: {{ printf "%s%s" (include "zfslocalpv.zfsNode.kubeletDir" .) "plugins_registry/" | quote }}
type: DirectoryOrCreate
- name: plugin-dir
hostPath:
path: {{ if hasSuffix .Values.zfsNode.kubeletDir "/" }}{{ .Values.zfsNode.kubeletDir }}{{ else }}{{ .Values.zfsNode.kubeletDir }}/{{ end }}plugins/zfs-localpv/
path: {{ printf "%s%s" (include "zfslocalpv.zfsNode.kubeletDir" .) "plugins/zfs-localpv/" | quote }}
type: DirectoryOrCreate
- name: pods-mount-dir
hostPath:
path: {{ if hasSuffix .Values.zfsNode.kubeletDir "/" }}{{ .Values.zfsNode.kubeletDir }}{{ else }}{{ .Values.zfsNode.kubeletDir }}/{{ end }}
path: {{ include "zfslocalpv.zfsNode.kubeletDir" . | quote }}
type: Directory
{{- if .Values.zfsNode.additionalVolumes }}
{{- range $name, $config := .Values.zfsNode.additionalVolumes }}
Expand Down

0 comments on commit 7d2a4f5

Please sign in to comment.