-
Notifications
You must be signed in to change notification settings - Fork 210
Fix no namespace resource found on delete resource k8s #1281
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
Conversation
| // getNamespaceForRun returns namespace used on kubectl apply/delete commands | ||
| // priority: config.KubernetesDeploymentInput > kubernetes.ResourceKey | ||
| func (p *provider) getNamespaceForRun(k ResourceKey) string { | ||
| if p.input.Namespace != "" { | ||
| return p.input.Namespace | ||
| } | ||
| return k.Namespace |
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.
We could get the namespace from ResourceKey ( from manifest files ) or from KubernetesDeploymentInput ( which could be empty on unset currently ). IMO, namespace value from KubernetesDeploymentInput should have a higher priority than the value from ResourceKey, in case of mismatch, the current not found resources to delete error will be raised.
How do you think?
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 think the one in the user-defined manifest should be more prioritized than pipe.yaml when applying.
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.
To be simple, the piped's role is basically just to perform kubectl apply -f manifest.yaml.
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.
Hmm... but on the second thought, the case that user clearly defines its namespace in the .pipe.yaml, I'm begging to feel it's better to override the base manifest.
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.
One vote from me for taking the namespace value from the Input with higher priority.
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.
Hmm... but on the second thought, the case that user clearly defines its namespace in the
.pipe.yaml, I'm begging to feel it's better to override the base manifest.
yep, I feel the same either. Since the manifest should be treated as a base, and config on .pipe.yaml lay on that base and those who defined the config should be aware of where should the deployment they set will be applied to.
|
/cc @nakabonne |
|
Code coverage for golang is
|
|
Code coverage for golang is
|
|
Nice catch! |
| return p.kubectl.Delete(ctx, p.getNamespaceToRun(k), k) | ||
| } | ||
|
|
||
| // getNamespaceToRun returns namespace used on kubectl apply/delete commands |
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.
nit nit: . at end of the line. (Just the convention of our team. )
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.
🙆♀️
|
Except for the stuff mentioned by nghialv, looks good. Great work 👍 |
|
Code coverage for golang is
|
|
Great. Thank you. |
What this PR does / why we need it:
The
namespacein KubernetesDeploymentInput config currently is not a required field. In case of deleting resource on unset that namespace field, namespace default will be used ( as a default namespace of k8s ) leads tonot found resources to deletebug.Which issue(s) this PR fixes:
Fixes #1275
Does this PR introduce a user-facing change?: