-
Notifications
You must be signed in to change notification settings - Fork 42
feat(set_ns): add kustomize plugin to set a resource's namespace #81
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
93d0894 to
1c0322c
Compare
1c0322c to
fdce3ad
Compare
|
/lgtm |
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.
Some minor comments, feel free to improve on that if you agree or skip it, too (no hard feelings)
pkg/deploy/plugins/namespace_test.go
Outdated
|
|
||
| _, err := CreateNamespacePlugin("") | ||
| require.Error(t, err) | ||
| assert.Contains(t, err.Error(), "namespace cannot be empty") |
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: Usually I would not check on literal error message, but that key context components are contained. E.g. here I would check that "namespace" is included for the context and for "empty" as the error kind. Not necessarily the exact wording, that makes the test more robust for refactorings but still captures the essence.
pkg/deploy/plugins/plugins.go
Outdated
|
|
||
| // ValidateName uses the strictest naming rule (for Namespaces) to ensure | ||
| // the provided name string is valid for any given Resource. | ||
| func ValidateName(name string) error { |
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.
Maybe the function name should reflect that it's for the stronge validation of a DNS name, and not for all resource. Something like ValidateDNSResourceName or so.
|
@mfleader @leseb @VaishnaviHire @skamenan7 @rhdedgar @Elbehery While working on the PR (pardonnez-mois for hijacking the issue :), I would quickly raise a proposal:
This allows us to have some more flexibility, moves back some responsibility to the author and hopefully helps in unblocking and speeding-up things. wdyt ? |
|
I'm not sure how I feel about this. Typically, "nits" still require changes; what I consider "nit" is something small but still needs to be addressed (maybe I got the understanding of "nit" wrong, though). If no action is required, I would typically start the comment with: "No action required: ...", then leave it up to the PR author to address or not. I might still leave an approval, also. This happened recently with @mfleader, I had a "no action required" item, approved the PR, and it got merged. @mfleader then followed up with another PR because he felt the item made sense. If I had a strong opinion I wouldn't have had approved the PR in the first place. Also btw, approvals are not reset on push, we haven't configured that yet, and I'm all for it even though it could slow us down. All that said, I'm not sure if this label should block merging (I know it's the entire point of the label) :). It feels like more burden to the author to manage the label :) |
|
Interesting, I could see striking a balance between the two options. That does raise the question, do we want to use the Otherwise, there might be some impactful code that gets pushed after the review and approval. If it's only for small things, I do think it would be helpful to have some kind of label to convey "I approve the PR, but want to give the author time to address optional suggestions". Then the author can merge it later, even if the approver / reviewer isn't still online at the time. |
|
I agree with @leseb on their points, except I did not think |
…e to the operator instance's namespace Signed-off-by: Matthew F Leader <mleader@redhat.com> Co-authored-by: Vaishnavi Hire <vhire@redhat.com>
Signed-off-by: Matthew F Leader <mleader@redhat.com>
Signed-off-by: Matthew F Leader <mleader@redhat.com>
Signed-off-by: Matthew F Leader <mleader@redhat.com>
Signed-off-by: Matthew F Leader <mleader@redhat.com>
e1b921b to
003105a
Compare
…mastack#81) - [X] Adds a Kustomize plugin to set a given Resource's Namespace to the Operator owner instance's Namespace. - [X] Factors out `Name` validation behavior into `plugins.go` for reuse in `namespace.go`. Approved-by: VaishnaviHire (cherry picked from commit 23867eb)
Namevalidation behavior intoplugins.gofor reuse innamespace.go.