mirror of
https://github.com/k3s-io/kubernetes.git
synced 2026-01-04 15:05:20 +00:00
Fix kube-proxy healthz server for proxier sync loop changes
The proxy healthz server assumed that kube-proxy would regularly call UpdateTimestamp() even when nothing changed, but that's no longer true. Fix it to only report unhealthiness when updates have been received from the apiserver but not promptly pushed out to iptables/ipvs.
This commit is contained in:
@@ -462,6 +462,9 @@ func (proxier *Proxier) probability(n int) string {
|
||||
|
||||
// Sync is called to synchronize the proxier state to iptables as soon as possible.
|
||||
func (proxier *Proxier) Sync() {
|
||||
if proxier.healthzServer != nil {
|
||||
proxier.healthzServer.QueuedUpdate()
|
||||
}
|
||||
proxier.syncRunner.Run()
|
||||
}
|
||||
|
||||
@@ -469,7 +472,7 @@ func (proxier *Proxier) Sync() {
|
||||
func (proxier *Proxier) SyncLoop() {
|
||||
// Update healthz timestamp at beginning in case Sync() never succeeds.
|
||||
if proxier.healthzServer != nil {
|
||||
proxier.healthzServer.UpdateTimestamp()
|
||||
proxier.healthzServer.Updated()
|
||||
}
|
||||
proxier.syncRunner.Loop(wait.NeverStop)
|
||||
}
|
||||
@@ -496,7 +499,7 @@ func (proxier *Proxier) OnServiceAdd(service *v1.Service) {
|
||||
// service object is observed.
|
||||
func (proxier *Proxier) OnServiceUpdate(oldService, service *v1.Service) {
|
||||
if proxier.serviceChanges.Update(oldService, service) && proxier.isInitialized() {
|
||||
proxier.syncRunner.Run()
|
||||
proxier.Sync()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1451,7 +1454,7 @@ func (proxier *Proxier) syncProxyRules() {
|
||||
proxier.portsMap = replacementPortsMap
|
||||
|
||||
if proxier.healthzServer != nil {
|
||||
proxier.healthzServer.UpdateTimestamp()
|
||||
proxier.healthzServer.Updated()
|
||||
}
|
||||
metrics.SyncProxyRulesLastTimestamp.SetToCurrentTime()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user