mirror of
https://github.com/element-hq/ess-helm.git
synced 2026-12-05 16:22:29 -08:00
Replace merge with mergeOverwrite to properly merge booleans.
This commit is contained in:
15 files changed
+25
-20
No files matched your search
@@ -38,7 +38,7 @@ SPDX-License-Identifier: AGPL-3.0-only
|
||||
{{- with .additional }}
|
||||
{{- range $key := (. | keys | uniq | sortAlpha) }}
|
||||
{{- $prop := index $root.Values.elementWeb.additional $key }}
|
||||
{{- $_ := (merge $config ((tpl $prop $root) | fromJson)) -}}
|
||||
{{- $_ := (mergeOverwrite ((tpl $prop $root) | fromJson) $config) -}}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- toPrettyJson $config -}}
|
||||
|
||||
@@ -22,7 +22,7 @@ Increasing synapse.storage.SQL past INFO will log access tokens. Putting in the
|
||||
nuked if an override is set and then if the root level is increased to debug, the access tokens will be logged.
|
||||
Putting here means it is an explicit customer choice to override it.
|
||||
*/}}
|
||||
{{- range $logger, $level := merge dict $root.Values.synapse.logging.levelOverrides (dict "synapse.storage.SQL" "INFO") }}
|
||||
{{- range $logger, $level := mergeOverwrite (dict "synapse.storage.SQL" "INFO") $root.Values.synapse.logging.levelOverrides dict }}
|
||||
{{ $logger }}:
|
||||
level: "{{ $level }}"
|
||||
{{- end }}
|
||||
|
||||
@@ -9,7 +9,7 @@ SPDX-License-Identifier: AGPL-3.0-only
|
||||
{{- $root := .root -}}
|
||||
{{- with required "element-io.ess-library.value-from-values-path missing context" .context -}}
|
||||
{{- $path := . -}}
|
||||
{{- $navigatedToPart := merge (dict) (mustDeepCopy $root.Values) -}}
|
||||
{{- $navigatedToPart := mergeOverwrite (mustDeepCopy $root.Values) (dict) -}}
|
||||
{{- range (mustRegexSplit "\\." $path -1) -}}
|
||||
{{- if $navigatedToPart -}}
|
||||
{{- $navigatedToPart = dig . nil $navigatedToPart -}}
|
||||
|
||||
@@ -13,10 +13,10 @@ SPDX-License-Identifier: AGPL-3.0-only
|
||||
{{- if and (not $tlsSecret) $root.Values.certManager -}}
|
||||
{{- with $root.Values.certManager -}}
|
||||
{{- with .clusterIssuer -}}
|
||||
{{- $annotations = merge $annotations (dict "cert-manager.io/cluster-issuer" .) -}}
|
||||
{{- $annotations = mergeOverwrite (dict "cert-manager.io/cluster-issuer" .) $annotations -}}
|
||||
{{- end -}}
|
||||
{{- with .issuer -}}
|
||||
{{- $annotations = merge $annotations (dict "cert-manager.io/issuer" .) -}}
|
||||
{{- $annotations = mergeOverwrite (dict "cert-manager.io/issuer" .) $annotations -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
@@ -21,7 +21,7 @@ SPDX-License-Identifier: AGPL-3.0-only
|
||||
apiVersion: v1
|
||||
kind: ServiceAccount
|
||||
metadata:
|
||||
{{- with (merge dict .serviceAccount.annotations $extraAnnotations) }}
|
||||
{{- with (mergeOverwrite $extraAnnotations .serviceAccount.annotations dict) }}
|
||||
annotations:
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
|
||||
@@ -72,7 +72,7 @@ app.kubernetes.io/version: {{ include "element-io.ess-library.labels.makeSafe" .
|
||||
{{- $_ := set $resultEnv $envEntry.name $envEntry.value -}}
|
||||
{{- end -}}
|
||||
{{- $overrideEnv := dict "MAS_CONFIG" "/config.yaml" -}}
|
||||
{{- $resultEnv := merge $resultEnv $overrideEnv -}}
|
||||
{{- $resultEnv := mergeOverwrite $overrideEnv $resultEnv -}}
|
||||
{{- range $key, $value := $resultEnv }}
|
||||
- name: {{ $key | quote }}
|
||||
value: {{ $value | quote }}
|
||||
|
||||
@@ -126,7 +126,7 @@ app.kubernetes.io/version: {{ include "element-io.ess-library.labels.makeSafe" .
|
||||
{{- with required "element-io.matrix-rtc-sfu.config missing context" .context -}}
|
||||
{{- $config := (tpl ($root.Files.Get "configs/matrix-rtc/sfu/config.yaml.tpl") (dict "root" $root "context" .)) | fromYaml }}
|
||||
config.yaml: |
|
||||
{{- toYaml (merge (.additional | fromYaml) $config) | nindent 2 }}
|
||||
{{- toYaml (mergeOverwrite $config (.additional | fromYaml)) | nindent 2 }}
|
||||
{{- if not ($root.Values.matrixRTC.livekitAuth).keysYaml }}
|
||||
keys-template.yaml: |
|
||||
{{- (tpl ($root.Files.Get "configs/matrix-rtc/sfu/keys-template.yaml.tpl") dict) | nindent 2 }}
|
||||
|
||||
@@ -114,7 +114,7 @@ true
|
||||
"LC_COLLATE" "C"
|
||||
"LC_CTYPE" "C"
|
||||
-}}
|
||||
{{- $resultEnv := merge $resultEnv $overrideEnv -}}
|
||||
{{- $resultEnv := mergeOverwrite $overrideEnv $resultEnv -}}
|
||||
{{- range $key, $value := $resultEnv }}
|
||||
- name: {{ $key | quote }}
|
||||
value: {{ $value | quote }}
|
||||
|
||||
@@ -190,7 +190,7 @@ app.kubernetes.io/version: {{ include "element-io.ess-library.labels.makeSafe" .
|
||||
{{- /*02 files are user provided in Helm values and end up in the Secret*/}}
|
||||
{{- /*03 files are user provided as secrets rather than directly in Helm*/}}
|
||||
04-homeserver-overrides.yaml: |
|
||||
{{- (tpl ($root.Files.Get "configs/synapse/synapse-04-homeserver-overrides.yaml.tpl") (dict "root" $root "context" (merge dict $root.Values.synapse (dict "isHook" $isHook)))) | nindent 2 }}
|
||||
{{- (tpl ($root.Files.Get "configs/synapse/synapse-04-homeserver-overrides.yaml.tpl") (dict "root" $root "context" (mergeOverwrite (dict "isHook" $isHook) $root.Values.synapse dict))) | nindent 2 }}
|
||||
05-main.yaml: |
|
||||
{{- (tpl ($root.Files.Get "configs/synapse/synapse-05-process-specific.yaml.tpl") (dict "root" $root "context" (dict "processType" "main"))) | nindent 2 }}
|
||||
{{- if not $isHook }}
|
||||
|
||||
@@ -8,7 +8,7 @@ SPDX-License-Identifier: AGPL-3.0-only
|
||||
{{- if and .enabled .checkConfigHook.enabled -}}
|
||||
{{- $enabledWorkers := (include "element-io.synapse.enabledWorkers" (dict "root" $)) | fromJson }}
|
||||
{{- $processType := "check-config-hook" }}
|
||||
{{- $perProcessRoot := merge (dict "processType" $processType "isHook" true) (.checkConfigHook | deepCopy) ($.Values.synapse | deepCopy) }}
|
||||
{{- $perProcessRoot := mergeOverwrite ($.Values.synapse | deepCopy) (.checkConfigHook | deepCopy) (dict "processType" $processType "isHook" true) }}
|
||||
apiVersion: batch/v1
|
||||
kind: Job
|
||||
metadata:
|
||||
|
||||
@@ -7,7 +7,7 @@ SPDX-License-Identifier: AGPL-3.0-only
|
||||
{{- with .Values.synapse -}}
|
||||
{{- if .enabled -}}
|
||||
{{- range $processType := prepend (keys ((include "element-io.synapse.enabledWorkers" (dict "root" $)) | fromJson)) "main" }}
|
||||
{{- $perProcessRoot := merge (dict "processType" $processType "isHook" false) $.Values.synapse }}
|
||||
{{- $perProcessRoot := mergeOverwrite $.Values.synapse (dict "processType" $processType "isHook" false) }}
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
|
||||
@@ -7,9 +7,9 @@ SPDX-License-Identifier: AGPL-3.0-only
|
||||
{{- with .Values.synapse -}}
|
||||
{{- if .enabled -}}
|
||||
{{- $enabledWorkers := (include "element-io.synapse.enabledWorkers" (dict "root" $)) | fromJson }}
|
||||
{{- range $processType, $unmergedProcessDetails := merge $enabledWorkers (dict "main" dict) }}
|
||||
{{- $perProcessRoot := merge (dict "processType" $processType "isHook" false) $.Values.synapse }}
|
||||
{{- with (merge dict ($unmergedProcessDetails | deepCopy) ($.Values.synapse | deepCopy)) }}
|
||||
{{- range $processType, $unmergedProcessDetails := mergeOverwrite (dict "main" dict) $enabledWorkers }}
|
||||
{{- $perProcessRoot := mergeOverwrite $.Values.synapse (dict "processType" $processType "isHook" false) }}
|
||||
{{- with (mergeOverwrite ($.Values.synapse | deepCopy) ($unmergedProcessDetails | deepCopy) dict) }}
|
||||
apiVersion: apps/v1
|
||||
kind: StatefulSet
|
||||
metadata:
|
||||
|
||||
@@ -51,7 +51,7 @@ k8s.element.io/target-instance: {{ $root.Release.Name }}-haproxy
|
||||
{{- $_ := set $config "org.matrix.msc4143.rtc_foci" (list (dict "type" "livekit" "livekit_service_url" (printf "https://%s" $root.Values.matrixRTC.ingress.host))) -}}
|
||||
{{- end -}}
|
||||
{{- $additional := .additional.client | fromJson -}}
|
||||
{{- tpl (toPrettyJson (merge $config $additional)) $root -}}
|
||||
{{- tpl (toPrettyJson (mergeOverwrite $additional $config)) $root -}}
|
||||
{{- end -}}
|
||||
{{- end }}
|
||||
|
||||
@@ -65,7 +65,7 @@ k8s.element.io/target-instance: {{ $root.Release.Name }}-haproxy
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- $additional := .additional.server | fromJson -}}
|
||||
{{- tpl (toPrettyJson (merge $config $additional)) $root -}}
|
||||
{{- tpl (toPrettyJson (mergeOverwrite $additional $config)) $root -}}
|
||||
{{- end -}}
|
||||
{{- end }}
|
||||
|
||||
@@ -74,7 +74,7 @@ k8s.element.io/target-instance: {{ $root.Release.Name }}-haproxy
|
||||
{{- with required "element-io.well-known-delegation.element missing context" .context -}}
|
||||
{{- $config := dict -}}
|
||||
{{- $additional := .additional.element | fromJson -}}
|
||||
{{- tpl (toPrettyJson (merge $config $additional)) $root -}}
|
||||
{{- tpl (toPrettyJson (mergeOverwrite $additional $config)) $root -}}
|
||||
{{- end -}}
|
||||
{{- end }}
|
||||
|
||||
@@ -83,7 +83,7 @@ k8s.element.io/target-instance: {{ $root.Release.Name }}-haproxy
|
||||
{{- with required "element-io.well-known-delegation.support missing context" .context -}}
|
||||
{{- $config := dict -}}
|
||||
{{- $additional := .additional.support | fromJson -}}
|
||||
{{- tpl (toPrettyJson (merge $config $additional)) $root -}}
|
||||
{{- tpl (toPrettyJson (mergeOverwrite $additional $config)) $root -}}
|
||||
{{- end -}}
|
||||
{{- end }}
|
||||
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
Fix merging of boolean in configurations.
|
||||
+5
-1
@@ -10,10 +10,14 @@ temp_output_file=$(mktemp)
|
||||
|
||||
error=1
|
||||
|
||||
find . -type f -name '*.tpl' -exec grep -E '\{\{[^}]*\$[^a-zA-Z0-9_][^}]*\}\}' {} + && {
|
||||
find . -type f -name '*.tpl' -exec grep -nE '\{\{[^}]*\$[^a-zA-Z0-9_][^}]*\}\}' {} + && {
|
||||
echo 'Error: $ is used in a .tpl files, but helm passes the local context to the special variable $ in included templates.'; exit 1
|
||||
} || echo "OK."
|
||||
|
||||
find . '(' -type f -name '*.tpl' -o -name '*.yaml' ')' -exec grep -nE '\{\{[^}]*merge\s[^}]*\}\}' {} + && {
|
||||
echo 'Error: `merge` function is used in a .yaml or .tpl files, but helm does not merge boolean properly : https://github.com/helm/helm/issues/5238. Use mergeOverwrite instead.'; exit 1
|
||||
} || echo "OK."
|
||||
|
||||
# Call the ct lint command and stream the output to stdout
|
||||
if ct lint "$@" 2>&1 | tee "$temp_output_file"
|
||||
then
|
||||
|
||||
Reference in new issue
Block a user