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
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions pkg/controller/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.

return labels.ValidatedSetSelector(labels.Set{
discoveryv1.LabelServiceName: svc.Name,
})
}
Expand Down
5 changes: 3 additions & 2 deletions pkg/controller/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,9 @@ func podFindPort(pod *corev1.Pod, svcPort *corev1.ServicePort) (int32, error) {
return 0, fmt.Errorf("no suitable port for manifest: %s", pod.UID)
}

// podLabelSelector returns labels.Selector from labelSet.
func podLabelSelector(labelSet map[string]string) labels.Selector {
// podLabelSelector returns label selector labelSet by removing labels that are used by Deployment or DaemonSet exclusively for its
// management purposes.
func podLabelSelector(labelSet map[string]string) labels.ValidatedSetSelector {
l := make(map[string]string)
// Remove labels which represent pod template hash, revision, or generation.
for k, v := range labelSet {
Expand Down