From 1ba8089cd553c01b58f671b49b02c6ba4bc90f23 Mon Sep 17 00:00:00 2001 From: Doug Goldstein Date: Wed, 19 Feb 2025 15:20:08 -0600 Subject: [PATCH] helm-toolkit: always add pod mounts for db-sync job Always include mounts defined for the db-sync job under the pods section rather than requiring every chart to pass it in explicitly. Now the passed in value can be just for overrides. Since charts today already pass this in, we need to de-duplicate it to ensure we don't create this multiple times. Change-Id: I042e79cee7859ebdc001a056edc75eb89dd3e5b3 --- helm-toolkit/templates/manifests/_job-db-sync.tpl | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/helm-toolkit/templates/manifests/_job-db-sync.tpl b/helm-toolkit/templates/manifests/_job-db-sync.tpl index 4696c88fd2..03b048416a 100644 --- a/helm-toolkit/templates/manifests/_job-db-sync.tpl +++ b/helm-toolkit/templates/manifests/_job-db-sync.tpl @@ -20,14 +20,16 @@ limitations under the License. {{- define "helm-toolkit.manifests.job_db_sync" -}} {{- $envAll := index . "envAll" -}} {{- $serviceName := index . "serviceName" -}} +{{- $jobNameRef := printf "%s_%s" $serviceName "db_sync" -}} {{- $jobAnnotations := index . "jobAnnotations" -}} {{- $jobLabels := index . "jobLabels" -}} {{- $nodeSelector := index . "nodeSelector" | default ( dict $envAll.Values.labels.job.node_selector_key $envAll.Values.labels.job.node_selector_value ) -}} {{- $tolerationsEnabled := index . "tolerationsEnabled" | default false -}} {{- $configMapBin := index . "configMapBin" | default (printf "%s-%s" $serviceName "bin" ) -}} {{- $configMapEtc := index . "configMapEtc" | default (printf "%s-%s" $serviceName "etc" ) -}} -{{- $podVolMounts := index . "podVolMounts" | default false -}} -{{- $podVols := index . "podVols" | default false -}} +{{- $podMount := index (index $envAll.Values.pod.mounts $jobNameRef | default dict) $jobNameRef | default dict -}} +{{- $podVolMounts := (concat ((index $podMount "volumeMounts" | default list)) ((index . "podVolMounts") | default (list))) | uniq -}} +{{- $podVols := (concat ((index $podMount "volumes" | default list)) ((index . "podVols") | default (list))) | uniq -}} {{- $podEnvVars := index . "podEnvVars" | default false -}} {{- $dbToSync := index . "dbToSync" | default ( dict "configFile" (printf "/etc/%s/%s.conf" $serviceName $serviceName ) "logConfigFile" (printf "/etc/%s/logging.conf" $serviceName ) "image" ( index $envAll.Values.images.tags ( printf "%s_db_sync" $serviceName )) ) -}} {{- $secretBin := index . "secretBin" -}}