We have an app that runs on GKE Kubernetes and which expects an auth url (to which user will be redirected via his browser) to be passed as environment variable.
We are using different namespaces per environment
So our current pod config looks something like this:
env:
- name: ENV
valueFrom:
fieldRef:
fieldPath: metadata.namespace
- name: AUTH_URL
value: https://auth.$(ENV).example.org
And all works amazingly, we can have as many dynamic environments as we want, we just do apply -f config.yaml and it works flawlessly without changing a single config file and without any third party scripts.
Now for production we kind of want to use different domain, so the general pattern https://auth.$(ENV).example.org
does not work anymore.
What options do we have?
- Since configs are in git repo, create a separate branch for
prod
environment - Have a default ConfigMap and a specific one for prod environment, and run it via some script (if exists
prod-config.yaml
then use that, else useconfig.yaml
) - but with this approach we cannot use kubectl directly anymore - Move this config to application level, and have separate config file for
prod
env - but this kind of goes against 12factor app? - Other...?