From 406f9e819f99c92534e39909985d870ecf0f63a2 Mon Sep 17 00:00:00 2001 From: Ignacio Boudgouste Date: Mon, 13 Oct 2025 14:30:58 -0300 Subject: [PATCH 1/7] feat: Add file parameters --- k8s/deployment/templates/deployment.yaml.tpl | 29 +++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/k8s/deployment/templates/deployment.yaml.tpl b/k8s/deployment/templates/deployment.yaml.tpl index d16fdf0d..829250ba 100644 --- a/k8s/deployment/templates/deployment.yaml.tpl +++ b/k8s/deployment/templates/deployment.yaml.tpl @@ -223,7 +223,6 @@ spec: {{ end }} {{ end }} {{ end }} - - name: application envFrom: - secretRef: @@ -281,6 +280,34 @@ spec: terminationMessagePath: /dev/termination-log terminationMessagePolicy: File imagePullPolicy: IfNotPresent + volumeMounts: +{{- if .parameters.results }} + {{- range .parameters.results }} + {{- if and (eq .type "file") }} + {{- if gt (len .values) 0 }} + - name: {{ printf "file-%s" (filepath.Base .destination_path | strings.ReplaceAll "." "-") }} + mountPath: {{ .destination_path }} + subPath: {{ filepath.Base .destination_path }} + readOnly: true + {{- end }} + {{- end }} + {{- end }} +{{- end }} + volumes: +{{- if .parameters.results }} + {{- range .parameters.results }} + {{- if and (eq .type "file") }} + {{- if gt (len .values) 0 }} + - name: {{ printf "file-%s" (filepath.Base .destination_path | strings.ReplaceAll "." "-") }} + secret: + secretName: {{ printf "app-data-%s" (filepath.Base .destination_path) }} + items: + - key: {{ filepath.Base .destination_path }} + path: {{ filepath.Base .destination_path }} + {{- end }} + {{- end }} + {{- end }} +{{- end }} restartPolicy: Always terminationGracePeriodSeconds: 30 dnsPolicy: ClusterFirst From a64d402f865fafc9d1e508aa292b8d16bf69adec Mon Sep 17 00:00:00 2001 From: Ignacio Boudgouste Date: Mon, 13 Oct 2025 15:45:29 -0300 Subject: [PATCH 2/7] fix: volument mount position --- k8s/deployment/templates/deployment.yaml.tpl | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/k8s/deployment/templates/deployment.yaml.tpl b/k8s/deployment/templates/deployment.yaml.tpl index 829250ba..be0f9da3 100644 --- a/k8s/deployment/templates/deployment.yaml.tpl +++ b/k8s/deployment/templates/deployment.yaml.tpl @@ -281,18 +281,18 @@ spec: terminationMessagePolicy: File imagePullPolicy: IfNotPresent volumeMounts: -{{- if .parameters.results }} - {{- range .parameters.results }} - {{- if and (eq .type "file") }} - {{- if gt (len .values) 0 }} - - name: {{ printf "file-%s" (filepath.Base .destination_path | strings.ReplaceAll "." "-") }} - mountPath: {{ .destination_path }} - subPath: {{ filepath.Base .destination_path }} - readOnly: true + {{- if .parameters.results }} + {{- range .parameters.results }} + {{- if and (eq .type "file") }} + {{- if gt (len .values) 0 }} + - name: {{ printf "file-%s" (filepath.Base .destination_path | strings.ReplaceAll "." "-") }} + mountPath: {{ .destination_path }} + subPath: {{ filepath.Base .destination_path }} + readOnly: true + {{- end }} + {{- end }} {{- end }} {{- end }} - {{- end }} -{{- end }} volumes: {{- if .parameters.results }} {{- range .parameters.results }} From 02b6fa4c1e9af32e355e45a7df604cdfc00848f8 Mon Sep 17 00:00:00 2001 From: Ignacio Boudgouste Date: Mon, 13 Oct 2025 15:58:32 -0300 Subject: [PATCH 3/7] fix: change secret name and key --- k8s/deployment/templates/deployment.yaml.tpl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/k8s/deployment/templates/deployment.yaml.tpl b/k8s/deployment/templates/deployment.yaml.tpl index be0f9da3..ab9c237d 100644 --- a/k8s/deployment/templates/deployment.yaml.tpl +++ b/k8s/deployment/templates/deployment.yaml.tpl @@ -300,9 +300,9 @@ spec: {{- if gt (len .values) 0 }} - name: {{ printf "file-%s" (filepath.Base .destination_path | strings.ReplaceAll "." "-") }} secret: - secretName: {{ printf "app-data-%s" (filepath.Base .destination_path) }} + secretName: s-{{ $.scope.id }}-d-{{ $.deployment.id }} items: - - key: {{ filepath.Base .destination_path }} + - key: {{ printf "app-data-%s" (filepath.Base .destination_path) }} path: {{ filepath.Base .destination_path }} {{- end }} {{- end }} From 0e7eac8ef7b40a19750c1364997f7d625183584a Mon Sep 17 00:00:00 2001 From: Ignacio Boudgouste Date: Mon, 13 Oct 2025 17:31:45 -0300 Subject: [PATCH 4/7] fix: change secret base 64 --- k8s/deployment/templates/secret.yaml.tpl | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/k8s/deployment/templates/secret.yaml.tpl b/k8s/deployment/templates/secret.yaml.tpl index f5918577..679c4ae8 100644 --- a/k8s/deployment/templates/secret.yaml.tpl +++ b/k8s/deployment/templates/secret.yaml.tpl @@ -39,7 +39,12 @@ data: {{- end }} {{- if and (eq .type "file") }} {{- if gt (len .values) 0 }} - {{ printf "app-data-%s" (filepath.Base .destination_path) }}: {{ index .values 0 "value" | strings.TrimPrefix "data:application/json;base64," }} + {{- $value := index .values 0 "value" }} + {{- $base64Value := $value }} + {{- if strings.Contains $value ";base64," }} + {{- $base64Value = strings.Split $value ";base64," | last }} + {{- end }} + {{ printf "app-data-%s" (filepath.Base .destination_path) }}: {{ $base64Value }} {{- end }} {{- end }} {{- end }} From b36290335179bd0b555fc6de6392875b3a8bd142 Mon Sep 17 00:00:00 2001 From: Ignacio Boudgouste Date: Mon, 13 Oct 2025 17:35:41 -0300 Subject: [PATCH 5/7] fix: secret --- k8s/deployment/templates/secret.yaml.tpl | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/k8s/deployment/templates/secret.yaml.tpl b/k8s/deployment/templates/secret.yaml.tpl index 679c4ae8..739f8b40 100644 --- a/k8s/deployment/templates/secret.yaml.tpl +++ b/k8s/deployment/templates/secret.yaml.tpl @@ -42,7 +42,8 @@ data: {{- $value := index .values 0 "value" }} {{- $base64Value := $value }} {{- if strings.Contains $value ";base64," }} - {{- $base64Value = strings.Split $value ";base64," | last }} + {{- $parts := strings.Split $value ";base64," }} + {{- $base64Value = index $parts 1 }} {{- end }} {{ printf "app-data-%s" (filepath.Base .destination_path) }}: {{ $base64Value }} {{- end }} From 0da480cde1ed214b5b69158e4a736d535a1fadc3 Mon Sep 17 00:00:00 2001 From: Ignacio Boudgouste Date: Mon, 13 Oct 2025 17:53:00 -0300 Subject: [PATCH 6/7] fix: change secret print --- k8s/deployment/templates/secret.yaml.tpl | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/k8s/deployment/templates/secret.yaml.tpl b/k8s/deployment/templates/secret.yaml.tpl index 739f8b40..32f8b815 100644 --- a/k8s/deployment/templates/secret.yaml.tpl +++ b/k8s/deployment/templates/secret.yaml.tpl @@ -39,13 +39,7 @@ data: {{- end }} {{- if and (eq .type "file") }} {{- if gt (len .values) 0 }} - {{- $value := index .values 0 "value" }} - {{- $base64Value := $value }} - {{- if strings.Contains $value ";base64," }} - {{- $parts := strings.Split $value ";base64," }} - {{- $base64Value = index $parts 1 }} - {{- end }} - {{ printf "app-data-%s" (filepath.Base .destination_path) }}: {{ $base64Value }} + {{ printf "app-data-%s" (filepath.Base .destination_path) }}: {{ index .values 0 "value" | strings.TrimPrefix "data:text/plain;base64," | strings.TrimPrefix "data:application/json;base64," }} {{- end }} {{- end }} {{- end }} From 2981b555d3c0d2e99d5e9c95a075ca79a797db2c Mon Sep 17 00:00:00 2001 From: Ignacio Boudgouste Date: Tue, 14 Oct 2025 11:57:55 -0300 Subject: [PATCH 7/7] fix: add valuie regex replacement --- k8s/deployment/templates/secret.yaml.tpl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/k8s/deployment/templates/secret.yaml.tpl b/k8s/deployment/templates/secret.yaml.tpl index 32f8b815..baa9564d 100644 --- a/k8s/deployment/templates/secret.yaml.tpl +++ b/k8s/deployment/templates/secret.yaml.tpl @@ -39,7 +39,7 @@ data: {{- end }} {{- if and (eq .type "file") }} {{- if gt (len .values) 0 }} - {{ printf "app-data-%s" (filepath.Base .destination_path) }}: {{ index .values 0 "value" | strings.TrimPrefix "data:text/plain;base64," | strings.TrimPrefix "data:application/json;base64," }} + {{ printf "app-data-%s" (filepath.Base .destination_path) }}: {{ index .values 0 "value" | regexp.Replace "^data:[^;]+;base64," "" }} {{- end }} {{- end }} {{- end }}