mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-23 11:50:44 +00:00
Merge pull request #105218 from khenidak/fix-sig-net-105182
mute unnecessary logs when failing to parse IPs
This commit is contained in:
commit
005dfcd09e
@ -24,6 +24,7 @@ import (
|
|||||||
"net"
|
"net"
|
||||||
"net/http"
|
"net/http"
|
||||||
"strconv"
|
"strconv"
|
||||||
|
"strings"
|
||||||
|
|
||||||
v1 "k8s.io/api/core/v1"
|
v1 "k8s.io/api/core/v1"
|
||||||
"k8s.io/apimachinery/pkg/types"
|
"k8s.io/apimachinery/pkg/types"
|
||||||
@ -274,7 +275,15 @@ func MapIPsByIPFamily(ipStrings []string) map[v1.IPFamily][]string {
|
|||||||
if ipFamily, err := getIPFamilyFromIP(ip); err == nil {
|
if ipFamily, err := getIPFamilyFromIP(ip); err == nil {
|
||||||
ipFamilyMap[ipFamily] = append(ipFamilyMap[ipFamily], ip)
|
ipFamilyMap[ipFamily] = append(ipFamilyMap[ipFamily], ip)
|
||||||
} else {
|
} else {
|
||||||
klog.ErrorS(nil, "Skipping invalid IP", "ip", ip)
|
// this function is called in multiple places. All of which
|
||||||
|
// have sanitized data. Except the case of ExternalIPs which is
|
||||||
|
// not validated by api-server. Specifically empty strings
|
||||||
|
// validation. Which yields into a lot of bad error logs.
|
||||||
|
// check for empty string
|
||||||
|
if len(strings.TrimSpace(ip)) != 0 {
|
||||||
|
klog.ErrorS(nil, "Skipping invalid IP", "ip", ip)
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return ipFamilyMap
|
return ipFamilyMap
|
||||||
|
Loading…
Reference in New Issue
Block a user