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

Make L4 NetLB Controller Healthcheck return error #1683

Merged
merged 1 commit into from
Mar 25, 2022
Merged
Show file tree
Hide file tree
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
5 changes: 3 additions & 2 deletions pkg/l4lb/l4controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ func NewILBController(ctx *context.ControllerContext, stopCh chan struct{}) *L4C
})
// TODO enhance this by looking at some metric from service controller to ensure it is up.
// We cannot use existence of a backend service or other resource, since those are on a per-service basis.
ctx.AddHealthCheck("service-controller health", l4c.checkHealth)
ctx.AddHealthCheck("l4-ilb-subsetting-controller", l4c.checkHealth)
return l4c
}

Expand All @@ -144,8 +144,9 @@ func (l4c *L4Controller) checkHealth() error {
syncTimeLatest := lastEnqueueTime.Add(enqueueToSyncDelayThreshold)
if lastSyncTime.After(syncTimeLatest) {
msg := fmt.Sprintf("L4 ILB Sync happened at time %v - %v after enqueue time, threshold is %v", lastSyncTime, lastSyncTime.Sub(lastEnqueueTime), enqueueToSyncDelayThreshold)
// Log here, context/http handler do no log the error.
klog.Error(msg)
// TODO return error here
return fmt.Errorf(msg)
Copy link
Member

Choose a reason for hiding this comment

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

Error not Errorf

}
return nil
}
Expand Down
5 changes: 3 additions & 2 deletions pkg/l4lb/l4netlbcontroller.go
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,7 @@ func NewL4NetLBController(
}
},
})
//TODO change to component name "l4netlb-controller"
ctx.AddHealthCheck("service-controller health", l4netLBc.checkHealth)
ctx.AddHealthCheck("l4netlb-controller", l4netLBc.checkHealth)
return l4netLBc
}

Expand Down Expand Up @@ -264,7 +263,9 @@ func (lc *L4NetLBController) checkHealth() error {
syncTimeLatest := lastEnqueueTime.Add(enqueueToSyncDelayThreshold)
if lastSyncTime.After(syncTimeLatest) {
msg := fmt.Sprintf("L4 External LoadBalancer Sync happened at time %v - %v after enqueue time, threshold is %v", lastSyncTime, lastSyncTime.Sub(lastEnqueueTime), enqueueToSyncDelayThreshold)
// Log here, context/http handler do no log the error.
klog.Error(msg)
return fmt.Errorf(msg)
Copy link
Member

Choose a reason for hiding this comment

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

error, not Errorf

}
return nil
}
Expand Down