-
Notifications
You must be signed in to change notification settings - Fork 41
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
add methods to allow selection and exclusion of resources by gvk #581
add methods to allow selection and exclusion of resources by gvk #581
Conversation
eec9c4f
to
b022f7a
Compare
b022f7a
to
f11c238
Compare
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.
This looks great - just drive-by naming / API design nits!
go/fn/object.go
Outdated
} | ||
|
||
// SelectByGvk will return the subset of objects that matches the provided GVK. | ||
func (o KubeObjects) SelectByGvk(apiVersion, kind string) KubeObjects { |
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: This isn't really selecting by GVK :-) I would expect SelectByGVK to take a schema.GroupVersionKind.
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.
While I agree with the nit, we already have a func (o *KubeObject) IsGVK(apiVersion, kind string) bool
here, so I'm trying to keep things consistent. If we're going to change it so that GVK strictly refers to group, version, and kind (rather than apiVersion and kind), we should do that everywhere. WDYT @mengqiy @yuwenma ?
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.
yeah, +1 to take a schema.GroupVersionKind. That's also my original thought, but one thing we need to further discuss is that how we can not duplicate kustomize code and at the same time import as less code as possible. for GVK, I think introducing our own version is good especially to support the SQL style syntax.
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.
changed to use schema.GroupVersionKind instead of apiVersion
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 "schema.GroupVersionKind" refer to k8s.io/apimachinery/pkg/runtime/schema
0167797
to
4c639f3
Compare
1759fa5
to
f30773d
Compare
f30773d
to
bf04273
Compare
@yuwenma I see that you've approved this PR but I've made some more changes that I think should be reviewed before merging, do you mind taking a look? |
Thank you for the change and overall looks great. One last comment about the schema.GroupVersionKind. I'm totally okay to do that in a follow up PR as well :) |
Related to kptdev/kpt#3016
Add methods to the function SDK to allow easily filtering by GVK, name, namespace, labels, annotations, and meta resources.