Skip to content

Commit

Permalink
Merge pull request #117 from codecademy-engineering/lindsay-jobs-envs
Browse files Browse the repository at this point in the history
add env options to jobs
  • Loading branch information
lindsaylandry authored Mar 21, 2024
2 parents 45a3c6d + def4023 commit 251cd8b
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 2 deletions.
2 changes: 1 addition & 1 deletion charts/service/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ apiVersion: v2
name: service
description: A generic k8s service chart
type: application
version: 1.8.14
version: 1.8.15
maintainers:
- email: [email protected]
name: devops
2 changes: 1 addition & 1 deletion charts/service/ci/custom-values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ jobs:
image: alpine
tag: '3.16'
command: ['echo', 'FOOBAR']
useParentEnv: false
useParentEnv: true
resources:
requests:
cpu: 10m
Expand Down
16 changes: 16 additions & 0 deletions charts/service/templates/jobs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
{{- $imagePullPolicy := .Values.image.pullPolicy -}}
{{- $datadog := .Values.datadog -}}
{{- $securityContext := .Values.securityContext -}}
{{- $parentEnvKeyValue := .Values.envKeyValue -}}
{{- $parentEnv := .Values.env -}}
{{- range .Values.jobs }}
---
apiVersion: batch/v1
Expand Down Expand Up @@ -31,6 +33,15 @@ spec:
command:
{{- toYaml .command | nindent 12 }}
env:
{{- if .useParentEnv }}
{{- range $key, $value := $parentEnvKeyValue }}
- name: {{ $key }}
value: "{{ $value }}"
{{- end }}
{{- with $parentEnv }}
{{- toYaml . | nindent 12 }}
{{- end }}
{{- end }}
{{- with .env }}
{{- toYaml . | nindent 12 }}
{{- end }}
Expand All @@ -54,6 +65,11 @@ spec:
fieldPath: metadata.labels['tags.datadoghq.com/version']
{{- end }}
{{- end }}
{{- if .envFromSecret }}
envFrom:
- secretRef:
name: {{ .envFromSecret }}
{{- end }}
resources:
{{- toYaml .resources | nindent 12 }}
securityContext:
Expand Down

0 comments on commit 251cd8b

Please sign in to comment.