proxier: track metrics before conntrack cleaning

This commit is contained in:
Daman 2023-03-02 20:56:05 +05:30
parent b23cb97704
commit 42a91c29e5

View File

@ -1526,6 +1526,9 @@ func (proxier *Proxier) syncProxyRules() {
klog.ErrorS(err, "Error syncing healthcheck endpoints") klog.ErrorS(err, "Error syncing healthcheck endpoints")
} }
metrics.SyncProxyRulesNoLocalEndpointsTotal.WithLabelValues("internal").Set(float64(proxier.serviceNoLocalEndpointsInternal.Len()))
metrics.SyncProxyRulesNoLocalEndpointsTotal.WithLabelValues("external").Set(float64(proxier.serviceNoLocalEndpointsExternal.Len()))
// Finish housekeeping. // Finish housekeeping.
// Clear stale conntrack entries for UDP Services, this has to be done AFTER the ipvs rules are programmed. // Clear stale conntrack entries for UDP Services, this has to be done AFTER the ipvs rules are programmed.
// TODO: these could be made more consistent. // TODO: these could be made more consistent.
@ -1544,9 +1547,6 @@ func (proxier *Proxier) syncProxyRules() {
} }
klog.V(4).InfoS("Deleting stale endpoint connections", "endpoints", endpointUpdateResult.StaleEndpoints) klog.V(4).InfoS("Deleting stale endpoint connections", "endpoints", endpointUpdateResult.StaleEndpoints)
proxier.deleteEndpointConnections(endpointUpdateResult.StaleEndpoints) proxier.deleteEndpointConnections(endpointUpdateResult.StaleEndpoints)
metrics.SyncProxyRulesNoLocalEndpointsTotal.WithLabelValues("internal").Set(float64(proxier.serviceNoLocalEndpointsInternal.Len()))
metrics.SyncProxyRulesNoLocalEndpointsTotal.WithLabelValues("external").Set(float64(proxier.serviceNoLocalEndpointsExternal.Len()))
} }
// writeIptablesRules write all iptables rules to proxier.natRules or proxier.FilterRules that ipvs proxier needed // writeIptablesRules write all iptables rules to proxier.natRules or proxier.FilterRules that ipvs proxier needed