Skip to content

Commit 64aac66

Browse files
committed
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 <[email protected]>
1 parent 0645f0e commit 64aac66

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

pkg/proxy/healthcheck/proxy_health.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -113,14 +113,14 @@ func (hs *ProxyHealthServer) isHealthy() (bool, time.Time) {
113113
defer hs.lock.RUnlock()
114114

115115
var lastUpdated time.Time
116-
currentTime := hs.clock.Now()
117-
118-
for ipFamily, proxierLastUpdated := range hs.lastUpdatedMap {
119-
116+
for _, proxierLastUpdated := range hs.lastUpdatedMap {
120117
if proxierLastUpdated.After(lastUpdated) {
121118
lastUpdated = proxierLastUpdated
122119
}
120+
}
123121

122+
currentTime := hs.clock.Now()
123+
for ipFamily, _ := range hs.lastUpdatedMap {
124124
if _, set := hs.oldestPendingQueuedMap[ipFamily]; !set {
125125
// the proxier is healthy while it's starting up
126126
// or the proxier is fully synced.
@@ -131,7 +131,7 @@ func (hs *ProxyHealthServer) isHealthy() (bool, time.Time) {
131131
// there's an unprocessed update queued for this proxier, but it's not late yet.
132132
continue
133133
}
134-
return false, proxierLastUpdated
134+
return false, lastUpdated
135135
}
136136
return true, lastUpdated
137137
}

0 commit comments

Comments
 (0)