feat: fall back to EndpointSlice-based node discovery for selectorless services#25
Open
sircthulhu wants to merge 1 commit intoIntreecom:masterfrom
Open
feat: fall back to EndpointSlice-based node discovery for selectorless services#25sircthulhu wants to merge 1 commit intoIntreecom:masterfrom
sircthulhu wants to merge 1 commit intoIntreecom:masterfrom
Conversation
…s services When a Service has no spec.selector (e.g. services created by kubevirt cloud-controller-manager which manages EndpointSlices directly), the dynamic node selector now falls back to discovering target nodes from EndpointSlice resources instead of returning an error. This enables RobotLB to work with LoadBalancer services where an external controller manages EndpointSlices, such as tenant Kubernetes clusters running on KubeVirt with externalTrafficPolicy: Local. Assisted-By: Claude AI Signed-off-by: Kirill Ilin <stitch14@yandex.ru>
5 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
When
--dynamic-node-selectoris enabled (the default), RobotLB currently requiresspec.selectoron LoadBalancer Services to discover target nodes via pod lookup. Services without a selector produce aServiceWithoutSelectorerror.This PR adds a fallback: when a Service has no selector, RobotLB reads
EndpointSliceresources (by the standardkubernetes.io/service-namelabel) and extractsnodeNamefrom each ready endpoint to determine target nodes.Context
Cozystack is a cloud platform that runs tenant Kubernetes clusters as KubeVirt virtual machines. When a tenant creates a LoadBalancer Service inside their cluster, kubevirt cloud-controller-manager creates a corresponding Service in the management cluster without a selector and manages
EndpointSliceresources directly — this is a deliberate design decision needed to correctly supportexternalTrafficPolicy: Local(see cloud-provider-kubevirt#330).This means RobotLB cannot provision Hetzner Cloud Load Balancers for tenant services on Cozystack clusters deployed on Hetzner Robot infrastructure. With this change, RobotLB seamlessly handles both selector-based and selectorless services.
Changes
src/main.rs: Addedget_nodes_from_endpointslices()function that discovers target nodes fromEndpointSliceresources. Modifiedget_nodes_dynamically()to fall back to this function when selector is absent or empty.helm/values.yaml: Added RBAC permission fordiscovery.k8s.io/endpointslices(get,list,watch).