Skip to content

Commit

Permalink
Ability to add env var to chart deployment
Browse files Browse the repository at this point in the history
  • Loading branch information
tcarmet committed Aug 3, 2022
1 parent 4438c6a commit 03c4181
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 0 deletions.
1 change: 1 addition & 0 deletions bert_e/server/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ def setup_server(bert_e):
app = Flask(__name__)

app.config.update({
'APPLICATION_ROOT': os.getenv('APPLICATION_ROOT', '/'),
'WEBHOOK_LOGIN': os.environ['WEBHOOK_LOGIN'],
'WEBHOOK_PWD': os.environ['WEBHOOK_LOGIN'],
'CLIENT_ID': os.environ['BERT_E_CLIENT_ID'],
Expand Down
5 changes: 5 additions & 0 deletions charts/bert-e/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ spec:
annotations:
checksum/settings: {{ include (print $.Template.BasePath "/settings.yaml") . | sha256sum }}
checksum/secret: {{ include (print $.Template.BasePath "/secrets.yaml") . | sha256sum }}
checksum/env: {{ include (print $.Template.BasePath "/env.yaml") . | sha256sum }}
spec:
{{- if .Values.image.pullSecrets }}
imagePullSecrets:
Expand All @@ -36,6 +37,10 @@ spec:
envFrom:
- secretRef:
name: {{ template "fullname" $ }}
{{- if .Values.deployment.env }}
- configMapRef:
name: {{ template "fullname" $ }}-env
{{- end }}
ports:
- name: http
containerPort: {{ .Values.deployment.servicePort }}
Expand Down
15 changes: 15 additions & 0 deletions charts/bert-e/templates/env.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{{- if .Values.deployment.env }}
---
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ template "fullname" $ }}-env
labels:
app: {{ template "fullname" $ }}
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
release: "{{ .Release.Name }}"
heritage: "{{ .Release.Service }}"
type: Opaque
data:
{{ .Values.deployment.env | toYaml | indent 2 }}
{{- end }}
3 changes: 3 additions & 0 deletions charts/bert-e/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -313,6 +313,9 @@ image:

## Kubernetes deployment configuration
deployment:
# Setup env vars on the deployment
env: {}
# MY_VAR: MY_VALUE

## Configure extra options for liveness and readiness probes
livenessProbe:
Expand Down

0 comments on commit 03c4181

Please sign in to comment.