-
Notifications
You must be signed in to change notification settings - Fork 1.5k
[feat: gw api] Fix edge cases for lb config finalizers #4225
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
[feat: gw api] Fix edge cases for lb config finalizers #4225
Conversation
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: shraddhabang 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 |
@@ -46,6 +49,14 @@ func (h *enqueueRequestsForLoadBalancerConfigurationEvent) Create(ctx context.Co | |||
func (h *enqueueRequestsForLoadBalancerConfigurationEvent) Update(ctx context.Context, e event.TypedUpdateEvent[*elbv2gw.LoadBalancerConfiguration], queue workqueue.TypedRateLimitingInterface[reconcile.Request]) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this going under the Update handler? What should trigger it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When the the lbcfg with finalizers are attempted to delete, it triggers the update event as only the deletiontimestamp changes. hence added here so that if any residual lbfgs with finalizers gets delete attempt we try to clean these for them.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why don't we have an add / remove finalizer call in the gw class controller?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The finalizers are only added if there are any gateways referenced by gwclass referencing the lbcfg which we do in gateway controller logic. There is no need to add finalizers on lbcfg with just gatewayClass and no gateways.
@@ -49,6 +53,13 @@ func (h *enqueueRequestsForGatewayClassEvent) Update(ctx context.Context, e even | |||
|
|||
// Delete is not implemented for this handler as GatewayClass deletion should be finalized and is prevented while referenced by Gateways | |||
func (h *enqueueRequestsForGatewayClassEvent) Delete(ctx context.Context, e event.TypedDeleteEvent[*gatewayv1.GatewayClass], queue workqueue.TypedRateLimitingInterface[reconcile.Request]) { | |||
gwClass := e.Object | |||
h.logger.V(1).Info("enqueue gatewayclass delete event", "gatewayclass", gwClass.Name) | |||
// remove the load balancer configuration finalizer if there are any referred by this gwclass |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this isn't the right place to perform the finalizer deletion. If it fails, it won't get retried.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Even if its fails, when the actual deletion would occur for lbcfg, we will handle the removal of finalizers in lbcfg events as well which will succed right so they will be able to delete it eventually.
5114f89
to
097feb1
Compare
/lgtm |
Description
IsLBConfigInUse
to make it modular based on gw and gwclass.Checklist
README.md
, or thedocs
directory)BONUS POINTS checklist: complete for good vibes and maybe prizes?! 🤯