mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-23 19:56:01 +00:00
Allows user to change service type when sourceRanges is declared
This commit is contained in:
parent
3e51ca2e16
commit
924432f2dc
@ -2666,7 +2666,13 @@ func ValidateServiceUpdate(service, oldService *api.Service) field.ErrorList {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// TODO(freehan): allow user to update loadbalancerSourceRanges
|
// TODO(freehan): allow user to update loadbalancerSourceRanges
|
||||||
allErrs = append(allErrs, ValidateImmutableField(service.Spec.LoadBalancerSourceRanges, oldService.Spec.LoadBalancerSourceRanges, field.NewPath("spec", "loadBalancerSourceRanges"))...)
|
// Only allow removing LoadBalancerSourceRanges when change service type from LoadBalancer
|
||||||
|
// to non-LoadBalancer or adding LoadBalancerSourceRanges when change service type from
|
||||||
|
// non-LoadBalancer to LoadBalancer.
|
||||||
|
if service.Spec.Type != api.ServiceTypeLoadBalancer && oldService.Spec.Type != api.ServiceTypeLoadBalancer ||
|
||||||
|
service.Spec.Type == api.ServiceTypeLoadBalancer && oldService.Spec.Type == api.ServiceTypeLoadBalancer {
|
||||||
|
allErrs = append(allErrs, ValidateImmutableField(service.Spec.LoadBalancerSourceRanges, oldService.Spec.LoadBalancerSourceRanges, field.NewPath("spec", "loadBalancerSourceRanges"))...)
|
||||||
|
}
|
||||||
|
|
||||||
allErrs = append(allErrs, validateServiceFields(service)...)
|
allErrs = append(allErrs, validateServiceFields(service)...)
|
||||||
allErrs = append(allErrs, validateServiceAnnotations(service, oldService)...)
|
allErrs = append(allErrs, validateServiceAnnotations(service, oldService)...)
|
||||||
|
Loading…
Reference in New Issue
Block a user