conditionally register nfacct metrics and ensure nfacct counters
If the nfacct sub-system is not available in the kernel then: 1. nfacct based metrics won't be registered. 2. proxier will not attempt to ensure the counters Signed-off-by: Daman Arora <aroradaman@gmail.com>
This commit is contained in:
@@ -299,8 +299,12 @@ func RegisterMetrics(mode kubeproxyconfig.ProxyMode) {
|
||||
|
||||
switch mode {
|
||||
case kubeproxyconfig.ProxyModeIPTables:
|
||||
legacyregistry.CustomMustRegister(iptablesCTStateInvalidDroppedMetricCollector)
|
||||
legacyregistry.CustomMustRegister(localhostNodePortsAcceptedMetricsCollector)
|
||||
if iptablesCTStateInvalidDroppedMetricCollector != nil {
|
||||
legacyregistry.CustomMustRegister(iptablesCTStateInvalidDroppedMetricCollector)
|
||||
}
|
||||
if localhostNodePortsAcceptedMetricsCollector != nil {
|
||||
legacyregistry.CustomMustRegister(localhostNodePortsAcceptedMetricsCollector)
|
||||
}
|
||||
legacyregistry.MustRegister(SyncFullProxyRulesLatency)
|
||||
legacyregistry.MustRegister(SyncPartialProxyRulesLatency)
|
||||
legacyregistry.MustRegister(IPTablesRestoreFailuresTotal)
|
||||
@@ -332,6 +336,7 @@ func newNFAcctMetricCollector(counter string, description *metrics.Desc) *nfacct
|
||||
client, err := nfacct.New()
|
||||
if err != nil {
|
||||
klog.ErrorS(err, "failed to initialize nfacct client")
|
||||
return nil
|
||||
}
|
||||
return &nfacctMetricCollector{
|
||||
client: client,
|
||||
|
||||
Reference in New Issue
Block a user