Skip to content

Commit

Permalink
fix: config env, add secret env
Browse files Browse the repository at this point in the history
  • Loading branch information
andrejpetras committed Jan 24, 2024
1 parent 9a10137 commit 40b6889
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 9 deletions.
5 changes: 0 additions & 5 deletions templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,6 @@
{{ if .Values.routing.backend }}{{ .Values.appId }}{{ else }}{{ template "app.fullname" $ }}{{ end }}
{{- end -}}


{{- define "app.traefik.path" -}}
{{ if .Values.routing.path }} && PathPrefix(`{{ .Values.routing.path }}`){{ end }}
{{- end -}}

{{- define "app.routing.type" -}}
{{ if .Values.global.routing.type }}{{ .Values.global.routing.type }}{{ else }}{{ .Values.routing.type }}{{ end }}
{{- end -}}
Expand Down
6 changes: 3 additions & 3 deletions templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -97,11 +97,11 @@ spec:
{{- if .Values.envCustom }}
{{- .Values.envCustom | toYaml | trim | nindent 10 }}
{{- end }}

{{- if or (.Values.global.inject_maps) (.Values.inject_maps) }}

envFrom:
- configMapRef:
name: {{ template "app.fullname" $ }}-env
{{- if or (.Values.global.inject_maps) (.Values.inject_maps) }}
{{- $im := .Values.global.inject_maps -}}
{{- if (.Values.inject_maps) }}
{{- $im = concat .Values.inject_maps .Values.global.inject_maps | uniq -}}
Expand All @@ -112,4 +112,4 @@ spec:
name: {{ $map_name }}
{{- end }}
{{- end }}
{{- end }}
{{- end }}
2 changes: 1 addition & 1 deletion templates/ingress-traefik.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ spec:
{{ end }}
routes:
- kind: Rule
match: Host(`{{ include "app.ingress.host" . | trim }}`){{ include "app.traefik.path" $ }}
match: Host(`{{ include "app.ingress.host" . | trim }}`){{ if .Values.routing.path }} && PathPrefix(`{{ .Values.routing.path }}`){{ end }}
{{ if .Values.routing.traefik.middleware.enabled }}
middlewares:
- name: {{ .Values.routing.traefik.middleware.name }}
Expand Down
14 changes: 14 additions & 0 deletions templates/secret-env.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{{- if .Values.env_secrets }}
apiVersion: v1
kind: Secret
metadata:
name: {{ include "app.fullname" . }}-env
labels:
app: {{ include "app.fullname" . }}
{{ include "app.labels.common" $ | indent 4 }}
stringData:
{{- range $key,$val := .Values.env_secrets }}
{{ $key }}: {{ tpl ($val|toString) $ | quote }}
{{- end }}
type: Opaque
{{- end }}

0 comments on commit 40b6889

Please sign in to comment.