MChorfa / porter-helm3

porter-helm3
Apache License 2.0
8 stars 10 forks source link

--create-namespace flag is always set #50

Open lucasmaheo opened 2 years ago

lucasmaheo commented 2 years ago

The --create-namespace flag is always set, even when the namespace exists. The default behaviour for helm in that case is to try creating the namespace. However in some environments, users do not have the rights to create namespaces, resulting in an error:

Error: INSTALLATION FAILED: namespaces is forbidden: User "myuser" cannot create resource "namespaces" in API group "" at the cluster scope

I suggest adding the option to set it or not, potentially depending on a bundle parameter, in order to leave the choice to the end user.

carolynvs commented 2 years ago
install:
- helm3:
     chart: ...
     namespace: myns
     create-namespace: false # default to true, preserves existing behavior

I am not a fan of making boolean config values that default to true, but it lines up well with the name of the flag, and we are already doing it for the atomic flag too so I feel like that would be most consistent.

What do you think?

lucasmaheo commented 2 years ago

I agree that it is slightly confusing that users would have to specify create-namespace: false to disable. It is consistent with itself, just not with helm.

I think that's a good workaround for now to ensure compatibility with most and keeping current behaviour. In a future release I would still recommend to match as closely as possible helm behaviour: same defaults, same flags. Boolean flags are really easy to implement, it's a shame not to expose them.

thomasthep commented 1 year ago

I just went ahead and implemented this as it's currently blocking our ability to deliver the bundle to customers. Feel free to merge or request changes.