@@ -2184,6 +2184,35 @@ type ServiceSpec struct {
21842184 // This field is alpha-level and is only honored by servers that enable the ServiceLBNodePortControl feature.
21852185 // +optional
21862186 AllocateLoadBalancerNodePorts * bool `json:"allocateLoadBalancerNodePorts,omitempty"`
2187+ // loadBalancerClass is the class of the load balancer implementation this Service belongs to.
2188+ // If specified, the value of this field must be a label-style identifier, with an optional prefix,
2189+ // e.g. "internal-vip" or "example.com/internal-vip". Unprefixed names are reserved for end-users.
2190+ // This field can only be set when the Service type is 'LoadBalancer'. If not set, the default load
2191+ // balancer implementation is used, today this is typically done through the cloud provider integration,
2192+ // but should apply for any default implementation. If set, it is assumed that a load balancer
2193+ // implementation is watching for Services with a matching class. Any default load balancer
2194+ // implementation (e.g. cloud providers) should ignore Services that set this field.
2195+ // This field can only be set when creating or updating a Service to type 'LoadBalancer'.
2196+ // Once set, it can not be changed. This field will be wiped when a service is updated to a non 'LoadBalancer' type.
2197+ // +optional
2198+ LoadBalancerClass * string `json:"loadBalancerClass,omitempty"`
2199+ // InternalTrafficPolicy describes how nodes distribute service traffic they
2200+ // receive on the ClusterIP. If set to "Local", the proxy will assume that pods
2201+ // only want to talk to endpoints of the service on the same node as the pod,
2202+ // dropping the traffic if there are no local endpoints. The default value,
2203+ // "Cluster", uses the standard behavior of routing to all endpoints evenly
2204+ // (possibly modified by topology and other features).
2205+ // +optional
2206+ InternalTrafficPolicy * corev1.ServiceInternalTrafficPolicy `json:"internalTrafficPolicy,omitempty"`
2207+ // TrafficDistribution offers a way to express preferences for how traffic
2208+ // is distributed to Service endpoints. Implementations can use this field
2209+ // as a hint, but are not required to guarantee strict adherence. If the
2210+ // field is not set, the implementation will apply its default routing
2211+ // strategy. If set to "PreferClose", implementations should prioritize
2212+ // endpoints that are in the same zone.
2213+ // +featureGate=ServiceTrafficDistribution
2214+ // +optional
2215+ TrafficDistribution * string `json:"trafficDistribution,omitempty"`
21872216}
21882217
21892218// GetName returns the name of the service.
@@ -2246,6 +2275,9 @@ func (in *ServiceSpec) createServiceSpec() corev1.ServiceSpec {
22462275 spec .IPFamilyPolicy = in .IPFamilyPolicy
22472276 spec .IPFamilies = in .IPFamilies
22482277 spec .SessionAffinityConfig = in .SessionAffinityConfig
2278+ spec .LoadBalancerClass = in .LoadBalancerClass
2279+ spec .InternalTrafficPolicy = in .InternalTrafficPolicy
2280+ spec .TrafficDistribution = in .TrafficDistribution
22492281 }
22502282 return spec
22512283}
0 commit comments