Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func SetupXListenerSetWebhookWithManager ¶
func SetupXListenerSetWebhookWithManager(mgr ctrl.Manager, portRangeStart, portRangeEnd int32, gatewayCapacity int, gatewayNS string, gatewayNames []string) error
SetupXListenerSetWebhookWithManager registers the XListenerSet mutating webhook. gatewayCapacity of 0 disables gateway sharding.
Types ¶
type GatewayKey ¶
GatewayKey uniquely identifies a Gateway by namespace and name.
type GatewaySharding ¶
type GatewaySharding struct {
// contains filtered or unexported fields
}
GatewaySharding selects the best Gateway for new XListenerSets based on per-gateway listener capacity.
func NewGatewaySharding ¶
func NewGatewaySharding(gateways []GatewayKey, capacity int) *GatewaySharding
NewGatewaySharding creates a new GatewaySharding instance. capacity is the maximum number of listeners per gateway.
func (*GatewaySharding) SelectGateway ¶
func (gs *GatewaySharding) SelectGateway(currentRef GatewayKey, newListenerCount int, listenerCounts map[GatewayKey]int) (GatewayKey, bool, error)
SelectGateway determines which gateway should host the new XListenerSet. If the current gateway has room, it returns unchanged. Otherwise it picks the gateway with the fewest listeners that still has capacity. Returns an error if all gateways are full.
type PortAllocator ¶
type PortAllocator struct {
// contains filtered or unexported fields
}
PortAllocator allocates unique TCP ports by scanning existing XListenerSet resources on the cluster to find used ports, then picking the first free port in the configured range. Deleted XListenerSets automatically free their ports.
func NewPortAllocator ¶
func NewPortAllocator(c client.Client, portRangeStart, portRangeEnd int32) *PortAllocator
NewPortAllocator creates a new PortAllocator.
func (*PortAllocator) AllocatePort ¶
func (a *PortAllocator) AllocatePort(ctx context.Context, usedPorts map[int32]bool, namespace, holder string) (int32, error)
AllocatePort atomically reserves a port by creating a Lease. If the Lease already exists, it tries the next port.
type XListenerSetHandler ¶
type XListenerSetHandler struct {
// contains filtered or unexported fields
}
XListenerSetHandler handles mutating admission requests for XListenerSet resources. It allocates unique TCP ports for listeners that have port 0 (sentinel value).