From 9baafcd261d5c68886f9f4980269a6c88cfed9ae Mon Sep 17 00:00:00 2001 From: Fangyuan Li Date: Sun, 15 Nov 2020 23:59:58 -0800 Subject: [PATCH] Implements Service Internal Traffic Policy 1. Add API definitions; 2. Add feature gate and drops the field when feature gate is not on; 3. Set default values for the field; 4. Add API Validation 5. add kube-proxy iptables and ipvs implementations 6. add tests Kubernetes-commit: 7ed2f1d94d694c6c4fdb4629638c38b1cbda7288 --- applyconfigurations/core/v1/servicespec.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/applyconfigurations/core/v1/servicespec.go b/applyconfigurations/core/v1/servicespec.go index 69162286..99361cec 100644 --- a/applyconfigurations/core/v1/servicespec.go +++ b/applyconfigurations/core/v1/servicespec.go @@ -44,6 +44,7 @@ type ServiceSpecApplyConfiguration struct { IPFamilyPolicy *corev1.IPFamilyPolicyType `json:"ipFamilyPolicy,omitempty"` AllocateLoadBalancerNodePorts *bool `json:"allocateLoadBalancerNodePorts,omitempty"` LoadBalancerClass *string `json:"loadBalancerClass,omitempty"` + InternalTrafficPolicy *corev1.ServiceInternalTrafficPolicyType `json:"internalTrafficPolicy,omitempty"` } // ServiceSpecApplyConfiguration constructs an declarative configuration of the ServiceSpec type for use with @@ -224,3 +225,11 @@ func (b *ServiceSpecApplyConfiguration) WithLoadBalancerClass(value string) *Ser b.LoadBalancerClass = &value return b } + +// WithInternalTrafficPolicy sets the InternalTrafficPolicy field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the InternalTrafficPolicy field is set to the value of the last call. +func (b *ServiceSpecApplyConfiguration) WithInternalTrafficPolicy(value corev1.ServiceInternalTrafficPolicyType) *ServiceSpecApplyConfiguration { + b.InternalTrafficPolicy = &value + return b +}