From 0dd0a93ce18ec1d254fb4bc1df6b12d2080dffcd Mon Sep 17 00:00:00 2001 From: Andrea Pulvirenti Date: Mon, 23 Oct 2023 12:24:51 +0200 Subject: [PATCH] fixes 2 Andrea Pulvirenti --- .../templates/_helpers.tpl | 2 +- .../templates/configmap.yaml | 5 +++-- .../templates/deployment.yaml | 9 ++++----- charts/nfs-subdir-external-provisioner/values.yaml | 2 +- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/charts/nfs-subdir-external-provisioner/templates/_helpers.tpl b/charts/nfs-subdir-external-provisioner/templates/_helpers.tpl index 5da9faa8..ca4af948 100644 --- a/charts/nfs-subdir-external-provisioner/templates/_helpers.tpl +++ b/charts/nfs-subdir-external-provisioner/templates/_helpers.tpl @@ -146,7 +146,7 @@ Params: */}} {{- define "common.configmap.lookup" -}} {{- $value := "" -}} -{{- $configmapData := (lookup "v1" "ConfigMap" (include "common.names.namespace" .context) (index . "config")).data -}} +{{- $configmapData := (lookup "v1" "ConfigMap" .context.Values.nfs.existingConfigMap.namespace .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 5fd5b46e..f427b8d8 100644 --- a/charts/nfs-subdir-external-provisioner/templates/configmap.yaml +++ b/charts/nfs-subdir-external-provisioner/templates/configmap.yaml @@ -1,10 +1,11 @@ +{{- $server := .Values.nfs.server | default "127.0.0.1" -}} {{ if (include "nfs.existing-configmap-provided" .) }} -{{- $existingConfigMap := (lookup "v1" "ConfigMap" .Values.nfs.existingConfigMap.namespace .Values.nfs.existingConfigMap.name ).data }} +{{- $existingConfigMap := (lookup "v1" "ConfigMap" .Values.nfs.existingConfigMap.namespace .Values.nfs.existingConfigMap.name).data }} {{- if (not $existingConfigMap) }} apiVersion: v1 data: path: {{ .Values.nfs.path }} - server: {{ .Values.nfs.server}} + server: {{ $server }} immutable: false kind: ConfigMap metadata: diff --git a/charts/nfs-subdir-external-provisioner/templates/deployment.yaml b/charts/nfs-subdir-external-provisioner/templates/deployment.yaml index 4d132160..5cc3d5b3 100644 --- a/charts/nfs-subdir-external-provisioner/templates/deployment.yaml +++ b/charts/nfs-subdir-external-provisioner/templates/deployment.yaml @@ -1,10 +1,9 @@ -{{- $server := .Values.nfs.server | default "0.0.0.0" -}} +{{- $server := .Values.nfs.server | default "127.0.0.1" -}} {{- $path := .Values.nfs.path -}} {{- if (include "nfs.existing-configmap-provided" .) -}} -{{- $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" $)) -}} +{{- $server = (include "common.configmap.lookup" (dict "config" .Values.nfs.existingConfigMap.name "key" "server" "defaultValue" "127.0.0.1" "context" $)) -}} +{{- $path = (include "common.configmap.lookup" (dict "config" .Values.nfs.existingConfigMap.name "key" "path" "defaultValue" .Values.nfs.path "context" $)) -}} {{- end -}} - apiVersion: apps/v1 kind: Deployment metadata: @@ -61,7 +60,7 @@ spec: - name: PROVISIONER_NAME value: {{ template "nfs-subdir-external-provisioner.provisionerName" . }} - name: NFS_SERVER - value: {{ $server }} + value: {{ $server }} - name: NFS_PATH value: {{ $path }} {{- if eq .Values.leaderElection.enabled false }} diff --git a/charts/nfs-subdir-external-provisioner/values.yaml b/charts/nfs-subdir-external-provisioner/values.yaml index fbf86c2b..97458ba8 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: "oiadp-nfs-config" + name: oiadp-nfs-config namespace: default # For creating the StorageClass automatically: