Skip to content

Commit

Permalink
Merge pull request #115 from maykinmedia/feature/configuration-tweaks
Browse files Browse the repository at this point in the history
Tweak setup_configuration
  • Loading branch information
sjoerdie authored Jul 3, 2024
2 parents 51c6860 + 14b954e commit 404bf8e
Show file tree
Hide file tree
Showing 12 changed files with 209 additions and 202 deletions.
2 changes: 1 addition & 1 deletion charts/opennotificaties/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: opennotificaties
description: API voor het routeren van notificaties

type: application
version: 1.3.2
version: 1.3.3
appVersion: 1.5.2

dependencies:
Expand Down
1 change: 1 addition & 0 deletions charts/opennotificaties/templates/configmap.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ data:
UWSGI_HARAKIRI: {{ .Values.settings.uwsgi.harakiri | toString | quote }}
{{- end }}
{{ if and .Values.global.configuration.enabled .Values.configuration.enabled -}}
DEMO_CONFIG_ENABLE: "False"
SITES_CONFIG_ENABLE: {{ .Values.configuration.sites.enabled | toString | quote }}
OPENNOTIFICATIES_DOMAIN: {{ .Values.global.configuration.notificatiesDomain | default .Values.configuration.sites.notificatiesDomain | toString | quote }}
OPENNOTIFICATIES_ORGANIZATION: {{ .Values.global.configuration.organization | default .Values.configuration.sites.organization | toString | quote }}
Expand Down
87 changes: 0 additions & 87 deletions charts/opennotificaties/templates/cronjob-config.yaml

This file was deleted.

9 changes: 8 additions & 1 deletion charts/opennotificaties/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,14 @@ spec:
{{- include "opennotificaties.tplvalues.render" (dict "value" .Values.extraEnvVars "context" $) | nindent 16 }}
{{- end }}
command:
- /setup_configuration.sh
- /usr/local/bin/python
args:
- /app/src/manage.py
- setup_configuration
- --no-selftest
{{- if or .Values.global.configuration.overwrite .Values.configuration.overwrite }}
- --overwrite
{{- end }}
{{- end }}
containers:
- name: {{ .Chart.Name }}
Expand Down
88 changes: 88 additions & 0 deletions charts/opennotificaties/templates/job-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
{{ if and .Values.global.configuration.enabled .Values.configuration.enabled .Values.configuration.job.enabled -}}
apiVersion: batch/v1
kind: Job
metadata:
name: {{ include "opennotificaties.configName" . }}
labels:
{{- include "opennotificaties.configLabels" . | nindent 4 }}
spec:
backoffLimit: {{ .Values.configuration.job.backoffLimit }}
template:
metadata:
annotations:
{{- with .Values.podAnnotations }}
{{- toYaml . | nindent 8 }}
{{- end }}
labels:
{{- include "opennotificaties.configLabels" . | nindent 8 }}
{{- with .Values.podAnnotations }}
{{- toYaml . | nindent 8 }}
{{- end }}
spec:
{{- with .Values.imagePullSecrets }}
imagePullSecrets:
{{- toYaml . | nindent 8 }}
{{- end }}
serviceAccountName: {{ include "opennotificaties.serviceAccountName" . }}
securityContext:
{{- toYaml .Values.podSecurityContext | nindent 8 }}
restartPolicy: {{ .Values.configuration.job.restartPolicy }}
containers:
- name: {{ .Chart.Name }}
securityContext:
{{- toYaml .Values.securityContext | nindent 12 }}
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
envFrom:
- secretRef:
name: {{ .Values.existingSecret | default (include "opennotificaties.fullname" .) }}
- configMapRef:
name: {{ include "opennotificaties.fullname" . }}
env:
{{- if .Values.extraEnvVars }}
{{- include "opennotificaties.tplvalues.render" (dict "value" .Values.extraEnvVars "context" $) | nindent 12 }}
{{- end }}
resources:
{{- toYaml .Values.configuration.cronjob.resources | nindent 12 }}
command:
- "/bin/bash"
- "-c"
args:
- |
/wait_for_db.sh
/app/src/manage.py migrate
/app/src/manage.py setup_configuration --no-selftest {{- if or .Values.global.configuration.overwrite .Values.configuration.overwrite }} --overwrite{{- end }}
volumeMounts:
- name: media
mountPath: /app/private-media
subPath: {{ .Values.persistence.privateMediaMountSubpath | default "opennotificaties/private_media" }}
- name: media
mountPath: /app/media
subPath: {{ .Values.persistence.mediaMountSubpath | default "opennotificaties/media" }}
{{- if .Values.extraVolumeMounts }}
{{- include "opennotificaties.tplvalues.render" ( dict "value" .Values.extraVolumeMounts "context" $ ) | nindent 16 }}
{{- end }}
volumes:
- name: media
persistentVolumeClaim:
{{- if .Values.persistence.enabled }}
claimName: {{ if .Values.persistence.existingClaim }}{{ .Values.persistence.existingClaim }}{{- else }}{{ include "opennotificaties.fullname" . }}{{- end }}
{{- else }}
emptyDir: { }
{{- end }}
{{- if .Values.extraVolumes }}
{{- include "opennotificaties.tplvalues.render" ( dict "value" .Values.extraVolumes "context" $ ) | nindent 12 }}
{{- end }}
{{- with .Values.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.affinity }}
affinity:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.tolerations }}
tolerations:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- end }}
15 changes: 6 additions & 9 deletions charts/opennotificaties/values.yaml
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
global:
configuration:
enabled: true
overwrite: true
organization: Gemeente Example
openzaakDomain: openzaak.example.com
openzaakAutorisatiesApi: https://openzaak.example.nl/autorisaties/api/v1/
notificatiesDomain: notificaties.example.nl
notificatiesApi: http://opennotificaties.example.nl/api/v1/
notificatiesOpenzaakClientId: notif-client-id
notificatiesOpenzaakSecret: notif-secret
Expand All @@ -13,6 +12,7 @@ global:

configuration:
enabled: true
overwrite: true
sites:
enabled: true
notificatiesDomain: ""
Expand All @@ -33,14 +33,11 @@ configuration:
initContainer:
# -- Run the setup configuration command in a init container
enabled: false
cronjob:
# -- Run the setup configuration command as a cronjob
job:
# -- Run the setup configuration command as a job
enabled: true
# -- Schedule to run the configuration command
schedule: "0 0 * * *"
historyLimit: 1
resources: {}

backoffLimit: 6
restartPolicy: OnFailure
tags:
redis: true
rabbitmq: true
Expand Down
2 changes: 1 addition & 1 deletion charts/openzaak/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: openzaak
description: Productiewaardige API's voor Zaakgericht Werken

type: application
version: 1.3.2
version: 1.3.3
appVersion: 1.12.1

dependencies:
Expand Down
1 change: 1 addition & 0 deletions charts/openzaak/templates/configmap.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ data:
NOTIFICATIONS_DISABLED: "True"
{{- end }}
{{ if and .Values.global.configuration.enabled .Values.configuration.enabled -}}
DEMO_CONFIG_ENABLE: "False"
SITES_CONFIG_ENABLE: {{ if .Values.configuration.sites.enabled }}"True"{{ else }}"False"{{ end }}
{{- if .Values.configuration.sites.enabled }}
OPENZAAK_DOMAIN: {{ .Values.global.configuration.openzaakDomain | default .Values.configuration.sites.openzaakDomain | toString | quote }}
Expand Down
94 changes: 0 additions & 94 deletions charts/openzaak/templates/cronjob-config.yaml

This file was deleted.

7 changes: 6 additions & 1 deletion charts/openzaak/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,12 @@ spec:
{{- include "openzaak.tplvalues.render" (dict "value" .Values.extraEnvVars "context" $) | nindent 16 }}
{{- end }}
command:
- /setup_configuration.sh
- "/bin/bash"
- "-c"
args:
/wait_for_db.sh
/app/src/manage.py migrate
/app/src/manage.py setup_configuration --no-selftest {{- if or .Values.global.configuration.overwrite .Values.configuration.overwrite }} --overwrite{{- end }}
volumeMounts:
- name: media
mountPath: /app/private-media
Expand Down
Loading

0 comments on commit 404bf8e

Please sign in to comment.