Open adamcoppard opened 4 years ago
@adamcoppard if the namespace was written to the generated kustomization.yaml
, would that be expected?
@marccampbell - that would solve one problem - but not all.
I have cases where the bundle either has things like '{{repl Namespace}}'
in ConfigMaps
from the upstream vendor provided application, or, Helm charts that expect to be able to template out {{ .Release.Namespace }}
. It appears that kots
does this before applying it (i.e when going from upstream
to the base
and overlays
). The -n
flag is ignored for either of these replacements, too, when doing kubectl kots pull -n <namespace>
. This means that, whilst the resources do go to the right namespace if you add a namespace: <namespace>
to kustomization.yaml
- but any thing else that expects to be able to resolve what namespace it's in (a good example are the args passed to NGINX Ingress Controller - which expects to preface the ConfigMap name with the namespace so it can be found) does not.
I believe one workaround for this today is to set the POD_NAMESPACE
environment variable to your desired namespace before running kots pull - that's what's used by the template function internally.
Kots Version: 1.16.1 / 1.17.0-scratch
When running
kots pull ... -n <my-desired-namespace>
the desired namespace is never resolved anywhere that makes use of'{{repl Namespace}}'
, any items that Helm uses for the{{ .Release.Namespace }}
, or added to thekustomization.yaml
. Applying directly according to the output ofkots
, i.ekubectl apply -k ...
lead to all resources going to thedefault
namespace.Applying a
namespace
manually in thekustomization.yaml
fixes the resources going to the correct location, but means that in my case, Config and some of the Helm templating is then incorrect for the deployed namespace.