k8s(minor): load secrets as env vars

This commit is contained in:
Langhammer, Jens 2019-10-01 15:42:14 +02:00
parent 6b0f0e8993
commit b8656858ec
4 changed files with 61 additions and 1 deletions

View File

@ -32,6 +32,21 @@ spec:
- ./manage.py
args:
- app_gw_web
envFrom:
- configMapRef:
name: {{ include "p2.fullname" . }}-config
prefix: PASSBOOK_
env:
- name: P2_REDIS__PASSWORD
valueFrom:
secretKeyRef:
name: "{{ .Release.Name }}-redis"
key: redis-password
- name: P2_POSTGRESQL__PASSWORD
valueFrom:
secretKeyRef:
name: "{{ .Release.Name }}-postgresql"
key: postgresql-password
ports:
- name: http
containerPort: 8000

View File

@ -31,6 +31,21 @@ spec:
- ./manage.py
args:
- migrate
envFrom:
- configMapRef:
name: {{ include "p2.fullname" . }}-config
prefix: PASSBOOK_
env:
- name: P2_REDIS__PASSWORD
valueFrom:
secretKeyRef:
name: "{{ .Release.Name }}-redis"
key: redis-password
- name: P2_POSTGRESQL__PASSWORD
valueFrom:
secretKeyRef:
name: "{{ .Release.Name }}-postgresql"
key: postgresql-password
volumeMounts:
- mountPath: /etc/passbook
name: config-volume
@ -42,6 +57,21 @@ spec:
- ./manage.py
args:
- web
envFrom:
- configMapRef:
name: {{ include "p2.fullname" . }}-config
prefix: PASSBOOK_
env:
- name: P2_REDIS__PASSWORD
valueFrom:
secretKeyRef:
name: "{{ .Release.Name }}-redis"
key: redis-password
- name: P2_POSTGRESQL__PASSWORD
valueFrom:
secretKeyRef:
name: "{{ .Release.Name }}-postgresql"
key: postgresql-password
ports:
- name: http
containerPort: 8000

View File

@ -32,6 +32,21 @@ spec:
- ./manage.py
args:
- worker
envFrom:
- configMapRef:
name: {{ include "p2.fullname" . }}-config
prefix: PASSBOOK_
env:
- name: P2_REDIS__PASSWORD
valueFrom:
secretKeyRef:
name: "{{ .Release.Name }}-redis"
key: redis-password
- name: P2_POSTGRESQL__PASSWORD
valueFrom:
secretKeyRef:
name: "{{ .Release.Name }}-postgresql"
key: postgresql-password
ports:
- name: http
containerPort: 8000

View File

@ -12,6 +12,6 @@ import os
from django.core.wsgi import get_wsgi_application
from sentry_sdk.integrations.wsgi import SentryWsgiMiddleware
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'passbook.settings')
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'passbook.root.settings')
application = SentryWsgiMiddleware(get_wsgi_application())