You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm having a hard time understanding variable substitution order, especially if a value of a config map uses a variable from the same config map.
Given the following directory tree
The base/gateway/config-map.yaml is used in a patchesStrategicMerge in the kustomization.yaml and has the following variable: BASE_URL_FRONTEND: "$(BUCKET_URL_PREFIX)/$(BUCKET_FRONTEND)"
base/global-config-map-auto is used in a patches in it's respective kustomization.yaml has the following:
The values of NAMESPACE, PROJECT and ENV are defined in the base overlay.
When I run kustomize build in the dev overlay, the result of global-configmap is correct - BUCKET_URL_PREFIX has the expected value.
But the result of BASE_URL_FRONTEND is insufficient - it is $(SERVICE_URL_PREFIX)$(BUCKET_URL_SERVICE).$(SERVICE_URL_SUFFIX)/plugin-$(PROJECT)-$(ENV)-frontend-bucket.
It seems it first substituted the variables in the gateway configmap and only then in the global configmap.
Why?
What is the correct order?
For context, if necessary:
base/kustomization.yaml:
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
I'm having a hard time understanding variable substitution order, especially if a value of a config map uses a variable from the same config map.
Given the following directory tree
The base/gateway/config-map.yaml is used in a
patchesStrategicMergein thekustomization.yamland has the following variable:BASE_URL_FRONTEND: "$(BUCKET_URL_PREFIX)/$(BUCKET_FRONTEND)"base/global-config-map-auto is used in a
patchesin it's respectivekustomization.yamlhas the following:The values of
NAMESPACE,PROJECTandENVare defined in the base overlay.When I run
kustomize buildin the dev overlay, the result ofglobal-configmapis correct -BUCKET_URL_PREFIXhas the expected value.But the result of
BASE_URL_FRONTENDis insufficient - it is$(SERVICE_URL_PREFIX)$(BUCKET_URL_SERVICE).$(SERVICE_URL_SUFFIX)/plugin-$(PROJECT)-$(ENV)-frontend-bucket.It seems it first substituted the variables in the gateway configmap and only then in the global configmap.
Why?
What is the correct order?
For context, if necessary:
base/kustomization.yaml:
base/global-configs.yaml is the same as base/gateway/kustomizeconfig.yaml:
overlays/dev/kustomization.yaml
overlays/dev/config-map.yaml
Beta Was this translation helpful? Give feedback.
All reactions