Skip to content

Commit

Permalink
chore: consolidate environment variables
Browse files Browse the repository at this point in the history
  • Loading branch information
saladgg committed Sep 15, 2023
1 parent b1aa91d commit 5fa451d
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 1 deletion.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -305,3 +305,4 @@ media/
local.sh
secrets/*
cloud_sql_proxy
deploy_copy
20 changes: 20 additions & 0 deletions cloudbuild.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -95,12 +95,22 @@ steps:
- --values
- values.yaml
- --set
- project_id=$PROJECT_ID
- --set
- namespace=${_NAMESPACE}
- --set
- django.image.repository=${_IMAGE_NAME}
- --set
- django.image.tag=$COMMIT_SHA
- --set
- django.env_vars.settings_name=${_SETTINGS_NAME}
- --set
- django.env_vars.django_settings_module=${_DJANGO_SETTINGS_MODULE}
- --set
- django.env_vars.postgres_host=${_PG_HOST}
- --set
- django.env_vars.postgres_port=${_PG_PORT}
- --set
- ingress.networking.domain=${_DOMAIN_NAME}
- --set
- ingress.networking.issuer.name=${_LETSENCRYPT_SERVER_TYPE}
Expand Down Expand Up @@ -132,12 +142,22 @@ steps:
- --values
- values.yaml
- --set
- project_id=$PROJECT_ID
- --set
- namespace=${_NAMESPACE}
- --set
- django.image.repository=${_IMAGE_NAME}
- --set
- django.image.tag=$COMMIT_SHA
- --set
- django.env_vars.settings_name=${_SETTINGS_NAME}
- --set
- django.env_vars.django_settings_module=${_DJANGO_SETTINGS_MODULE}
- --set
- django.env_vars.postgres_host=${_PG_HOST}
- --set
- django.env_vars.postgres_port=${_PG_PORT}
- --set
- ingress.networking.domain=${_DOMAIN_NAME}
- --set
- ingress.networking.issuer.name=${_LETSENCRYPT_SERVER_TYPE}
Expand Down
14 changes: 13 additions & 1 deletion deploy/templates/django/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,21 @@ spec:
envFrom:
- configMapRef:
name: {{ .Values.django.configmap.config_name }}
env:
- name: SETTINGS_NAME
value: {{ .Values.django.env_vars.settings_name }}
- name: PORT
value: "8080"
- name: DJANGO_SETTINGS_MODULE
value: {{ .Values.django.env_vars.django_settings_module }}
- name: POSTGRES_HOST
value: {{ .Values.django.env_vars.postgres_host }}
- name: POSTGRES_PORT
value: {{ .Values.django.env_vars.postgres_port | toString | quote }}
volumeMounts:
- name: env-var-vol
mountPath: /secrets/environment_variables
mountPath: /secrets/app_configs/configs.ini
subPath: configs.ini
readOnly: true

volumes:
Expand Down
2 changes: 2 additions & 0 deletions deploy/templates/pg-bouncer/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ spec:
- configMapRef:
name: {{ .Values.pg_bouncer.app_name }}-db-config
volumeMounts:
# mountPath should be the same as `auth_file` in `pgb_configmap.yml`
- name: user-config
mountPath: /bitnami/pgbouncer/conf/userlist.txt
subPath: userlist.txt
Expand All @@ -41,6 +42,7 @@ spec:
- name: sa-secret-vol
mountPath: /secrets/service_account_secrets
readOnly: true

volumes:
- name: user-config
configMap:
Expand Down
6 changes: 6 additions & 0 deletions deploy/values.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
namespace: cluster_namespace
project_id: fyj

django:
app_name: django
Expand All @@ -15,6 +16,11 @@ django:
config_name: "config_name"
secrets:
secrets_name: "secrets_name"
env_vars:
settings_name: "idr_test_secrets"
django_settings_module: "config.settings.local"
postgres_host: "pgb-service"
postgres_port: "6432"

cloud_sql:
app_name: cloudsql-proxy
Expand Down

0 comments on commit 5fa451d

Please sign in to comment.