From 885f8bae9fd4fab4f37fe49519e76c1eaf8643c0 Mon Sep 17 00:00:00 2001 From: Jens Langhammer Date: Tue, 25 Aug 2020 17:43:37 +0200 Subject: [PATCH] helm: remove mount of configmap, read entirely from env --- helm/templates/configmap.yaml | 35 +++++++++++---------------- helm/templates/web-deployment.yaml | 18 +++----------- helm/templates/worker-deployment.yaml | 17 ++++--------- 3 files changed, 23 insertions(+), 47 deletions(-) diff --git a/helm/templates/configmap.yaml b/helm/templates/configmap.yaml index edae93bed..9de2e3ad2 100644 --- a/helm/templates/configmap.yaml +++ b/helm/templates/configmap.yaml @@ -3,24 +3,17 @@ kind: ConfigMap metadata: name: {{ include "passbook.fullname" . }}-config data: - config.yml: | - postgresql: - host: "{{ .Release.Name }}-postgresql" - name: "{{ .Values.postgresql.postgresqlDatabase }}" - user: postgres - {{- if .Values.backup }} - backup: - access_key: "{{ .Values.backup.access_key }}" - secret_key: "{{ .Values.backup.secret_key }}" - bucket: "{{ .Values.backup.bucket }}" - host: "{{ .Values.backup.host }}" - {{- end}} - redis: - host: "{{ .Release.Name }}-redis-master" - cache_db: 0 - message_queue_db: 1 - error_reporting: - enabled: {{ .Values.config.error_reporting.enabled }} - environment: {{ .Values.config.error_reporting.environment }} - send_pii: {{ .Values.config.error_reporting.send_pii }} - log_level: "{{ .Values.config.log_level }}" + POSTGRESQL__HOST: "{{ .Release.Name }}-postgresql" + POSTGRESQL__NAME: "{{ .Values.postgresql.postgresqlDatabase }}" + POSTGRESQL__USER: "{{ .Values.postgresql.postgresqlUsername }}" + {{- if .Values.backup }} + POSTGRESQL__BACKUP__ACCESS_KEY: "{{ .Values.backup.access_key }}" + POSTGRESQL__BACKUP__SECRET_KEY: "{{ .Values.backup.secret_key }}" + POSTGRESQL__BACKUP__BUCKET: "{{ .Values.backup.bucket }}" + POSTGRESQL__BACKUP__HOST: "{{ .Values.backup.host }}" + {{- end}} + REDIS__HOST: "{{ .Release.Name }}-redis-master" + ERROR_REPORTING__ENABLED: "{{ .Values.config.error_reporting.enabled }}" + ERROR_REPORTING__ENVIRONMENT: "{{ .Values.config.error_reporting.environment }}" + ERROR_REPORTING__SEND_PII: "{{ .Values.config.error_reporting.send_pii }}" + LOG_LEVEL: "{{ .Values.config.log_level }}" diff --git a/helm/templates/web-deployment.yaml b/helm/templates/web-deployment.yaml index 9031b3713..a6be38efa 100644 --- a/helm/templates/web-deployment.yaml +++ b/helm/templates/web-deployment.yaml @@ -22,10 +22,6 @@ spec: app.kubernetes.io/instance: {{ .Release.Name }} k8s.passbook.io/component: web spec: - volumes: - - name: config-volume - configMap: - name: {{ include "passbook.fullname" . }}-config initContainers: - name: passbook-database-migrations image: "beryju/passbook:{{ .Values.image.tag }}" @@ -33,9 +29,6 @@ spec: args: - ./manage.py - migrate - volumeMounts: - - mountPath: /etc/passbook - name: config-volume envFrom: - configMapRef: name: {{ include "passbook.fullname" . }}-config @@ -63,9 +56,6 @@ spec: args: - uwsgi - uwsgi.ini - volumeMounts: - - mountPath: /etc/passbook - name: config-volume envFrom: - configMapRef: name: {{ include "passbook.fullname" . }}-config @@ -74,18 +64,18 @@ spec: - name: PASSBOOK_SECRET_KEY valueFrom: secretKeyRef: - name: {{ include "passbook.fullname" . }}-secret-key - key: secret_key + name: "{{ include "passbook.fullname" . }}-secret-key" + key: "secret_key" - name: PASSBOOK_REDIS__PASSWORD valueFrom: secretKeyRef: name: "{{ .Release.Name }}-redis" - key: redis-password + key: "redis-password" - name: PASSBOOK_POSTGRESQL__PASSWORD valueFrom: secretKeyRef: name: "{{ .Release.Name }}-postgresql" - key: postgresql-password + key: "postgresql-password" ports: - name: http containerPort: 8000 diff --git a/helm/templates/worker-deployment.yaml b/helm/templates/worker-deployment.yaml index f4bb5abc1..a3c8c1435 100644 --- a/helm/templates/worker-deployment.yaml +++ b/helm/templates/worker-deployment.yaml @@ -22,10 +22,6 @@ spec: app.kubernetes.io/instance: {{ .Release.Name }} k8s.passbook.io/component: worker spec: - volumes: - - name: config-volume - configMap: - name: {{ include "passbook.fullname" . }}-config containers: - name: {{ .Chart.Name }} image: "beryju/passbook:{{ .Values.image.tag }}" @@ -38,29 +34,26 @@ spec: - -B - -A=passbook.root.celery - -s=/tmp/celerybeat-schedule - volumeMounts: - - mountPath: /etc/passbook - name: config-volume envFrom: - configMapRef: - name: {{ include "passbook.fullname" . }}-config - prefix: PASSBOOK_ + name: "{{ include "passbook.fullname" . }}-config" + prefix: "PASSBOOK_" env: - name: PASSBOOK_SECRET_KEY valueFrom: secretKeyRef: - name: {{ include "passbook.fullname" . }}-secret-key + name: "{{ include "passbook.fullname" . }}-secret-key" key: secret_key - name: PASSBOOK_REDIS__PASSWORD valueFrom: secretKeyRef: name: "{{ .Release.Name }}-redis" - key: redis-password + key: "redis-password" - name: PASSBOOK_POSTGRESQL__PASSWORD valueFrom: secretKeyRef: name: "{{ .Release.Name }}-postgresql" - key: postgresql-password + key: "postgresql-password" resources: requests: cpu: 150m