Skip to content

Commit

Permalink
feat: add rawEnv parameter to kargo.environment.render
Browse files Browse the repository at this point in the history
  • Loading branch information
robinbourianes-kalisio committed Jul 16, 2024
1 parent 8240c6d commit ca97837
Show file tree
Hide file tree
Showing 12 changed files with 30 additions and 11 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,15 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [Unreleased]

### Added

- Added new `trakkar` chart to deploy [traccar](https://www.traccar.org/) <-> kano gateway.

### Changed

- `kargo.environment.render` now takes an additional `rawEnv` parameter that can be used to define environment variables without transforming their names.
- Updated `kargo` chart helpers to use the new `rawEnv` (`kargo.deployment`, `kargo.e2e-tests-cronjob`, `kargo.envsubstConfig.renderInitContainer`, `kargo.kdk-deployment`, `kargo.krawler-cronjob`).
- Updated `express-gateway`, `k2`, `kanboard`, `passbolt` and `thredds` chart to use the new `rawEnv`.

### Removed

## kargo-1.0.6 (2024-07-15)
Expand Down
2 changes: 1 addition & 1 deletion charts/express-gateway/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ spec:
- name: HTTP_PROXY
- name: HTTPS_PROXY
- name: NO_PROXY
{{- include "kargo.environment.render" (dict "env" .Values.env "context" $) | indent 12 }}
{{- include "kargo.environment.render" (dict "env" .Values.env "rawEnv" .Values.rawEnv "context" $) | indent 12 }}
ports:
- name: {{ include "kargo.names.name" . }}
containerPort: 8080
Expand Down
2 changes: 1 addition & 1 deletion charts/k2/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ spec:
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
env:
{{- include "kargo.environment.render" (dict "env" .Values.env "context" $) | indent 12 }}
{{- include "kargo.environment.render" (dict "env" .Values.env "rawEnv" .Values.rawEnv "context" $) | indent 12 }}
ports:
- name: {{ include "kargo.names.name" . }}
containerPort: 8080
Expand Down
2 changes: 1 addition & 1 deletion charts/kanboard/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ spec:
imagePullPolicy: {{ .Values.image.pullPolicy }}
{{- if .Values.env }}
env:
{{- include "kargo.environment.render" (dict "env" .Values.env "context" $) | indent 12 }}
{{- include "kargo.environment.render" (dict "env" .Values.env "rawEnv" .Values.rawEnv "context" $) | indent 12 }}
{{- end }}
ports:
- name: {{ include "kargo.names.name" . }}
Expand Down
2 changes: 1 addition & 1 deletion charts/kargo/templates/_deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ spec:
imagePullPolicy: {{ ternary "Always" .Values.image.pullPolicy .Values.forceRestart }}
{{- if .Values.env }}
env:
{{- include "kargo.environment.render" (dict "env" .Values.env "context" $) | indent 12 }}
{{- include "kargo.environment.render" (dict "env" .Values.env "rawEnv" .Values.rawEnv "context" $) | indent 12 }}
{{- end }}
ports:
- name: {{ include "kargo.names.name" . | trunc 15 }}
Expand Down
2 changes: 1 addition & 1 deletion charts/kargo/templates/_e2e-tests-cronjob.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ spec:
readOnly: true
imagePullPolicy: Always
env:
{{- include "kargo.environment.render" (dict "env" .args.env "context" .context) | indent 16 }}
{{- include "kargo.environment.render" (dict "env" .args.env "rawEnv" .args.rawEnv "context" .context) | indent 16 }}
securityContext:
capabilities:
add:
Expand Down
13 changes: 12 additions & 1 deletion charts/kargo/templates/_environment.tpl
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{{/*
Renders an object that contains a list of key/value properties that can be transformed into environement variables
Usage:
{{ include "kargo.environment.render" (dict "env" .Values.path.to.the.env "context" $) }}
{{ include "kargo.environment.render" (dict "env" .Values.path.to.the.env "rawEnv" .Values.path.to.the.rawEnv "context" $) }}
*/}}
{{- define "kargo.environment.render" -}}
{{- $defaultSecret := include "kargo.names.secret" .context }}
Expand All @@ -16,4 +16,15 @@ Usage:
value: {{ include "kargo.tplvalues.render" (dict "value" $value "context" $.context) | quote }}
{{- end }}
{{- end }}
{{- range $key, $value := .rawEnv }}
- name: {{ $key }}
{{- if kindIs "map" $value }}
valueFrom:
secretKeyRef:
name: {{ $value.secret | default $defaultSecret }}
key: {{ $value.key | default (kebabcase $key) }}
{{- else }}
value: {{ include "kargo.tplvalues.render" (dict "value" $value "context" $.context) | quote }}
{{- end }}
{{- end }}
{{- end -}}
2 changes: 1 addition & 1 deletion charts/kargo/templates/_envsubstConfig.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ Builds an initContainer definition to perform envsubst on a configMap and store
- '{}'
- ';'
env:
{{- include "kargo.environment.render" (dict "env" .args.env "context" .context) | indent 4 }}
{{- include "kargo.environment.render" (dict "env" .args.env "rawEnv" .args.rawEnv "context" .context) | indent 4 }}
volumeMounts:
- mountPath: /source
name: envsubst-config-source-config{{ default "" .args.helperSuffix }}
Expand Down
2 changes: 1 addition & 1 deletion charts/kargo/templates/_kdk-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ spec:
name: {{ .Values.distribution.redisUrl.secret | default (include "kargo.names.secret" .) }}
key: {{ .Values.distribution.redisUrl.key | default "redis-url" }}
{{- end }}
{{- include "kargo.environment.render" (dict "env" .Values.env "context" $) | indent 12 }}
{{- include "kargo.environment.render" (dict "env" .Values.env "rawEnv" .Values.rawEnv "context" $) | indent 12 }}
ports:
- name: {{ include "kargo.names.name" . | trunc 15 }}
containerPort: {{ .Values.containerPort | default 8081 }}
Expand Down
2 changes: 1 addition & 1 deletion charts/kargo/templates/_krawler-cronjob.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ spec:
value: ""
- name: MESSAGE_TEMPLATE
value: "*<%= SUBDOMAIN %>*\nKrawler job *<%= jobId %>*: <%= error.message %>"
{{- include "kargo.environment.render" (dict "env" .Values.env "context" $) | indent 16 }}
{{- include "kargo.environment.render" (dict "env" .Values.env "rawEnv" .Values.rawEnv "context" $) | indent 16 }}
{{- if .Values.dataVolume }}
volumeMounts:
- mountPath: {{ .Values.dataMountPath | default "/data" }}
Expand Down
2 changes: 1 addition & 1 deletion charts/passbolt/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ spec:
imagePullPolicy: {{ .Values.image.pullPolicy }}
{{- if .Values.env }}
env:
{{- include "kargo.environment.render" (dict "env" .Values.env "context" $) | indent 12 }}
{{- include "kargo.environment.render" (dict "env" .Values.env "rawEnv" .Values.rawEnv "context" $) | indent 12 }}
{{- end }}
ports:
- name: {{ include "kargo.names.name" . }}
Expand Down
2 changes: 1 addition & 1 deletion charts/thredds/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ spec:
- name: HTTP_PROXY
- name: HTTPS_PROXY
- name: NO_PROXY
{{- include "kargo.environment.render" (dict "env" .Values.env "context" $) | indent 12 }}
{{- include "kargo.environment.render" (dict "env" .Values.env "rawEnv" .Values.rawEnv "context" $) | indent 12 }}
ports:
- name: {{ include "kargo.names.name" . }}
containerPort: 8080
Expand Down

0 comments on commit ca97837

Please sign in to comment.