fixes 2 Andrea Pulvirenti <an.pulvy@gmail.com>

This commit is contained in:
Andrea Pulvirenti 2023-10-23 12:24:51 +02:00 committed by Andrea Pulvirenti
parent 53a4ad4c4b
commit 0dd0a93ce1
4 changed files with 9 additions and 9 deletions

View File

@ -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 -}}

View File

@ -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:

View File

@ -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 }}

View File

@ -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: