Skip to content

tg / lb conf finalizers #4230

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 13, 2025
Merged

tg / lb conf finalizers #4230

merged 1 commit into from
Jun 13, 2025

Conversation

zac-nixon
Copy link
Collaborator

@zac-nixon zac-nixon commented Jun 12, 2025

Description

Adds finalizers to TargetGroupConfiguration, LoadbalancerConfiguration, and GatewayClass (only if the controller manages it).

  • TargetGroupConfiguration: IMO, we should not allow deletion when it's actively attached to a Gateway. Users can potentially delete their TG config and revert their targets back to the defaults which has a high potential of causing impact. Previously, the finalizer was preventing deletion until the referring service was deleted which is a bit clunky, what if I no longer want to use ELB but want to keep my service around?
  • LoadbalancerConfiguration: Finalizer prevents deletion until no Gateway / GatewayClass refers to the configuration. This will ensure that users are able to have correctly working Gateways. Same logic as TG config, we should not allow customers to unknowingly reset their configuration by deleting the LBConfig. If they want to reset to defaults they can either modify the LBConfig or explicitly detach it from the gw / gwc.
  • GatewayClass: Finalizer prevents deletion until no Gateways reference it. This makes sure that customers aren't able to break their existing gateways.

Checklist

  • Added tests that cover your change (if possible)
  • Added/modified documentation as required (such as the README.md, or the docs directory)
  • Manually tested
  • Made sure the title of the PR is a good description that can go into the release notes

BONUS POINTS checklist: complete for good vibes and maybe prizes?! 🤯

  • Backfilled missing tests for code in same general area 🎉
  • Refactored something and made the world a better place 🌟

@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Jun 12, 2025
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: zac-nixon

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. approved Indicates a PR has been approved by an approver from all required OWNERS files. labels Jun 12, 2025
@zac-nixon zac-nixon force-pushed the main branch 3 times, most recently from a7ddcae to 0e7363a Compare June 12, 2025 19:13
@@ -60,13 +58,16 @@ func (h *enqueueRequestsForGatewayClassEvent) Generic(ctx context.Context, e eve
}

func (h *enqueueRequestsForGatewayClassEvent) enqueueImpactedGateways(ctx context.Context, gwClass *gatewayv1.GatewayClass, queue workqueue.TypedRateLimitingInterface[reconcile.Request]) {
gwList := gatewayutils.GetGatewaysManagedByGatewayClass(ctx, h.k8sClient, gwClass, h.gwController)
gwList, err := gatewayutils.GetGatewaysManagedByLBController(ctx, h.k8sClient, h.gwController)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should only enqueue the Gateways which are managed by GatewayClass rather than controller for gwclass events. Use GetGatewaysManagedByGatewayClass

@@ -165,7 +167,11 @@ type gatewayReconciler struct {
func (r *gatewayReconciler) Reconcile(ctx context.Context, req reconcile.Request) (ctrl.Result, error) {
r.reconcileTracker(req.NamespacedName)
err := r.reconcileHelper(ctx, req)
return runtime.HandleReconcileError(err, r.logger)
res, reconcileErr := runtime.HandleReconcileError(err, r.logger)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why cant we simply return runtime.HandleReconcileError(err, r.logger)?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

initially had logging here, will change back

@zac-nixon
Copy link
Collaborator Author

/retest

@shraddhabang
Copy link
Collaborator

/lgtm
/approved

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Jun 13, 2025
@k8s-ci-robot k8s-ci-robot merged commit 9ba9e27 into kubernetes-sigs:main Jun 13, 2025
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants