Skip to content

Commit 4e8456a

Browse files
committed
feat(pontoon): support more customization to jobs
- initContainers - volumes & volumeMounts - command - args
1 parent 92c61b0 commit 4e8456a

File tree

5 files changed

+58
-4
lines changed

5 files changed

+58
-4
lines changed

charts/pontoon/Chart.lock

+5-2
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,8 @@ dependencies:
55
- name: rabbitmq
66
repository: https://charts.bitnami.com/bitnami
77
version: 8.6.0
8-
digest: sha256:acbca669c00cbf636183b351ee7606b260c0f831b7fe4a4a53064f11f62f6795
9-
generated: "2020-12-19T15:28:59.246349-07:00"
8+
- name: common
9+
repository: https://charts.bitnami.com/bitnami
10+
version: 1.6.1
11+
digest: sha256:565db712947d277c4e162a6ee6aa7644056a85ba19b6de25f871c738213c3422
12+
generated: "2021-06-17T15:50:56.824871-06:00"

charts/pontoon/Chart.yaml

+4-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
apiVersion: v2
22
name: pontoon
33
home: https://github.com/mozilla/pontoon
4-
version: 1.4.0
4+
version: 1.5.0
55
# Pontoon no longer cuts releases.
66
# See https://github.com/mozilla/pontoon/releases/tag/2018-12-19
77
# and https://hub.docker.com/r/skillsnetwork/pontoon/tags
@@ -25,3 +25,6 @@ dependencies:
2525
version: 8.6.0
2626
repository: https://charts.bitnami.com/bitnami
2727
condition: rabbitmq.enabled
28+
- name: common
29+
version: 1.x.x
30+
repository: https://charts.bitnami.com/bitnami

charts/pontoon/templates/pontoon-migration-job.yaml

+17
Original file line numberDiff line numberDiff line change
@@ -35,15 +35,26 @@ spec:
3535
{{- end }}
3636
serviceAccountName: {{ include "pontoon.serviceAccountName" . }}
3737
restartPolicy: Never
38+
{{- if .Values.migrationJob.initContainers }}
39+
initContainers:
40+
{{- if .Values.migrationJob.initContainers }}
41+
{{- include "common.tplvalues.render" (dict "value" .Values.migrationJob.initContainers "context" $) | nindent 8 }}
42+
{{- end }}
43+
{{- end }}
3844
containers:
3945
- name: pontoon-migration
4046
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
4147
imagePullPolicy: {{ .Values.image.pullPolicy }}
4248
envFrom:
4349
- secretRef:
4450
name: "{{ include "pontoon.fullname" . }}-secrets"
51+
{{- if or .Values.migrationJob.command .Values.migrationJob.args }}
52+
command: {{- include "common.tplvalues.render" (dict "value" .Values.migrationJob.command "context" $) | nindent 10 }}
53+
args: {{- include "common.tplvalues.render" (dict "value" .Values.migrationJob.args "context" $) | nindent 10 }}
54+
{{- else }}
4555
command: ["python"]
4656
args: ["manage.py", "migrate"]
57+
{{- end }}
4758
env:
4859
- name: SITE_URL
4960
value: {{ .Values.siteUrl | quote }}
@@ -63,9 +74,15 @@ spec:
6374
name: "pontoon-settings"
6475
subPath: "custom.py"
6576
{{- end }}
77+
{{- if .Values.migrationJob.extraVolumeMounts }}
78+
{{- include "common.tplvalues.render" (dict "value" .Values.migrationJob.extraVolumeMounts "context" $) | nindent 12 }}
79+
{{- end }}
6680
volumes:
6781
{{- if .Values.extraSettingsModule }}
6882
- name: "pontoon-settings"
6983
configMap:
7084
name: "{{ include "pontoon.fullname" . }}-settings-configmap"
7185
{{- end }}
86+
{{- if .Values.migrationJob.extraVolumes }}
87+
{{- include "common.tplvalues.render" (dict "value" .Values.migrationJob.extraVolumes "context" $) | nindent 8 }}
88+
{{- end }}

charts/pontoon/templates/pontoon-sync-projects-cronjob.yaml

+15-1
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ spec:
4747
securityContext:
4848
{{- toYaml .Values.syncProjectCronjob.podSecurityContext | nindent 12 }}
4949
restartPolicy: OnFailure
50-
{{- if or .Values.ssh.config .Values.ssh.privateKeys }}
50+
{{- if or (or .Values.ssh.config .Values.ssh.privateKeys) .Values.syncProjectCronjob.initContainers }}
5151
initContainers:
5252
- name: copy-ssh-secrets
5353
image: "busybox"
@@ -61,17 +61,25 @@ spec:
6161
name: "dummy-volume"
6262
- mountPath: "/ssh-data"
6363
name: "pontoon-ssh"
64+
{{- if .Values.syncProjectCronjob.initContainers }}
65+
{{- include "common.tplvalues.render" (dict "value" .Values.syncProjectCronjob.initContainers "context" $) | nindent 12 }}
66+
{{- end }}
6467
{{- end }}
6568
containers:
6669
- name: sync-projects
6770
securityContext:
6871
{{- toYaml .Values.syncProjectCronjob.securityContext | nindent 16 }}
6972
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
7073
imagePullPolicy: {{ .Values.image.pullPolicy }}
74+
{{- if or .Values.syncProjectCronjob.command .Values.syncProjectCronjob.args}}
75+
command: {{- include "common.tplvalues.render" (dict "value" .Values.syncProjectCronjob.command "context" $) | nindent 14 }}
76+
args: {{- include "common.tplvalues.render" (dict "value" .Values.syncProjectCronjob.args "context" $) | nindent 14 }}
77+
{{- else }}
7178
command: ["python"]
7279
args:
7380
- "manage.py"
7481
- "sync_projects"
82+
{{- end }}
7583
resources:
7684
{{- toYaml .Values.syncProjectCronjob.resources | nindent 16 }}
7785
envFrom:
@@ -100,6 +108,9 @@ spec:
100108
- name: "dummy-volume"
101109
mountPath: {{ .Values.ssh.mountPath | quote }}
102110
{{- end }}
111+
{{- if .Values.syncProjectCronjob.extraVolumeMounts }}
112+
{{- include "common.tplvalues.render" (dict "value" .Values.syncProjectCronjob.extraVolumeMounts "context" $) | nindent 16 }}
113+
{{- end }}
103114
volumes:
104115
{{- if .Values.extraSettingsModule }}
105116
- name: "pontoon-settings"
@@ -114,6 +125,9 @@ spec:
114125
- name: "dummy-volume"
115126
emptyDir: {}
116127
{{- end }}
128+
{{- if .Values.syncProjectCronjob.extraVolumes }}
129+
{{- include "common.tplvalues.render" (dict "value" .Values.syncProjectCronjob.extraVolumes "context" $) | nindent 12 }}
130+
{{- end }}
117131
{{- with .Values.syncProjectCronjob.nodeSelector }}
118132
nodeSelector:
119133
{{- toYaml . | nindent 12 }}

charts/pontoon/values.yaml

+17
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,23 @@ syncProjectCronjob:
9595
affinity: {}
9696
podSecurityContext: {}
9797
securityContext: {}
98+
extraVolumeMounts: []
99+
extraVolumes: []
100+
# Add init containers to pod
101+
initContainers: {}
102+
## Command and args for running the container
103+
command: []
104+
args: []
105+
106+
# Migration job to perform database migration
107+
migrationJob:
108+
extraVolumeMounts: []
109+
extraVolumes: []
110+
# Add init containers to pod
111+
initContainers: { }
112+
## Command and args for running the container
113+
command: []
114+
args: []
98115

99116
# Configuration values for the postgres dependency
100117
# ref: https://github.com/bitnami/charts/blob/master/bitnami/postgresql/README.md

0 commit comments

Comments
 (0)