Skip to content
Merged
Show file tree
Hide file tree
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
31 changes: 31 additions & 0 deletions api/v1alpha1/loadbalancer_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,14 @@ type LoadBalancer struct {
// +optional
ConsistentHash *ConsistentHash `json:"consistentHash,omitempty"`

// EndpointOverride defines the configuration for endpoint override.
// When specified, the load balancer will attempt to route requests to endpoints
// based on the override information extracted from request headers or metadata.
// If the override endpoints are not available, the configured load balancer policy will be used as fallback.
//
// +optional
EndpointOverride *EndpointOverride `json:"endpointOverride,omitempty"`

// SlowStart defines the configuration related to the slow start load balancer policy.
// If set, during slow start window, traffic sent to the newly added hosts will gradually increase.
// Currently this is only supported for RoundRobin and LeastRequest load balancers
Expand Down Expand Up @@ -178,3 +186,26 @@ type ForceLocalZone struct {
// +notImplementedHide
MinEndpointsInZoneThreshold *uint32 `json:"minEndpointsInZoneThreshold,omitempty"`
}

// EndpointOverride defines the configuration for endpoint override.
// This allows endpoint picking to be implemented based on request headers or metadata.
// It extracts selected override endpoints from the specified sources (request headers, metadata, etc.).
// If no valid endpoint in the override list, then the configured load balancing policy is used as fallback.
type EndpointOverride struct {
// ExtractFrom defines the sources to extract endpoint override information from.
//
// +kubebuilder:validation:MinItems=1
// +kubebuilder:validation:MaxItems=10
ExtractFrom []EndpointOverrideExtractFrom `json:"extractFrom"`
}

// EndpointOverrideExtractFrom defines a source to extract endpoint override information from.
type EndpointOverrideExtractFrom struct {
// Header defines the header to get the override endpoint addresses.
// The header value must specify at least one endpoint in `IP:Port` format or multiple endpoints in `IP:Port,IP:Port,...` format.
// For example `10.0.0.5:8080` or `[2600:4040:5204::1574:24ae]:80`.
// The IPv6 address is enclosed in square brackets.
//
// +optional
Header *string `json:"header,omitempty"`
}
47 changes: 47 additions & 0 deletions api/v1alpha1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -668,6 +668,34 @@ spec:
- message: If consistent hash type is cookie, the cookie field
must be set.
rule: 'self.type == ''Cookie'' ? has(self.cookie) : !has(self.cookie)'
endpointOverride:
description: |-
EndpointOverride defines the configuration for endpoint override.
When specified, the load balancer will attempt to route requests to endpoints
based on the override information extracted from request headers or metadata.
If the override endpoints are not available, the configured load balancer policy will be used as fallback.
properties:
extractFrom:
description: ExtractFrom defines the sources to extract endpoint
override information from.
items:
description: EndpointOverrideExtractFrom defines a source
to extract endpoint override information from.
properties:
header:
description: |-
Header defines the header to get the override endpoint addresses.
The header value must specify at least one endpoint in `IP:Port` format or multiple endpoints in `IP:Port,IP:Port,...` format.
For example `10.0.0.5:8080` or `[2600:4040:5204::1574:24ae]:80`.
The IPv6 address is enclosed in square brackets.
type: string
type: object
maxItems: 10
minItems: 1
type: array
required:
- extractFrom
type: object
slowStart:
description: |-
SlowStart defines the configuration related to the slow start load balancer policy.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -746,6 +746,35 @@ spec:
field must be set.
rule: 'self.type == ''Cookie'' ? has(self.cookie)
: !has(self.cookie)'
endpointOverride:
description: |-
EndpointOverride defines the configuration for endpoint override.
When specified, the load balancer will attempt to route requests to endpoints
based on the override information extracted from request headers or metadata.
If the override endpoints are not available, the configured load balancer policy will be used as fallback.
properties:
extractFrom:
description: ExtractFrom defines the sources to
extract endpoint override information from.
items:
description: EndpointOverrideExtractFrom defines
a source to extract endpoint override information
from.
properties:
header:
description: |-
Header defines the header to get the override endpoint addresses.
The header value must specify at least one endpoint in `IP:Port` format or multiple endpoints in `IP:Port,IP:Port,...` format.
For example `10.0.0.5:8080` or `[2600:4040:5204::1574:24ae]:80`.
The IPv6 address is enclosed in square brackets.
type: string
type: object
maxItems: 10
minItems: 1
type: array
required:
- extractFrom
type: object
slowStart:
description: |-
SlowStart defines the configuration related to the slow start load balancer policy.
Expand Down
Loading
Loading