From 53a4ad4c4bfe7acc952faeb1fd124396aab8070c Mon Sep 17 00:00:00 2001 From: Andrea Pulvirenti Date: Sun, 22 Oct 2023 13:58:18 +0200 Subject: [PATCH] fixes 1 Andrea Pulvirenti --- .../nfs-subdir-external-provisioner/templates/_helpers.tpl | 4 ++-- .../templates/configmap.yaml | 6 ++++-- .../templates/deployment.yaml | 5 ++--- charts/nfs-subdir-external-provisioner/values.yaml | 2 +- 4 files changed, 9 insertions(+), 8 deletions(-) diff --git a/charts/nfs-subdir-external-provisioner/templates/_helpers.tpl b/charts/nfs-subdir-external-provisioner/templates/_helpers.tpl index 656fb34f..5da9faa8 100644 --- a/charts/nfs-subdir-external-provisioner/templates/_helpers.tpl +++ b/charts/nfs-subdir-external-provisioner/templates/_helpers.tpl @@ -2,7 +2,7 @@ {{/* Allow namespace to be overriden */}} -{{- define "common.name.namespace" -}} +{{- define "common.names.namespace" -}} {{- default .Release.Namespace .Values.namespaceOverride | trunc 63 | trimSuffix "-" -}} {{- end -}} @@ -146,7 +146,7 @@ Params: */}} {{- define "common.configmap.lookup" -}} {{- $value := "" -}} -{{- $configmapData := (lookup "v1" "ConfigMap" (include "common.names.namespace" .context) .configmapName).data -}} +{{- $configmapData := (lookup "v1" "ConfigMap" (include "common.names.namespace" .context) (index . "config")).data -}} {{- if and $configmapData (hasKey $configmapData .key) -}} {{- $value = index $configmapData .key -}} {{- else if .defaultValue -}} diff --git a/charts/nfs-subdir-external-provisioner/templates/configmap.yaml b/charts/nfs-subdir-external-provisioner/templates/configmap.yaml index a060a5c4..5fd5b46e 100644 --- a/charts/nfs-subdir-external-provisioner/templates/configmap.yaml +++ b/charts/nfs-subdir-external-provisioner/templates/configmap.yaml @@ -1,6 +1,6 @@ {{ if (include "nfs.existing-configmap-provided" .) }} -{{- $existingConfigMap := (lookup "v1" "ConfigMap" .Values.nfs.existingConfigMap.namespace .Values.nfs.existingConfigMap.name).data | default dict }} -{{- if not $existingConfigMap }} +{{- $existingConfigMap := (lookup "v1" "ConfigMap" .Values.nfs.existingConfigMap.namespace .Values.nfs.existingConfigMap.name ).data }} +{{- if (not $existingConfigMap) }} apiVersion: v1 data: path: {{ .Values.nfs.path }} @@ -9,5 +9,7 @@ immutable: false kind: ConfigMap metadata: name: {{ template "nfs.existing-configmap" . }} + annotation: + helm.sh/hook: pre-install, pre-upgrade {{- end }} {{- end }} \ No newline at end of file diff --git a/charts/nfs-subdir-external-provisioner/templates/deployment.yaml b/charts/nfs-subdir-external-provisioner/templates/deployment.yaml index ca864d1a..4d132160 100644 --- a/charts/nfs-subdir-external-provisioner/templates/deployment.yaml +++ b/charts/nfs-subdir-external-provisioner/templates/deployment.yaml @@ -1,8 +1,7 @@ - -{{- $server := .Values.nfs.server -}} +{{- $server := .Values.nfs.server | default "0.0.0.0" -}} {{- $path := .Values.nfs.path -}} {{- if (include "nfs.existing-configmap-provided" .) -}} -{{- $server := (include "common.configmap.lookup" (dict "config" .Values.nfs.existingConfigMap.name "key" "server" "defaultValue" .Values.nfs.server "context" $)) -}} +{{- $server := (include "common.configmap.lookup" (dict "config" .Values.nfs.existingConfigMap.name "key" "server" "0.0.0.0" .Values.nfs.server "context" $)) -}} {{- $path := (include "common.configmap.lookup" (dict "config" .Values.nfs.existingConfigMap.name "key" "path" "defaultValue" .Values.nfs.path "context" $)) -}} {{- end -}} diff --git a/charts/nfs-subdir-external-provisioner/values.yaml b/charts/nfs-subdir-external-provisioner/values.yaml index 3cd934b3..fbf86c2b 100644 --- a/charts/nfs-subdir-external-provisioner/values.yaml +++ b/charts/nfs-subdir-external-provisioner/values.yaml @@ -16,7 +16,7 @@ nfs: reclaimPolicy: Retain # existing configmap in order to get server and path existingConfigMap: - name: + name: "oiadp-nfs-config" namespace: default # For creating the StorageClass automatically: