Skip to content

Commit 6c01ad4

Browse files
Merge pull request #203 from EcovadisCode/feat/cron-job-annotations
feat(cron-job): add annotations support to CronJob and pod template
2 parents a4a6f81 + fbe7f4b commit 6c01ad4

3 files changed

Lines changed: 32 additions & 2 deletions

File tree

charts/cron-job/Chart.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ apiVersion: v2
22
description: EcoVadis Helm chart for K8s Cron Job
33
name: charts-cron-job
44
type: application
5-
version: 2.9.1
5+
version: 2.10.0
66
dependencies:
77
- name: charts-core
88
version: 2.4.2

charts/cron-job/templates/cronjob.yaml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,13 +36,23 @@
3636
{{- $nodeSelector := $cronjob.nodeSelector | default $global.nodeSelector }}
3737
{{- $affinity := $cronjob.affinity | default $global.affinity }}
3838
{{- $tolerations := $cronjob.tolerations | default $global.tolerations }}
39+
40+
{{- /* Annotations configuration */ -}}
41+
{{- $annotationsEnabled := $cronjob.annotationsEnabled | default $global.annotationsEnabled }}
42+
{{- $annotations := $cronjob.annotations | default $global.annotations }}
43+
{{- $podAnnotationsEnabled := $cronjob.podAnnotationsEnabled | default $global.podAnnotationsEnabled }}
44+
{{- $podAnnotations := $cronjob.podAnnotations | default $global.podAnnotations }}
3945
---
4046
apiVersion: batch/v1
4147
kind: CronJob
4248
metadata:
4349
name: {{ include "charts-cron-job.fullname" (dict "root" $ "cronjob" $cronjob "index" $index) }}
4450
labels:
4551
{{- include "charts-cron-job.labels" (dict "root" $ "cronjob" $cronjob) | nindent 4 }}
52+
{{- if $annotationsEnabled }}
53+
annotations:
54+
{{- toYaml $annotations | nindent 4 }}
55+
{{- end }}
4656
spec:
4757
schedule: "{{ $schedule }}"
4858
concurrencyPolicy: "{{ $concurrencyPolicy }}"
@@ -61,6 +71,10 @@ spec:
6171
metadata:
6272
labels:
6373
{{- include "charts-cron-job.labels" (dict "root" $ "cronjob" $cronjob) | nindent 12 }}
74+
{{- if $podAnnotationsEnabled }}
75+
annotations:
76+
{{- toYaml $podAnnotations | nindent 12 }}
77+
{{- end }}
6478
spec:
6579
{{- if $imagePullSecret }}
6680
imagePullSecrets:

charts/cron-job/values.yaml

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
# Define cronjobs array when you need multiple jobs with different configurations.
77
#cronjobs:
88
# - schedule: ""
9-
# nameOverride:
9+
# nameOverride:
1010
# fullnameOverride:
1111
# image:
1212
# name: # app name
@@ -17,6 +17,12 @@
1717
# additionalLabelsEnabled: true
1818
# additionalLabels:
1919
# team: #{team}#
20+
# annotationsEnabled: true
21+
# annotations:
22+
# example.com/annotation: value
23+
# podAnnotationsEnabled: true
24+
# podAnnotations:
25+
# example.com/pod-annotation: value
2026

2127
global:
2228
schedule: ""
@@ -62,6 +68,16 @@ global:
6268
additionalLabelsEnabled: false
6369
additionalLabels: {}
6470

71+
# Annotations added to the CronJob resource metadata
72+
annotationsEnabled: false
73+
annotations: {}
74+
#example.com/annotation: value
75+
76+
# Annotations added to the pod template metadata
77+
podAnnotationsEnabled: false
78+
podAnnotations: {}
79+
#example.com/pod-annotation: value
80+
6581
securityContext:
6682
allowPrivilegeEscalation: false
6783
capabilities:

0 commit comments

Comments
 (0)