mirror of
https://github.com/k3s-io/kubernetes.git
synced 2026-01-05 07:27:21 +00:00
Updating kube-proxy to trim space from loadBalancerSourceRanges
Before this fix, a Service with a loadBalancerSourceRange value that included a space would cause kube-proxy to crashloop. This updates kube-proxy to trim any space from that field.
This commit is contained in:
@@ -1183,9 +1183,10 @@ func (proxier *Proxier) syncProxyRules() {
|
||||
allowFromNode := false
|
||||
for _, src := range svcInfo.LoadBalancerSourceRanges() {
|
||||
writeLine(proxier.natRules, append(args, "-s", src, "-j", string(chosenChain))...)
|
||||
// ignore error because it has been validated
|
||||
_, cidr, _ := net.ParseCIDR(src)
|
||||
if cidr.Contains(proxier.nodeIP) {
|
||||
_, cidr, err := net.ParseCIDR(src)
|
||||
if err != nil {
|
||||
klog.Errorf("Error parsing %s CIDR in LoadBalancerSourceRanges, dropping: %v", cidr, err)
|
||||
} else if cidr.Contains(proxier.nodeIP) {
|
||||
allowFromNode = true
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user