-
Notifications
You must be signed in to change notification settings - Fork 238
Introduce flag to default L4 NetLB Services to RBS controller #843
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
base: master
Are you sure you want to change the base?
Conversation
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: 08volt The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
This issue is currently awaiting triage. If the repository mantainers determine this is a relevant issue, they will accept it by applying the The Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
Hi @08volt. Thanks for your PR. I'm waiting for a kubernetes member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
/ok-to-test |
This change introduces the `NetLBFinalizerV1` ("gke.networking.io/l4-netlb-v1") to Kubernetes Service objects of type LoadBalancer managed by the legacy cloud-controller-manager logic for external L4 Network Load Balancers (NetLB). **Controller Distinction:** It clearly marks the Service as being managed by this specific controller logic (`ensureExternalLoadBalancer`), distinguishing it from services managed by newer controllers using Regional Backend Services (RBS), which use `NetLBFinalizerV2` or `NetLBFinalizerV3`. The `usesL4RBS` function now explicitly checks for the absence of V1 finalizer as one condition to determine if a service *might* be managed elsewhere. Implementation details: - The `NetLBFinalizerV1` is added to the Service metadata within the `ensureExternalLoadBalancer` function when the load balancer is created or updated. - The finalizer is removed from the Service metadata within the `ensureExternalLoadBalancerDeleted` function *after* all associated GCP resources have been successfully deleted or confirmed non-existent. Tested the create, update, and delete lifecycle for external L4 LoadBalancer services to ensure the finalizer is added and removed correctly and that resource cleanup proceeds as expected.
This change introduces the `--enable-rbs-default-l4-netlb` flag for the GCE Cloud Controller Manager (CCM). This flag modifies the default controller responsible for handling GCE L4 External Network Load Balancer (NetLB) Services when no explicit `spec.loadBalancerClass` is set. **Behavior Change:** * **When `--enable-rbs-default-l4-netlb` is `true`:** * L4 LB Services *without* an explicit `spec.loadBalancerClass` will **not** be reconciled by the legacy CCM Service controller by default. * It is assumed these services will be handled by the newer Regional Backend Service (RBS) based L4 controller (e.g., the GKE Service controller). * The legacy CCM Service controller will only reconcile L4 Services that explicitly specify `spec.loadBalancerClass: gce.networking.k8s.io/regional-external-legacy`. * **When `--enable-rbs-default-l4-netlb` is `false` (Default):** * The existing behavior is preserved. * The legacy CCM Service controller will reconcile L4 LB Services without a `spec.loadBalancerClass`, unless they explicitly opt-in to RBS via annotations (`cloud.google.com/l4-rbs-enabled: "true"`), specific finalizers (`gke.networking.k8s.io/l4-netlb-v2` / `gke.networking.k8s.io/l4-regional-netlb-v3`), or have an existing forwarding rule pointing to a Backend Service. **Implementation Details:** * Added the `enableRBSDefaultForL4NetLB` boolean flag, controllable via `--enable-rbs-default-l4-netlb`. * Added `SetEnableRBSDefaultForL4NetLB` method to the GCE cloud provider (`gce.Cloud`) to store the flag's state. * Modified the `usesCCMforNetLB` utility function to accept the `isRbsDefault` state (derived from the flag) and adjust its logic accordingly.
could you squash the last 2 commits to get rid of the one named |
interesting, I didn't know you could do that. But I'd say it depends on the PR, sometimes it's good to have separate commits, like in deps update - go mod changes + vendor in one commit and the cluster/ thing in the other commit |
The Kubernetes project currently lacks enough contributors to adequately respond to all PRs. This bot triages PRs according to the following rules:
You can:
Please send feedback to sig-contributor-experience at kubernetes/community. /lifecycle stale |
Changes Introduced
New Flag:
--enable-rbs-default-l4-netlb
boolean flag to the CCM binary (main.go
). Default isfalse
.Cloud Provider Logic:
gce.Cloud
) now accepts and stores the state of this flag viaSetEnableRBSDefaultForL4NetLB
.Controller Selection Logic (
utils.go
):usesCCMforNetLB
function, which determines if the legacy CCM Service controller should manage a given L4 Service.enableRBSDefaultForL4NetLB
flag's state.Unit Tests:
--enable-rbs-default-l4-netlb
flag is enabled (isRBSDefault=true
):TestEnsureExternalLoadBalancerRBSAnnotation
TestEnsureExternalLoadBalancerRBSFinalizer
TestEnsureExternalLoadBalancerClass
cloudprovider.ImplementedElsewhere
or processing the service) based on the combination of annotations, finalizers,loadBalancerClass
, and the new flag's state duringensure
,update
, anddelete
operations.Behavior with the Flag
--enable-rbs-default-l4-netlb=false
(Default):spec.loadBalancerClass
, unless they explicitly opt-in to RBS via annotations (cloud.google.com/l4-rbs-enabled: "true"
), specific finalizers (gke.networking.k8s.io/l4-netlb-v2
,gke.networking.k8s.io/l4-regional-netlb-v3
), or have an existing forwarding rule pointing to a Backend Service.--enable-rbs-default-l4-netlb=true
:spec.loadBalancerClass
by default.spec.loadBalancerClass: gce.networking.k8s.io/regional-external-legacy
.