Skip to content

Commit

Permalink
Merge pull request #89 from dasmeta/DMVP-cronjob-configmap
Browse files Browse the repository at this point in the history
fix(DMVP-cronjob-configmap): Add configmap and label support
  • Loading branch information
aghamyan44 authored Jan 12, 2024
2 parents 2d2c00c + 19b4a12 commit 1f3a3e1
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 2 deletions.
4 changes: 2 additions & 2 deletions charts/base-cronjob/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@ type: application
# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/)
version: 0.1.10
version: 0.1.11


# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application. Versions are not expected to
# follow Semantic Versioning. They should reflect the version the application is using.
# It is recommended to use it with quotes.

appVersion: "0.1.10"
appVersion: "0.1.11"
9 changes: 9 additions & 0 deletions charts/base-cronjob/templates/configmap.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{{- range $job := .Values.jobs }}
---
kind: ConfigMap
apiVersion: v1
metadata:
name: {{ $job.name | quote}}
data:
{{- toYaml $job.config | nindent 2 }}
{{- end }}
12 changes: 12 additions & 0 deletions charts/base-cronjob/templates/cronjob.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,20 @@ apiVersion: batch/v1
kind: CronJob
metadata:
name: {{ $job.name | quote}}
{{- if $job.labels }}
labels:
{{- range $key, $value := $job.labels }}
{{ $value.name }}: {{ $value.value | quote}}
{{- end }}
{{- end }}
spec:
schedule: {{ $job.schedule | quote}}
jobTemplate:
spec:
template:
metadata:
annotations:
configmap: "{{ $job.config | toYaml | sha256sum | trunc 8 }}"
spec:
serviceAccountName: {{ $job.serviceAccount.name }}
restartPolicy: {{ $job.restartPolicy }}
Expand Down Expand Up @@ -45,6 +54,9 @@ spec:
- name: {{ $env.name | quote}}
value: {{ $env.value | quote }}
{{- end }}
envFrom:
- configMapRef:
name: {{ $job.name | quote}}
volumeMounts:
{{- range $index, $element := $job.volumes }}
- name: {{ coalesce $element.name (add $index 1) }}
Expand Down

0 comments on commit 1f3a3e1

Please sign in to comment.