Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 22 additions & 1 deletion pkg/helm/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,25 @@
{{- $securityContext = omit $securityContext "appArmorProfile" -}}
{{- end -}}
{{- $securityContext | toYaml -}}
{{- end -}}
{{- end -}}

{{- define "tpl.preserve.variable" -}}
{{- $obj := . }}
{{- if kindIs "map" $obj }}
{{- range $k, $v := $obj }}
{{- if kindIs "string" $v }}
{{- if regexMatch "^[0-9]+$" $v }}
{{- $_ := set $obj $k (atoi $v) }}
{{- else if regexMatch "(?i)^(true|false)$" $v }}
{{- $_ := set $obj $k (eq (lower $v) "true") }}
{{- end }}
{{- else }}
{{- include "tpl.preserve.variable" $v }}
{{- end }}
{{- end }}
{{- else if kindIs "slice" $obj }}
{{- range $i, $v := $obj }}
{{- include "tpl.preserve.variable" $v }}
{{- end }}
{{- end }}
{{- end }}
4 changes: 3 additions & 1 deletion pkg/helm/templates/configmap-serverDefinitions.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,7 @@ metadata:
annotations: {{ . | toYaml | nindent 4 }}
{{- end }}
data:
servers.json: | {{ tpl (dict "Servers" .Values.serverDefinitions.data | toYaml) . | fromYaml | toPrettyJson | nindent 4 }}
{{- $variableToPreserveTPL := tpl (dict "Servers" .Values.serverDefinitions.data | toYaml) . | fromYaml }}
{{- include "tpl.preserve.variable" $variableToPreserveTPL }}
servers.json: | {{ $variableToPreserveTPL | toYaml | nindent 4 }}
{{- end }}
4 changes: 2 additions & 2 deletions pkg/helm/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ spec:
- name: PGADMIN_DISABLE_POSTFIX
value: {{ .Values.disablePostfix | quote }}
{{- with .Values.extraEnvVars }}
{{- tpl (. | toYaml) $ | nindent 14 }}
{{- tpl (. | toYaml) $ | nindent 12 }}
{{- end }}
volumeMounts:
- mountPath: /var/lib/pgadmin
Expand Down Expand Up @@ -234,4 +234,4 @@ spec:
type: RuntimeDefault
{{- end }}
windowsOptions:
hostProcess: false
hostProcess: false
Loading