mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-09-20 09:33:52 +00:00
Service: Fix semantics for Update wrt allocations
It is not uncommon for users to Create a Service and not specify things like ClusterIP and NodePort, which we then allocate for them. They same that YAML somewhere and later use it again in an Update, but then it fails. That's because we detected them trying to set a ClusterIP from a value to "", which is not allowed. If it was just NodePort, they would actually succeed and reallocate a new port. After this change, we try to "patch" updates where the user did not specify those values from the old object.
This commit is contained in:
@@ -155,6 +155,13 @@ func SetInternalTrafficPolicy(policy api.ServiceInternalTrafficPolicyType) Tweak
|
||||
}
|
||||
}
|
||||
|
||||
// SetExternalTrafficPolicy sets the externalTrafficPolicy field for a Service.
|
||||
func SetExternalTrafficPolicy(policy api.ServiceExternalTrafficPolicyType) Tweak {
|
||||
return func(svc *api.Service) {
|
||||
svc.Spec.ExternalTrafficPolicy = policy
|
||||
}
|
||||
}
|
||||
|
||||
// SetAllocateLoadBalancerNodePorts sets the allocate LB node port field.
|
||||
func SetAllocateLoadBalancerNodePorts(val bool) Tweak {
|
||||
return func(svc *api.Service) {
|
||||
|
Reference in New Issue
Block a user