mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-03 09:22:44 +00:00
Add nftables cleanup failure metric, fix cleanup bug
If the sync fails, don't try to cleanup, since it's guaranteed to fail too.
This commit is contained in:
parent
fc05a294cc
commit
d4e6e62134
@ -196,6 +196,17 @@ var (
|
|||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// NFTablesCleanupFailuresTotal is the number of nftables stale chain cleanup
|
||||||
|
// failures that the proxy has seen.
|
||||||
|
NFTablesCleanupFailuresTotal = metrics.NewCounter(
|
||||||
|
&metrics.CounterOpts{
|
||||||
|
Subsystem: kubeProxySubsystem,
|
||||||
|
Name: "sync_proxy_rules_nftables_cleanup_failures_total",
|
||||||
|
Help: "Cumulative proxy nftables cleanup failures",
|
||||||
|
StabilityLevel: metrics.ALPHA,
|
||||||
|
},
|
||||||
|
)
|
||||||
|
|
||||||
// ProxyHealthzTotal is the number of returned HTTP Status for each
|
// ProxyHealthzTotal is the number of returned HTTP Status for each
|
||||||
// healthz probe.
|
// healthz probe.
|
||||||
ProxyHealthzTotal = metrics.NewCounterVec(
|
ProxyHealthzTotal = metrics.NewCounterVec(
|
||||||
@ -280,6 +291,7 @@ func RegisterMetrics(mode kubeproxyconfig.ProxyMode) {
|
|||||||
|
|
||||||
case kubeproxyconfig.ProxyModeNFTables:
|
case kubeproxyconfig.ProxyModeNFTables:
|
||||||
legacyregistry.MustRegister(NFTablesSyncFailuresTotal)
|
legacyregistry.MustRegister(NFTablesSyncFailuresTotal)
|
||||||
|
legacyregistry.MustRegister(NFTablesCleanupFailuresTotal)
|
||||||
|
|
||||||
case kubeproxyconfig.ProxyModeKernelspace:
|
case kubeproxyconfig.ProxyModeKernelspace:
|
||||||
// currently no winkernel-specific metrics
|
// currently no winkernel-specific metrics
|
||||||
|
@ -1033,7 +1033,7 @@ func (proxier *Proxier) syncProxyRules() {
|
|||||||
// the chains still exist, they'll just get added back
|
// the chains still exist, they'll just get added back
|
||||||
// (with a later timestamp) at the end of the sync.
|
// (with a later timestamp) at the end of the sync.
|
||||||
proxier.logger.Error(err, "Unable to delete stale chains; will retry later")
|
proxier.logger.Error(err, "Unable to delete stale chains; will retry later")
|
||||||
// FIXME: metric
|
metrics.NFTablesCleanupFailuresTotal.Inc()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1621,6 +1621,10 @@ func (proxier *Proxier) syncProxyRules() {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
proxier.logger.Error(err, "nftables sync failed")
|
proxier.logger.Error(err, "nftables sync failed")
|
||||||
metrics.NFTablesSyncFailuresTotal.Inc()
|
metrics.NFTablesSyncFailuresTotal.Inc()
|
||||||
|
|
||||||
|
// staleChains is now incorrect since we didn't actually flush the
|
||||||
|
// chains in it. We can recompute it next time.
|
||||||
|
clear(proxier.staleChains)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
success = true
|
success = true
|
||||||
|
Loading…
Reference in New Issue
Block a user