-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
⚠ Cache's ByObject is now a map Object -> options #2166
⚠ Cache's ByObject is now a map Object -> options #2166
Conversation
acc97a2
to
00d618b
Compare
/assign @alvaroaleman @sbueringer |
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 nit
// ByObject offers more fine-grained control over the cache's ListWatch by object. | ||
type ByObject struct { | ||
// Label represents a label selector for the object. | ||
Label labels.Selector |
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.
Why separate Label
and Field
selectors here, but use one ObjectSelector
type for the DefaultSelector
field above?
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 was a suggestion by @alvaroaleman, I'm happy to do either way, although to reduce verbosity of the ByObject struct, might make sense to keep it this way
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 IMHO this is easier to use when keeping them separate. I guess we could also do the same for the DefaultSelector
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.
As in, separate DefaultLabelSelector
and DefaultFieldSelector
?
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
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.
done, ptal
// [2] https://pkg.go.dev/k8s.io/apimachinery/pkg/fields#Set | ||
Selectors SelectorsByObject | ||
// ByObject offers more fine-grained control over the cache's ListWatch by object. | ||
type ByObject struct { |
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 name is a little weird when it is used as cache.ByObject
, should it be OptionsByObject
?
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.
Can rename if we want to, the Struct is only used within the options, and was trying to reduce overall verbosity
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 ObjectOptions
? But no strong opining either way
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.
cache.Options{
ByObject: map[client.Object]cache.ByObject{
&corev1.Pod{}: {}
}
}
IMO, this reads well and looks nice. @FillZpp if you feel that we should change it, happy to do it though
00d618b
to
66e07d5
Compare
0cb8f51
to
6e7c24c
Compare
This is a breaking change and revisits some of the previous changes we've made. It brings the options ByObject to a top level map, which now contains all the options the internal informer can be configured with. In addition, it removes the ObjectAll object, which was super confusing and only used to disable the deep copy for every object; instead it's now possible to disable deep copy through a top level option. Signed-off-by: Vince Prignano <vincepri@redhat.com>
6e7c24c
to
7e2dbaf
Compare
lgtm from my side |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: alvaroaleman, vincepri The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
This is a breaking change and revisits some of the previous changes we've made. It brings the options ByObject to a top level map, which now contains all the options the internal informer can be configured with. In addition, it removes the ObjectAll object, which was super confusing and only used to disable the deep copy for every object; instead it's now possible to disable deep copy through a top level option.
Signed-off-by: Vince Prignano vincepri@redhat.com