Validate None Service ClusterIP against LB type
If the Service is a Load Balancer, it should not have None Cluster IP. If it does, Service validation fails.
This commit is contained in:
@@ -5173,6 +5173,14 @@ func TestValidateService(t *testing.T) {
|
||||
},
|
||||
numErrs: 1,
|
||||
},
|
||||
{
|
||||
name: "LoadBalancer type cannot have None ClusterIP",
|
||||
tweakSvc: func(s *api.Service) {
|
||||
s.Spec.ClusterIP = "None"
|
||||
s.Spec.Type = api.ServiceTypeLoadBalancer
|
||||
},
|
||||
numErrs: 1,
|
||||
},
|
||||
}
|
||||
|
||||
for _, tc := range testCases {
|
||||
@@ -6432,6 +6440,14 @@ func TestValidateServiceUpdate(t *testing.T) {
|
||||
},
|
||||
numErrs: 1,
|
||||
},
|
||||
{
|
||||
name: "LoadBalancer type cannot have None ClusterIP",
|
||||
tweakSvc: func(oldSvc, newSvc *api.Service) {
|
||||
newSvc.Spec.ClusterIP = "None"
|
||||
newSvc.Spec.Type = api.ServiceTypeLoadBalancer
|
||||
},
|
||||
numErrs: 1,
|
||||
},
|
||||
}
|
||||
|
||||
for _, tc := range testCases {
|
||||
|
||||
Reference in New Issue
Block a user