kots icon indicating copy to clipboard operation
kots copied to clipboard

[kots cli] Templating function not effective in additionalNamespace field during admin-console upgrade

Open namgk opened this issue 2 years ago • 1 comments

When running the upgrade or deploy with the kots cli (e.g. kubectl kots admin-console upgrade), it go over the manifests and from this procedure, it doesn't handle the template function.

https://github.com/replicatedhq/kots/blob/d673a3e5079a10c6918c5616932c32af34ebbb2d/pkg/kotsadm/namespaces.go#L42-L52

We have an application.yaml that has this part:

additionalNamespaces:
    - aaa
    - '{{repl if XX}}bb{{repl end}}'

It the admin-console upgrade command failed with

• Upgrading Admin Console • Creating namespace {{repl if XX}}bb{{repl end}} ✗ Error: failed to upgrade: failed to upgrade admin console: failed to ensure additional namespaces: failed to create namespace: Namespace "{{repl if XX}}bb{{repl end}}" is invalid: [metadata.name: Invalid value: ...

namgk avatar Oct 12 '23 19:10 namgk

@namgk the additionalNamespaces field does not support go templating at this time (docs). Would you be able to share a little bit more about your use-case? We may be able to help find a way to accomplish what you are looking to do.

cbodonnell avatar Nov 17 '23 22:11 cbodonnell