-
Notifications
You must be signed in to change notification settings - Fork 218
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 to skip namespace creation #203
Conversation
In some environments it's not reasonable to allow creation and deletion of namespaces. This flag allows to use chart testing with already existing namespaces. Signed-off-by: Torsten Walter <[email protected]>
@@ -541,8 +541,10 @@ func (t *Testing) doInstall(chart *Chart) error { | |||
namespace, release, releaseSelector, cleanup := t.generateInstallConfig(chart) | |||
defer cleanup() | |||
|
|||
if err := t.kubectl.CreateNamespace(namespace); err != nil { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if adding a check to see if the namespace already exists before creation would handle your use case without adding a new flag?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That would be an option, too. In that case it should not try to delete the namepace at the end.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually if I remember correctly "do not create or delete namespace" was exactly the intended behavior of #59. If passing the namespace
flag can currently cause an existing namespace to be deleted I view that as a bug to be patched.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes looks like this was changed recently. https://github.com/helm/chart-testing/pull/184/files#diff-326b04dcc669c6ac56b6ea231f240fb2R584-R586
cc @unguiculus
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Correct. This should already be supported. I'll have to look into this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@unguiculus Thank you for looking into it. In the source code it looks like as if this feature has been removed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A regression was introduced due to Helm 3 no longer creating namespaces. This caused namespaces to always be created. #205 fixes this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks fo looking into it. I am closing this in favor of your PR.
What this PR does / why we need it:
In some environments it's not reasonable to allow creation and deletion of namespaces. This flag allows to use chart testing with already existing namespaces.
Which issue this PR fixes (optional, in
fixes #<issue number>(, fixes #<issue_number>, ...)
format, will close that issue when PR gets merged): fixes #Special notes for your reviewer:
It's missing tests. Just want to get feedback if this would be a useful addition.