You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: charts/k8s-service/templates/_helpers.tpl
+22Lines changed: 22 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -71,3 +71,25 @@ However, due to yaml/json limitations, all the Kubernetes resources require file
71
71
{{- end -}}
72
72
{{- "res" | index $accumulator | toString | printf -}}
73
73
{{- end -}}
74
+
75
+
{{/*
76
+
Validate hostPaths for duplicate mount paths and host paths.
77
+
*/}}
78
+
{{- define "k8s-service.validateHostPaths" -}}
79
+
{{- $mountPaths := dict -}}
80
+
{{- $hostPaths := dict -}}
81
+
{{- range $name, $value := .Values.hostPaths -}}
82
+
{{- if $value.mountPath -}}
83
+
{{- if hasKey $mountPaths $value.mountPath -}}
84
+
{{- fail (printf "Duplicate mountPath '%s' found in hostPaths: both '%s' and '%s' use the same mountPath" $value.mountPath (index $mountPaths $value.mountPath) $name) -}}
85
+
{{- end -}}
86
+
{{- $_ := set $mountPaths $value.mountPath $name -}}
87
+
{{- end -}}
88
+
{{- if $value.path -}}
89
+
{{- if hasKey $hostPaths $value.path -}}
90
+
{{- fail (printf "Duplicate host path '%s' found in hostPaths: both '%s' and '%s' use the same path" $value.path (index $hostPaths $value.path) $name) -}}
0 commit comments