Skip to content

Commit

Permalink
feat(pontoon): support more customization to jobs
Browse files Browse the repository at this point in the history
- initContainers
- volumes & volumeMounts
- command
- args
  • Loading branch information
michaellzc committed Jun 17, 2021
1 parent 92c61b0 commit 4e8456a
Show file tree
Hide file tree
Showing 5 changed files with 58 additions and 4 deletions.
7 changes: 5 additions & 2 deletions charts/pontoon/Chart.lock
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,8 @@ dependencies:
- name: rabbitmq
repository: https://charts.bitnami.com/bitnami
version: 8.6.0
digest: sha256:acbca669c00cbf636183b351ee7606b260c0f831b7fe4a4a53064f11f62f6795
generated: "2020-12-19T15:28:59.246349-07:00"
- name: common
repository: https://charts.bitnami.com/bitnami
version: 1.6.1
digest: sha256:565db712947d277c4e162a6ee6aa7644056a85ba19b6de25f871c738213c3422
generated: "2021-06-17T15:50:56.824871-06:00"
5 changes: 4 additions & 1 deletion charts/pontoon/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
apiVersion: v2
name: pontoon
home: https://github.com/mozilla/pontoon
version: 1.4.0
version: 1.5.0
# Pontoon no longer cuts releases.
# See https://github.com/mozilla/pontoon/releases/tag/2018-12-19
# and https://hub.docker.com/r/skillsnetwork/pontoon/tags
Expand All @@ -25,3 +25,6 @@ dependencies:
version: 8.6.0
repository: https://charts.bitnami.com/bitnami
condition: rabbitmq.enabled
- name: common
version: 1.x.x
repository: https://charts.bitnami.com/bitnami
17 changes: 17 additions & 0 deletions charts/pontoon/templates/pontoon-migration-job.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,26 @@ spec:
{{- end }}
serviceAccountName: {{ include "pontoon.serviceAccountName" . }}
restartPolicy: Never
{{- if .Values.migrationJob.initContainers }}
initContainers:
{{- if .Values.migrationJob.initContainers }}
{{- include "common.tplvalues.render" (dict "value" .Values.migrationJob.initContainers "context" $) | nindent 8 }}
{{- end }}
{{- end }}
containers:
- name: pontoon-migration
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
envFrom:
- secretRef:
name: "{{ include "pontoon.fullname" . }}-secrets"
{{- if or .Values.migrationJob.command .Values.migrationJob.args }}
command: {{- include "common.tplvalues.render" (dict "value" .Values.migrationJob.command "context" $) | nindent 10 }}
args: {{- include "common.tplvalues.render" (dict "value" .Values.migrationJob.args "context" $) | nindent 10 }}
{{- else }}
command: ["python"]
args: ["manage.py", "migrate"]
{{- end }}
env:
- name: SITE_URL
value: {{ .Values.siteUrl | quote }}
Expand All @@ -63,9 +74,15 @@ spec:
name: "pontoon-settings"
subPath: "custom.py"
{{- end }}
{{- if .Values.migrationJob.extraVolumeMounts }}
{{- include "common.tplvalues.render" (dict "value" .Values.migrationJob.extraVolumeMounts "context" $) | nindent 12 }}
{{- end }}
volumes:
{{- if .Values.extraSettingsModule }}
- name: "pontoon-settings"
configMap:
name: "{{ include "pontoon.fullname" . }}-settings-configmap"
{{- end }}
{{- if .Values.migrationJob.extraVolumes }}
{{- include "common.tplvalues.render" (dict "value" .Values.migrationJob.extraVolumes "context" $) | nindent 8 }}
{{- end }}
16 changes: 15 additions & 1 deletion charts/pontoon/templates/pontoon-sync-projects-cronjob.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ spec:
securityContext:
{{- toYaml .Values.syncProjectCronjob.podSecurityContext | nindent 12 }}
restartPolicy: OnFailure
{{- if or .Values.ssh.config .Values.ssh.privateKeys }}
{{- if or (or .Values.ssh.config .Values.ssh.privateKeys) .Values.syncProjectCronjob.initContainers }}
initContainers:
- name: copy-ssh-secrets
image: "busybox"
Expand All @@ -61,17 +61,25 @@ spec:
name: "dummy-volume"
- mountPath: "/ssh-data"
name: "pontoon-ssh"
{{- if .Values.syncProjectCronjob.initContainers }}
{{- include "common.tplvalues.render" (dict "value" .Values.syncProjectCronjob.initContainers "context" $) | nindent 12 }}
{{- end }}
{{- end }}
containers:
- name: sync-projects
securityContext:
{{- toYaml .Values.syncProjectCronjob.securityContext | nindent 16 }}
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
{{- if or .Values.syncProjectCronjob.command .Values.syncProjectCronjob.args}}
command: {{- include "common.tplvalues.render" (dict "value" .Values.syncProjectCronjob.command "context" $) | nindent 14 }}
args: {{- include "common.tplvalues.render" (dict "value" .Values.syncProjectCronjob.args "context" $) | nindent 14 }}
{{- else }}
command: ["python"]
args:
- "manage.py"
- "sync_projects"
{{- end }}
resources:
{{- toYaml .Values.syncProjectCronjob.resources | nindent 16 }}
envFrom:
Expand Down Expand Up @@ -100,6 +108,9 @@ spec:
- name: "dummy-volume"
mountPath: {{ .Values.ssh.mountPath | quote }}
{{- end }}
{{- if .Values.syncProjectCronjob.extraVolumeMounts }}
{{- include "common.tplvalues.render" (dict "value" .Values.syncProjectCronjob.extraVolumeMounts "context" $) | nindent 16 }}
{{- end }}
volumes:
{{- if .Values.extraSettingsModule }}
- name: "pontoon-settings"
Expand All @@ -114,6 +125,9 @@ spec:
- name: "dummy-volume"
emptyDir: {}
{{- end }}
{{- if .Values.syncProjectCronjob.extraVolumes }}
{{- include "common.tplvalues.render" (dict "value" .Values.syncProjectCronjob.extraVolumes "context" $) | nindent 12 }}
{{- end }}
{{- with .Values.syncProjectCronjob.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 12 }}
Expand Down
17 changes: 17 additions & 0 deletions charts/pontoon/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,23 @@ syncProjectCronjob:
affinity: {}
podSecurityContext: {}
securityContext: {}
extraVolumeMounts: []
extraVolumes: []
# Add init containers to pod
initContainers: {}
## Command and args for running the container
command: []
args: []

# Migration job to perform database migration
migrationJob:
extraVolumeMounts: []
extraVolumes: []
# Add init containers to pod
initContainers: { }
## Command and args for running the container
command: []
args: []

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

0 comments on commit 4e8456a

Please sign in to comment.