-
Notifications
You must be signed in to change notification settings - Fork 11
Return concrete type #462
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
Return concrete type #462
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.
Pull Request Overview
This PR updates two functions to return a concrete type (labels.ValidatedSetSelector) instead of the general labels.Selector.
- Updates podLabelSelector in pkg/controller/util.go to return labels.ValidatedSetSelector.
- Updates newEndpointSliceSelector in pkg/controller/controller.go to return labels.ValidatedSetSelector.
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
File | Description |
---|---|
pkg/controller/util.go | Changed podLabelSelector’s return type to a concrete type. |
pkg/controller/controller.go | Changed newEndpointSliceSelector’s return type to a concrete type. |
Comments suppressed due to low confidence (1)
pkg/controller/util.go:113
- Update the comment for podLabelSelector to reflect that it now returns labels.ValidatedSetSelector.
// podLabelSelector returns labels.Selector from labelSet.
@@ -1680,8 +1680,8 @@ func (lbc *LoadBalancerController) getEndpointsFromEndpointSlice(ctx context.Con | |||
return backends, nil | |||
} | |||
|
|||
func newEndpointSliceSelector(svc *corev1.Service) labels.Selector { | |||
return labels.SelectorFromSet(labels.Set{ | |||
func newEndpointSliceSelector(svc *corev1.Service) labels.ValidatedSetSelector { |
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.
If present, update the documentation/comments for newEndpointSliceSelector to indicate the new concrete return type labels.ValidatedSetSelector.
Copilot uses AI. Check for mistakes.
02b9a30
to
d141b64
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.
Pull Request Overview
This PR updates two functions to return a concrete type (labels.ValidatedSetSelector) instead of the more abstract labels.Selector. This change aims to make the function contracts more explicit and enforce stricter type usage.
- Updated podLabelSelector in pkg/controller/util.go so that it now returns a concrete validated selector after filtering out management-specific labels.
- Updated newEndpointSliceSelector in pkg/controller/controller.go to return a concrete validated selector for endpoint slices.
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
File | Description |
---|---|
pkg/controller/util.go | Updated podLabelSelector to return labels.ValidatedSetSelector. |
pkg/controller/controller.go | Updated newEndpointSliceSelector to return labels.ValidatedSetSelector. |
Comments suppressed due to low confidence (2)
pkg/controller/util.go:115
- Changing the return type from labels.Selector to labels.ValidatedSetSelector may affect existing callers expecting an interface. Please ensure that the updated API usage is clearly documented and that all callers are adjusted accordingly.
func podLabelSelector(labelSet map[string]string) labels.ValidatedSetSelector {
pkg/controller/controller.go:1683
- The function now returns a concrete type labels.ValidatedSetSelector instead of labels.Selector. Verify that all consumers of this function are compatible with the concrete type or update them accordingly.
func newEndpointSliceSelector(svc *corev1.Service) labels.ValidatedSetSelector {
No description provided.