mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-23 19:56:01 +00:00
Merge pull request #81538 from thockin/master
Don't track syncProxyRules runtime if not running
This commit is contained in:
commit
d21822a02a
@ -670,17 +670,19 @@ func (proxier *Proxier) syncProxyRules() {
|
|||||||
proxier.mu.Lock()
|
proxier.mu.Lock()
|
||||||
defer proxier.mu.Unlock()
|
defer proxier.mu.Unlock()
|
||||||
|
|
||||||
|
// don't sync rules till we've received services and endpoints
|
||||||
|
if !proxier.endpointsSynced || !proxier.servicesSynced {
|
||||||
|
klog.V(2).Info("Not syncing iptables until Services and Endpoints have been received from master")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// Keep track of how long syncs take.
|
||||||
start := time.Now()
|
start := time.Now()
|
||||||
defer func() {
|
defer func() {
|
||||||
metrics.SyncProxyRulesLatency.Observe(metrics.SinceInSeconds(start))
|
metrics.SyncProxyRulesLatency.Observe(metrics.SinceInSeconds(start))
|
||||||
metrics.DeprecatedSyncProxyRulesLatency.Observe(metrics.SinceInMicroseconds(start))
|
metrics.DeprecatedSyncProxyRulesLatency.Observe(metrics.SinceInMicroseconds(start))
|
||||||
klog.V(4).Infof("syncProxyRules took %v", time.Since(start))
|
klog.V(4).Infof("syncProxyRules took %v", time.Since(start))
|
||||||
}()
|
}()
|
||||||
// don't sync rules till we've received services and endpoints
|
|
||||||
if !proxier.endpointsSynced || !proxier.servicesSynced {
|
|
||||||
klog.V(2).Info("Not syncing iptables until Services and Endpoints have been received from master")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// We assume that if this was called, we really want to sync them,
|
// We assume that if this was called, we really want to sync them,
|
||||||
// even if nothing changed in the meantime. In other words, callers are
|
// even if nothing changed in the meantime. In other words, callers are
|
||||||
|
@ -789,17 +789,19 @@ func (proxier *Proxier) syncProxyRules() {
|
|||||||
proxier.mu.Lock()
|
proxier.mu.Lock()
|
||||||
defer proxier.mu.Unlock()
|
defer proxier.mu.Unlock()
|
||||||
|
|
||||||
|
// don't sync rules till we've received services and endpoints
|
||||||
|
if !proxier.endpointsSynced || !proxier.servicesSynced {
|
||||||
|
klog.V(2).Info("Not syncing ipvs rules until Services and Endpoints have been received from master")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// Keep track of how long syncs take.
|
||||||
start := time.Now()
|
start := time.Now()
|
||||||
defer func() {
|
defer func() {
|
||||||
metrics.SyncProxyRulesLatency.Observe(metrics.SinceInSeconds(start))
|
metrics.SyncProxyRulesLatency.Observe(metrics.SinceInSeconds(start))
|
||||||
metrics.DeprecatedSyncProxyRulesLatency.Observe(metrics.SinceInMicroseconds(start))
|
metrics.DeprecatedSyncProxyRulesLatency.Observe(metrics.SinceInMicroseconds(start))
|
||||||
klog.V(4).Infof("syncProxyRules took %v", time.Since(start))
|
klog.V(4).Infof("syncProxyRules took %v", time.Since(start))
|
||||||
}()
|
}()
|
||||||
// don't sync rules till we've received services and endpoints
|
|
||||||
if !proxier.endpointsSynced || !proxier.servicesSynced {
|
|
||||||
klog.V(2).Info("Not syncing ipvs rules until Services and Endpoints have been received from master")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// We assume that if this was called, we really want to sync them,
|
// We assume that if this was called, we really want to sync them,
|
||||||
// even if nothing changed in the meantime. In other words, callers are
|
// even if nothing changed in the meantime. In other words, callers are
|
||||||
|
Loading…
Reference in New Issue
Block a user