mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-04 09:49:50 +00:00
pkg/proxy/healthcheck: bug fix for last updated time
The lastUpdated time returned by healthz call should be the latest lastUpdated time among the proxiers. Prior to this commit, if proxy is unhealthy, the returned lastUpdated time was lastUpdated time of the unhealthy proxier. Signed-off-by: Daman Arora <aroradaman@gmail.com>
This commit is contained in:
parent
0645f0e50e
commit
64aac665fd
@ -113,14 +113,14 @@ func (hs *ProxyHealthServer) isHealthy() (bool, time.Time) {
|
||||
defer hs.lock.RUnlock()
|
||||
|
||||
var lastUpdated time.Time
|
||||
currentTime := hs.clock.Now()
|
||||
|
||||
for ipFamily, proxierLastUpdated := range hs.lastUpdatedMap {
|
||||
|
||||
for _, proxierLastUpdated := range hs.lastUpdatedMap {
|
||||
if proxierLastUpdated.After(lastUpdated) {
|
||||
lastUpdated = proxierLastUpdated
|
||||
}
|
||||
}
|
||||
|
||||
currentTime := hs.clock.Now()
|
||||
for ipFamily, _ := range hs.lastUpdatedMap {
|
||||
if _, set := hs.oldestPendingQueuedMap[ipFamily]; !set {
|
||||
// the proxier is healthy while it's starting up
|
||||
// or the proxier is fully synced.
|
||||
@ -131,7 +131,7 @@ func (hs *ProxyHealthServer) isHealthy() (bool, time.Time) {
|
||||
// there's an unprocessed update queued for this proxier, but it's not late yet.
|
||||
continue
|
||||
}
|
||||
return false, proxierLastUpdated
|
||||
return false, lastUpdated
|
||||
}
|
||||
return true, lastUpdated
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user