We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent a11abec commit acf7872Copy full SHA for acf7872
pkg/util/k8s.go
@@ -4,7 +4,6 @@ import (
4
"fmt"
5
"net"
6
"net/url"
7
- "slices"
8
"strings"
9
"time"
10
@@ -64,7 +63,18 @@ func ServiceClusterIPs(svc v1.Service) []string {
64
63
if len(svc.Spec.ClusterIPs) == 0 && svc.Spec.ClusterIP != v1.ClusterIPNone && svc.Spec.ClusterIP != "" {
65
return []string{svc.Spec.ClusterIP}
66
}
67
- return slices.Clone(svc.Spec.ClusterIPs)
+
+ ips := make([]string, 0, len(svc.Spec.ClusterIPs))
68
+ for _, ip := range svc.Spec.ClusterIPs {
69
+ if net.ParseIP(ip) == nil {
70
+ if ip != "" && ip != v1.ClusterIPNone {
71
+ klog.Warningf("invalid cluster IP %q for service %s/%s", ip, svc.Namespace, svc.Name)
72
+ }
73
+ continue
74
75
+ ips = append(ips, ip)
76
77
+ return ips
78
79
80
func LabelSelectorNotEquals(key, value string) (labels.Selector, error) {
0 commit comments