Skip to content

Expose additional fields for port Service spec to support features such as topology based routing #769

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 20, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions api/v1/coherence_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -2184,6 +2184,35 @@ type ServiceSpec struct {
// This field is alpha-level and is only honored by servers that enable the ServiceLBNodePortControl feature.
// +optional
AllocateLoadBalancerNodePorts *bool `json:"allocateLoadBalancerNodePorts,omitempty"`
// loadBalancerClass is the class of the load balancer implementation this Service belongs to.
// If specified, the value of this field must be a label-style identifier, with an optional prefix,
// e.g. "internal-vip" or "example.com/internal-vip". Unprefixed names are reserved for end-users.
// This field can only be set when the Service type is 'LoadBalancer'. If not set, the default load
// balancer implementation is used, today this is typically done through the cloud provider integration,
// but should apply for any default implementation. If set, it is assumed that a load balancer
// implementation is watching for Services with a matching class. Any default load balancer
// implementation (e.g. cloud providers) should ignore Services that set this field.
// This field can only be set when creating or updating a Service to type 'LoadBalancer'.
// Once set, it can not be changed. This field will be wiped when a service is updated to a non 'LoadBalancer' type.
// +optional
LoadBalancerClass *string `json:"loadBalancerClass,omitempty"`
// InternalTrafficPolicy describes how nodes distribute service traffic they
// receive on the ClusterIP. If set to "Local", the proxy will assume that pods
// only want to talk to endpoints of the service on the same node as the pod,
// dropping the traffic if there are no local endpoints. The default value,
// "Cluster", uses the standard behavior of routing to all endpoints evenly
// (possibly modified by topology and other features).
// +optional
InternalTrafficPolicy *corev1.ServiceInternalTrafficPolicy `json:"internalTrafficPolicy,omitempty"`
// TrafficDistribution offers a way to express preferences for how traffic
// is distributed to Service endpoints. Implementations can use this field
// as a hint, but are not required to guarantee strict adherence. If the
// field is not set, the implementation will apply its default routing
// strategy. If set to "PreferClose", implementations should prioritize
// endpoints that are in the same zone.
// +featureGate=ServiceTrafficDistribution
// +optional
TrafficDistribution *string `json:"trafficDistribution,omitempty"`
}

// GetName returns the name of the service.
Expand Down Expand Up @@ -2246,6 +2275,9 @@ func (in *ServiceSpec) createServiceSpec() corev1.ServiceSpec {
spec.IPFamilyPolicy = in.IPFamilyPolicy
spec.IPFamilies = in.IPFamilies
spec.SessionAffinityConfig = in.SessionAffinityConfig
spec.LoadBalancerClass = in.LoadBalancerClass
spec.InternalTrafficPolicy = in.InternalTrafficPolicy
spec.TrafficDistribution = in.TrafficDistribution
}
return spec
}
Expand Down