Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow bundle authors to ensure a namespace exists #33

Open
carolynvs opened this issue Sep 17, 2021 · 3 comments
Open

Allow bundle authors to ensure a namespace exists #33

carolynvs opened this issue Sep 17, 2021 · 3 comments

Comments

@carolynvs
Copy link
Collaborator

Helm has re-added the --create-namespace flag, which checks if the namespace does not exist and creates it if needed. We should expose this flag as a field for the install and upgrade actions:

helm:
  chart: mychart
  namespace: "{{ installation.name }}"
  createNamespace: true

I suggest that createNamespace default to true, for the same reason that I proposed that upsert should be set by default (#30) or go even further with #17 for an idempotent install: mixins should default to idempotent commands for install/upgrade/uninstall. Re-running install or upgrade should not result in errors about resources already existing. We do not want to get people into situations where the bundle isn't runnable anymore and they have to fall back to using the tools manually to "fix" a stuck bundle.

Current workarounds for the lack of namespace support are:

  • Use the exec mixin to execute a helm install command with --create-namespace=true. Whenever a user has to use the exec mixin, it opens up security concerns for people evaluating the bundle, and it's an unnecessary hurdle for authors since supporting the extra flag is straightforward, so why make them switch to exec?
  • Use the kubernetes mixin and apply a namespace manifest. Again this is sub-par because it's a flag that helm supports, so having to switch to another tool (and increase the bundle size with another mixin) is unwarranted.
@MChorfa
Copy link
Owner

MChorfa commented Sep 17, 2021

Yes, I spot that command 2 weeks ago and using it right now on my deployments. works well. I Will work on this over this weekend

@carolynvs
Copy link
Collaborator Author

Oh great! I just updated porter's main branch to use your helm3 mixin and the build is failing because the namespace doesn't exist.

https://github.com/getporter/porter/pull/1772/checks?check_run_id=3668928358

If you end up not having time to add this, just let me know and I can help out.

@MChorfa
Copy link
Owner

MChorfa commented Sep 23, 2021

Fixed in v0.1.14

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants