From 6be55448c13e2d742c38321b0c6308573ba94c65 Mon Sep 17 00:00:00 2001 From: Lindsay Landry Date: Tue, 30 Jan 2024 15:44:15 -0600 Subject: [PATCH 1/3] add ability to set custom image/tag for crons --- charts/service/Chart.yaml | 2 +- charts/service/ci/custom-values.yaml | 14 ++++++++++++++ charts/service/templates/cronjob.yaml | 2 +- 3 files changed, 16 insertions(+), 2 deletions(-) diff --git a/charts/service/Chart.yaml b/charts/service/Chart.yaml index b8234a0..0f2c6fa 100644 --- a/charts/service/Chart.yaml +++ b/charts/service/Chart.yaml @@ -2,7 +2,7 @@ apiVersion: v2 name: service description: A generic k8s service chart type: application -version: 1.8.9 +version: 1.8.10 maintainers: - email: devops@codecademy.com name: devops diff --git a/charts/service/ci/custom-values.yaml b/charts/service/ci/custom-values.yaml index 38fe81f..6434ea6 100644 --- a/charts/service/ci/custom-values.yaml +++ b/charts/service/ci/custom-values.yaml @@ -88,6 +88,20 @@ cronJobs: cpu: 10m memory: 50Mi schedule: "* * * * *" + - name: bar + image: + repository: alpine + tag: "3.16" + command: ["echo", "FOOBAR"] + useParentEnv: false + resources: + requests: + cpu: 10m + memory: 50Mi + limits: + cpu: 10m + memory: 50Mi + schedule: "* * * * *" hostAliases: - ip: 0.0.0.0 diff --git a/charts/service/templates/cronjob.yaml b/charts/service/templates/cronjob.yaml index 82bc993..ff6f412 100644 --- a/charts/service/templates/cronjob.yaml +++ b/charts/service/templates/cronjob.yaml @@ -29,7 +29,7 @@ spec: spec: serviceAccountName: {{ $serviceAccountName }} containers: - - image: "{{ $image }}:{{ $tag }}" + - image: "{{ .image.repository | $image }}:{{ .image.tag | $tag }}" imagePullPolicy: {{ $imagePullPolicy }} name: {{ .name }} env: From 261614d47d896707bdf516128f016a7cff6f3daa Mon Sep 17 00:00:00 2001 From: Lindsay Landry Date: Tue, 30 Jan 2024 16:15:30 -0600 Subject: [PATCH 2/3] fix cron --- charts/service/templates/cronjob.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/charts/service/templates/cronjob.yaml b/charts/service/templates/cronjob.yaml index ff6f412..9d44824 100644 --- a/charts/service/templates/cronjob.yaml +++ b/charts/service/templates/cronjob.yaml @@ -29,7 +29,7 @@ spec: spec: serviceAccountName: {{ $serviceAccountName }} containers: - - image: "{{ .image.repository | $image }}:{{ .image.tag | $tag }}" + - image: "{{ .image.repository | default $image }}:{{ .image.tag | default $tag }}" imagePullPolicy: {{ $imagePullPolicy }} name: {{ .name }} env: From 6d4acf5165e02f39c63b38010fadaa29237ce59c Mon Sep 17 00:00:00 2001 From: Lindsay Landry Date: Wed, 31 Jan 2024 10:34:57 -0600 Subject: [PATCH 3/3] fixing cronjob --- charts/service/ci/custom-values.yaml | 5 ++--- charts/service/templates/cronjob.yaml | 2 +- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/charts/service/ci/custom-values.yaml b/charts/service/ci/custom-values.yaml index 6434ea6..ad2806e 100644 --- a/charts/service/ci/custom-values.yaml +++ b/charts/service/ci/custom-values.yaml @@ -89,9 +89,8 @@ cronJobs: memory: 50Mi schedule: "* * * * *" - name: bar - image: - repository: alpine - tag: "3.16" + image: alpine + tag: "3.16" command: ["echo", "FOOBAR"] useParentEnv: false resources: diff --git a/charts/service/templates/cronjob.yaml b/charts/service/templates/cronjob.yaml index 9d44824..b515b13 100644 --- a/charts/service/templates/cronjob.yaml +++ b/charts/service/templates/cronjob.yaml @@ -29,7 +29,7 @@ spec: spec: serviceAccountName: {{ $serviceAccountName }} containers: - - image: "{{ .image.repository | default $image }}:{{ .image.tag | default $tag }}" + - image: "{{ .image | default $image }}:{{ .tag | default $tag }}" imagePullPolicy: {{ $imagePullPolicy }} name: {{ .name }} env: