Merge pull request #21907 from justinsb/load_balancer_source_ranges
Auto commit by PR queue bot
This commit is contained in:
@@ -25,6 +25,7 @@ import (
|
||||
|
||||
"k8s.io/kubernetes/pkg/api"
|
||||
"k8s.io/kubernetes/pkg/api/resource"
|
||||
"k8s.io/kubernetes/pkg/api/service"
|
||||
"k8s.io/kubernetes/pkg/api/testapi"
|
||||
"k8s.io/kubernetes/pkg/api/unversioned"
|
||||
"k8s.io/kubernetes/pkg/capabilities"
|
||||
@@ -2878,6 +2879,34 @@ func TestValidateService(t *testing.T) {
|
||||
},
|
||||
numErrs: 1,
|
||||
},
|
||||
{
|
||||
name: "valid LoadBalancer source range annotation",
|
||||
tweakSvc: func(s *api.Service) {
|
||||
s.Annotations[service.AnnotationLoadBalancerSourceRangesKey] = "1.2.3.4/8, 5.6.7.8/16"
|
||||
},
|
||||
numErrs: 0,
|
||||
},
|
||||
{
|
||||
name: "empty LoadBalancer source range annotation",
|
||||
tweakSvc: func(s *api.Service) {
|
||||
s.Annotations[service.AnnotationLoadBalancerSourceRangesKey] = ""
|
||||
},
|
||||
numErrs: 0,
|
||||
},
|
||||
{
|
||||
name: "invalid LoadBalancer source range annotation (hostname)",
|
||||
tweakSvc: func(s *api.Service) {
|
||||
s.Annotations[service.AnnotationLoadBalancerSourceRangesKey] = "foo.bar"
|
||||
},
|
||||
numErrs: 1,
|
||||
},
|
||||
{
|
||||
name: "invalid LoadBalancer source range annotation (invalid CIDR)",
|
||||
tweakSvc: func(s *api.Service) {
|
||||
s.Annotations[service.AnnotationLoadBalancerSourceRangesKey] = "1.2.3.4/33"
|
||||
},
|
||||
numErrs: 1,
|
||||
},
|
||||
}
|
||||
|
||||
for _, tc := range testCases {
|
||||
|
Reference in New Issue
Block a user