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:
Daman Arora
2024-07-03 17:57:11 +05:30
parent 75b18b86dd
commit 33bac685a7
2 changed files with 8 additions and 3 deletions

View File

@@ -280,7 +280,7 @@ func NewProxier(ctx context.Context,
serviceHealthServer := healthcheck.NewServiceHealthServer(hostname, recorder, nodePortAddresses, healthzServer)
nfacctRunner, err := nfacct.New()
if err != nil {
logger.Error(err, "Failed to create nfacct runner")
logger.Error(err, "Failed to create nfacct runner, nfacct based metrics won't be available")
}
proxier := &Proxier{