mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-30 15:05:27 +00:00
fix "Iptables" -> "IPTables" in metrics variable names
This commit is contained in:
parent
ba57fd7c84
commit
1823de063b
@ -451,7 +451,7 @@ func CleanupLeftovers(ctx context.Context, ipt utiliptables.Interface) (encounte
|
||||
err = ipt.Restore(utiliptables.TableNAT, natLines, utiliptables.NoFlushTables, utiliptables.RestoreCounters)
|
||||
if err != nil {
|
||||
logger.Error(err, "Failed to execute iptables-restore", "table", utiliptables.TableNAT)
|
||||
metrics.IptablesRestoreFailuresTotal.Inc()
|
||||
metrics.IPTablesRestoreFailuresTotal.Inc()
|
||||
encounteredError = true
|
||||
}
|
||||
}
|
||||
@ -478,7 +478,7 @@ func CleanupLeftovers(ctx context.Context, ipt utiliptables.Interface) (encounte
|
||||
// Write it.
|
||||
if err := ipt.Restore(utiliptables.TableFilter, filterLines, utiliptables.NoFlushTables, utiliptables.RestoreCounters); err != nil {
|
||||
logger.Error(err, "Failed to execute iptables-restore", "table", utiliptables.TableFilter)
|
||||
metrics.IptablesRestoreFailuresTotal.Inc()
|
||||
metrics.IPTablesRestoreFailuresTotal.Inc()
|
||||
encounteredError = true
|
||||
}
|
||||
}
|
||||
@ -818,7 +818,7 @@ func (proxier *Proxier) syncProxyRules() {
|
||||
proxier.logger.Info("Sync failed", "retryingTime", proxier.syncPeriod)
|
||||
proxier.syncRunner.RetryAfter(proxier.syncPeriod)
|
||||
if tryPartialSync {
|
||||
metrics.IptablesPartialRestoreFailuresTotal.Inc()
|
||||
metrics.IPTablesPartialRestoreFailuresTotal.Inc()
|
||||
}
|
||||
// proxier.serviceChanges and proxier.endpointChanges have already
|
||||
// been flushed, so we've lost the state needed to be able to do
|
||||
@ -1483,10 +1483,10 @@ func (proxier *Proxier) syncProxyRules() {
|
||||
"-j", "ACCEPT",
|
||||
)
|
||||
|
||||
metrics.IptablesRulesTotal.WithLabelValues(string(utiliptables.TableFilter)).Set(float64(proxier.filterRules.Lines()))
|
||||
metrics.IptablesRulesLastSync.WithLabelValues(string(utiliptables.TableFilter)).Set(float64(proxier.filterRules.Lines()))
|
||||
metrics.IptablesRulesTotal.WithLabelValues(string(utiliptables.TableNAT)).Set(float64(proxier.natRules.Lines() + skippedNatRules.Lines() - deletedChains))
|
||||
metrics.IptablesRulesLastSync.WithLabelValues(string(utiliptables.TableNAT)).Set(float64(proxier.natRules.Lines() - deletedChains))
|
||||
metrics.IPTablesRulesTotal.WithLabelValues(string(utiliptables.TableFilter)).Set(float64(proxier.filterRules.Lines()))
|
||||
metrics.IPTablesRulesLastSync.WithLabelValues(string(utiliptables.TableFilter)).Set(float64(proxier.filterRules.Lines()))
|
||||
metrics.IPTablesRulesTotal.WithLabelValues(string(utiliptables.TableNAT)).Set(float64(proxier.natRules.Lines() + skippedNatRules.Lines() - deletedChains))
|
||||
metrics.IPTablesRulesLastSync.WithLabelValues(string(utiliptables.TableNAT)).Set(float64(proxier.natRules.Lines() - deletedChains))
|
||||
|
||||
// Sync rules.
|
||||
proxier.iptablesData.Reset()
|
||||
@ -1518,7 +1518,7 @@ func (proxier *Proxier) syncProxyRules() {
|
||||
} else {
|
||||
proxier.logger.Error(err, "Failed to execute iptables-restore")
|
||||
}
|
||||
metrics.IptablesRestoreFailuresTotal.Inc()
|
||||
metrics.IPTablesRestoreFailuresTotal.Inc()
|
||||
return
|
||||
}
|
||||
success = true
|
||||
|
@ -409,7 +409,7 @@ func countRules(logger klog.Logger, tableName utiliptables.Table, ruleData strin
|
||||
}
|
||||
|
||||
func countRulesFromMetric(logger klog.Logger, tableName utiliptables.Table) int {
|
||||
numRulesFloat, err := testutil.GetGaugeMetricValue(metrics.IptablesRulesTotal.WithLabelValues(string(tableName)))
|
||||
numRulesFloat, err := testutil.GetGaugeMetricValue(metrics.IPTablesRulesTotal.WithLabelValues(string(tableName)))
|
||||
if err != nil {
|
||||
logger.Error(err, "metrics are not registered?")
|
||||
return -1
|
||||
@ -418,7 +418,7 @@ func countRulesFromMetric(logger klog.Logger, tableName utiliptables.Table) int
|
||||
}
|
||||
|
||||
func countRulesFromLastSyncMetric(logger klog.Logger, tableName utiliptables.Table) int {
|
||||
numRulesFloat, err := testutil.GetGaugeMetricValue(metrics.IptablesRulesLastSync.WithLabelValues(string(tableName)))
|
||||
numRulesFloat, err := testutil.GetGaugeMetricValue(metrics.IPTablesRulesLastSync.WithLabelValues(string(tableName)))
|
||||
if err != nil {
|
||||
logger.Error(err, "metrics are not registered?")
|
||||
return -1
|
||||
@ -4143,7 +4143,7 @@ func TestHealthCheckNodePortWhenTerminating(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestProxierMetricsIptablesTotalRules(t *testing.T) {
|
||||
func TestProxierMetricsIPTablesTotalRules(t *testing.T) {
|
||||
logger, _ := klogtesting.NewTestContext(t)
|
||||
ipt := iptablestest.NewFake()
|
||||
fp := NewFakeProxier(ipt)
|
||||
@ -6357,7 +6357,7 @@ func TestSyncProxyRulesRepeated(t *testing.T) {
|
||||
if fp.needFullSync {
|
||||
t.Fatalf("Proxier unexpectedly already needs a full sync?")
|
||||
}
|
||||
partialRestoreFailures, err := testutil.GetCounterMetricValue(metrics.IptablesPartialRestoreFailuresTotal)
|
||||
partialRestoreFailures, err := testutil.GetCounterMetricValue(metrics.IPTablesPartialRestoreFailuresTotal)
|
||||
if err != nil {
|
||||
t.Fatalf("Could not get partial restore failures metric: %v", err)
|
||||
}
|
||||
@ -6391,7 +6391,7 @@ func TestSyncProxyRulesRepeated(t *testing.T) {
|
||||
if !fp.needFullSync {
|
||||
t.Errorf("Proxier did not fail on previous partial resync?")
|
||||
}
|
||||
updatedPartialRestoreFailures, err := testutil.GetCounterMetricValue(metrics.IptablesPartialRestoreFailuresTotal)
|
||||
updatedPartialRestoreFailures, err := testutil.GetCounterMetricValue(metrics.IPTablesPartialRestoreFailuresTotal)
|
||||
if err != nil {
|
||||
t.Errorf("Could not get partial restore failures metric: %v", err)
|
||||
}
|
||||
|
@ -1445,7 +1445,7 @@ func (proxier *Proxier) syncProxyRules() {
|
||||
} else {
|
||||
proxier.logger.Error(err, "Failed to execute iptables-restore", "rules", proxier.iptablesData.Bytes())
|
||||
}
|
||||
metrics.IptablesRestoreFailuresTotal.Inc()
|
||||
metrics.IPTablesRestoreFailuresTotal.Inc()
|
||||
return
|
||||
}
|
||||
for name, lastChangeTriggerTimes := range endpointUpdateResult.LastChangeTriggerTimes {
|
||||
|
@ -139,9 +139,9 @@ var (
|
||||
},
|
||||
)
|
||||
|
||||
// IptablesRestoreFailuresTotal is the number of iptables restore failures that the proxy has
|
||||
// IPTablesRestoreFailuresTotal is the number of iptables restore failures that the proxy has
|
||||
// seen.
|
||||
IptablesRestoreFailuresTotal = metrics.NewCounter(
|
||||
IPTablesRestoreFailuresTotal = metrics.NewCounter(
|
||||
&metrics.CounterOpts{
|
||||
Subsystem: kubeProxySubsystem,
|
||||
Name: "sync_proxy_rules_iptables_restore_failures_total",
|
||||
@ -150,9 +150,9 @@ var (
|
||||
},
|
||||
)
|
||||
|
||||
// IptablesPartialRestoreFailuresTotal is the number of iptables *partial* restore
|
||||
// IPTablesPartialRestoreFailuresTotal is the number of iptables *partial* restore
|
||||
// failures (resulting in a fall back to a full restore) that the proxy has seen.
|
||||
IptablesPartialRestoreFailuresTotal = metrics.NewCounter(
|
||||
IPTablesPartialRestoreFailuresTotal = metrics.NewCounter(
|
||||
&metrics.CounterOpts{
|
||||
Subsystem: kubeProxySubsystem,
|
||||
Name: "sync_proxy_rules_iptables_partial_restore_failures_total",
|
||||
@ -161,9 +161,9 @@ var (
|
||||
},
|
||||
)
|
||||
|
||||
// IptablesRulesTotal is the total number of iptables rules that the iptables
|
||||
// IPTablesRulesTotal is the total number of iptables rules that the iptables
|
||||
// proxy has installed.
|
||||
IptablesRulesTotal = metrics.NewGaugeVec(
|
||||
IPTablesRulesTotal = metrics.NewGaugeVec(
|
||||
&metrics.GaugeOpts{
|
||||
Subsystem: kubeProxySubsystem,
|
||||
Name: "sync_proxy_rules_iptables_total",
|
||||
@ -173,9 +173,9 @@ var (
|
||||
[]string{"table"},
|
||||
)
|
||||
|
||||
// IptablesRulesLastSync is the number of iptables rules that the iptables proxy
|
||||
// IPTablesRulesLastSync is the number of iptables rules that the iptables proxy
|
||||
// updated in the last sync.
|
||||
IptablesRulesLastSync = metrics.NewGaugeVec(
|
||||
IPTablesRulesLastSync = metrics.NewGaugeVec(
|
||||
&metrics.GaugeOpts{
|
||||
Subsystem: kubeProxySubsystem,
|
||||
Name: "sync_proxy_rules_iptables_last",
|
||||
@ -259,17 +259,17 @@ func RegisterMetrics(mode kubeproxyconfig.ProxyMode) {
|
||||
case kubeproxyconfig.ProxyModeIPTables:
|
||||
legacyregistry.MustRegister(SyncFullProxyRulesLatency)
|
||||
legacyregistry.MustRegister(SyncPartialProxyRulesLatency)
|
||||
legacyregistry.MustRegister(IptablesRestoreFailuresTotal)
|
||||
legacyregistry.MustRegister(IptablesPartialRestoreFailuresTotal)
|
||||
legacyregistry.MustRegister(IptablesRulesTotal)
|
||||
legacyregistry.MustRegister(IptablesRulesLastSync)
|
||||
legacyregistry.MustRegister(IPTablesRestoreFailuresTotal)
|
||||
legacyregistry.MustRegister(IPTablesPartialRestoreFailuresTotal)
|
||||
legacyregistry.MustRegister(IPTablesRulesTotal)
|
||||
legacyregistry.MustRegister(IPTablesRulesLastSync)
|
||||
|
||||
case kubeproxyconfig.ProxyModeIPVS:
|
||||
legacyregistry.MustRegister(IptablesRestoreFailuresTotal)
|
||||
legacyregistry.MustRegister(IPTablesRestoreFailuresTotal)
|
||||
|
||||
case kubeproxyconfig.ProxyModeNFTables:
|
||||
// FIXME: should not use the iptables-specific metric
|
||||
legacyregistry.MustRegister(IptablesRestoreFailuresTotal)
|
||||
legacyregistry.MustRegister(IPTablesRestoreFailuresTotal)
|
||||
|
||||
case kubeproxyconfig.ProxyModeKernelspace:
|
||||
// currently no winkernel-specific metrics
|
||||
|
@ -1620,7 +1620,7 @@ func (proxier *Proxier) syncProxyRules() {
|
||||
err = proxier.nftables.Run(context.TODO(), tx)
|
||||
if err != nil {
|
||||
proxier.logger.Error(err, "nftables sync failed")
|
||||
metrics.IptablesRestoreFailuresTotal.Inc()
|
||||
metrics.IPTablesRestoreFailuresTotal.Inc()
|
||||
return
|
||||
}
|
||||
success = true
|
||||
|
Loading…
Reference in New Issue
Block a user