Skip to content

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

Merged
merged 1 commit into from
May 28, 2025
Merged

Return concrete type #462

merged 1 commit into from
May 28, 2025

Conversation

tatsuhiro-t
Copy link
Collaborator

No description provided.

@tatsuhiro-t tatsuhiro-t added this to the v0.73.0 milestone May 28, 2025
@tatsuhiro-t tatsuhiro-t requested a review from Copilot May 28, 2025 01:01
Copy link

@Copilot Copilot AI left a 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 {
Copy link
Preview

Copilot AI May 28, 2025

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.

@tatsuhiro-t tatsuhiro-t force-pushed the return-concrete-type branch from 02b9a30 to d141b64 Compare May 28, 2025 01:04
@tatsuhiro-t tatsuhiro-t requested a review from Copilot May 28, 2025 01:10
Copy link

@Copilot Copilot AI left a 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 {

@tatsuhiro-t tatsuhiro-t merged commit 6efe543 into main May 28, 2025
2 checks passed
@tatsuhiro-t tatsuhiro-t deleted the return-concrete-type branch May 28, 2025 01:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant