-
Notifications
You must be signed in to change notification settings - Fork 152
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
Strictly match Group in ResourceTypeMatcher: K8s core group #1390
Conversation
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 am not familiar enough with the pkg/discovery/discovery.go
code to tell how this change will affect it:
✗ grep -rnI "\.Any(" *
pkg/discovery/discovery.go:63: if !exclude.Any(gvr) {
Any()
eventually calls into Matches()
.
Otherwise, I agree with this change since upstream uses the same value.
@@ -18,7 +18,7 @@ import ( | |||
"testing" | |||
|
|||
. "gopkg.in/check.v1" | |||
"k8s.io/api/core/v1" | |||
v1 "k8s.io/api/core/v1" |
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.
Not needed?
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.
VSCode likely added it automatically. I don't think it is needed. OTOH, 72 of the 82 imports of "k8s.io/api/core/v1"
in kanister code use it. So I'd do it for consistency.
Within the Kanister package, the two uses of ignoreGroupErrors are just above,
Since the Group values here are not |
Change Overview
This PR supports strict matching of Group in ResourceTypeMatcher.
This allows use of K8s core resources (group == "") in filters without
accidentally matching resources with same name in other groups. Maintains
wildcard behavior for "" in version and resource so that matches can be
done for entire groups and all versions of a specific group:resource.
Note: the filter package has been contributed to Kanister in the hope that it
may be useful. It does not appear that the Matches() method that is modified
here is used by anything in Kanister other than test code. This package is
used by K10 and an additional unit test also exercises this change.
Pull request type
Please check the type of change your PR introduces:
Issues
Test Plan