Skip to content
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

Ensure ingress cleanup when finalizer exists #1144

Merged
merged 1 commit into from
Jul 21, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 9 additions & 7 deletions pkg/controller/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -166,20 +166,22 @@ func NewLoadBalancerController(
UpdateFunc: func(old, cur interface{}) {
curIng := cur.(*v1beta1.Ingress)
if !utils.IsGLBCIngress(curIng) {
oldIng := old.(*v1beta1.Ingress)
// If ingress was GLBC Ingress, we need to track ingress class change
// and run GC to delete LB resources.
if utils.IsGLBCIngress(oldIng) {
klog.V(4).Infof("Ingress %v class was changed, enqueuing", common.NamespacedName(curIng))
// Ingress needs to be enqueued if a ingress finalizer exists.
// An existing finalizer means that
// 1. Ingress update for class change.
// 2. Ingress cleanup failed and re-queued.
// 3. Finalizer remove failed and re-queued.
if common.HasFinalizer(curIng.ObjectMeta) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Is it possible that a super old version of ingress controller (without finalizer) gets directly updated to this version?

Would it basically skip all syncs for existing ingress?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This will be released to 1.17 only and both 1.15, 1.16 versions have finalizers enabled. So, the above case may be highly unlikely

klog.V(2).Infof("Ingress %s class was changed but has a glbc finalizer, enqueuing", common.NamespacedName(curIng))
lbc.ingQueue.Enqueue(cur)
return
}
return
}
if reflect.DeepEqual(old, cur) {
klog.V(2).Infof("Periodic enqueueing of %v", common.NamespacedName(curIng))
klog.V(2).Infof("Periodic enqueueing of %s", common.NamespacedName(curIng))
} else {
klog.V(2).Infof("Ingress %v changed, enqueuing", common.NamespacedName(curIng))
klog.V(2).Infof("Ingress %s changed, enqueuing", common.NamespacedName(curIng))
}
lbc.ctx.Recorder(curIng.Namespace).Eventf(curIng, apiv1.EventTypeNormal, events.SyncIngress, "Scheduled for sync")
lbc.ingQueue.Enqueue(cur)
Expand Down