Skip to content

Commit 92fcb8e

Browse files
committed
Fix service IP validation to handle "ClusterIP: None"
1 parent a3cdf77 commit 92fcb8e

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

pkg/sdn/plugin/master.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,8 @@ func (master *OsdnMaster) validateNetworkConfig() error {
155155
return err
156156
}
157157
for _, svc := range services.Items {
158-
if !ni.ServiceNetwork.Contains(net.ParseIP(svc.Spec.ClusterIP)) {
158+
svcIP := net.ParseIP(svc.Spec.ClusterIP)
159+
if svcIP != nil && !ni.ServiceNetwork.Contains(svcIP) {
159160
errList = append(errList, fmt.Errorf("Error: Existing service with IP: %s is not part of service network: %s", svc.Spec.ClusterIP, ni.ServiceNetwork.String()))
160161
}
161162
}

0 commit comments

Comments
 (0)