Make IsValidIP return error strings

Also treat 0.0.0.0 as special, like loopback and multicast.
This commit is contained in:
Tim Hockin
2016-01-04 09:49:39 -08:00
parent 14bece550f
commit 87c1fc50a8
4 changed files with 34 additions and 15 deletions

View File

@@ -3489,12 +3489,19 @@ func TestValidateService(t *testing.T) {
numErrs: 1,
},
{
name: "invalid publicIPs",
name: "invalid publicIPs unspecified",
tweakSvc: func(s *api.Service) {
s.Spec.ExternalIPs = []string{"0.0.0.0"}
},
numErrs: 1,
},
{
name: "invalid publicIPs loopback",
tweakSvc: func(s *api.Service) {
s.Spec.ExternalIPs = []string{"127.0.0.1"}
},
numErrs: 1,
},
{
name: "invalid publicIPs host",
tweakSvc: func(s *api.Service) {