You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The end-to-end policy programming latency histograms awsnodeagent_policy_programming_latency_seconds and awsnodeagent_cluster_policy_programming_latency_seconds (added in #516) record large numbers of multi-minute observations on clusters whose dataplane is demonstrably healthy. Mechanism, confirmed against the code in both repos:
The Network Policy Controller stamps networking.k8s.aws/last-change-trigger-time on a PolicyEndpoint in setLastChangeTriggerTime() (pkg/policyendpoints/manager.go, added change timestamp in PE and CPE annotation amazon-network-policy-controller-k8s#213) only when processing a genuine change — but PolicyEndpoints are also rewritten at other times (background rewrites, mass rewrites during node churn) without the annotation being refreshed.
The agent's observePolicyProgrammingLatency() (controllers/policyendpoints_controller.go, emitting latency metrics based on PE and CPE updates in NPC #516) computes time.Since(triggerTime) and calls Observe() on every PE reconcile. The only guard is trackerStartTime (annotations predating agent start are skipped); there is no per-PE comparison against the previously-seen annotation value. Since every agent watches every PE, each rewrite of a PE carrying an old annotation produces one observation of (now − old annotation) per agent, landing in the top (≥300s / +Inf) buckets.
What you expected to happen:
An observation should be emitted only when a PE write actually carries a new trigger annotation: the agent should compare the annotation to the previously-seen value for that PE and skip unchanged ones. And/or the controller should refresh or clear the annotation on non-trigger rewrites so it never accompanies a write it did not trigger. kube-proxy's network_programming_duration_seconds handling of EndpointsLastChangeTriggerTime — which is cited as the pattern being followed — is the prior art: it only measures when the trigger time changes.
How to reproduce it (as minimally and precisely as possible):
What happened:
The end-to-end policy programming latency histograms
awsnodeagent_policy_programming_latency_secondsandawsnodeagent_cluster_policy_programming_latency_seconds(added in #516) record large numbers of multi-minute observations on clusters whose dataplane is demonstrably healthy. Mechanism, confirmed against the code in both repos:networking.k8s.aws/last-change-trigger-timeon a PolicyEndpoint insetLastChangeTriggerTime()(pkg/policyendpoints/manager.go, added change timestamp in PE and CPE annotation amazon-network-policy-controller-k8s#213) only when processing a genuine change — but PolicyEndpoints are also rewritten at other times (background rewrites, mass rewrites during node churn) without the annotation being refreshed.observePolicyProgrammingLatency()(controllers/policyendpoints_controller.go, emitting latency metrics based on PE and CPE updates in NPC #516) computestime.Since(triggerTime)and callsObserve()on every PE reconcile. The only guard is trackerStartTime (annotations predating agent start are skipped); there is no per-PE comparison against the previously-seen annotation value. Since every agent watches every PE, each rewrite of a PE carrying an old annotation produces one observation of (now − old annotation) per agent, landing in the top (≥300s / +Inf) buckets.What you expected to happen:
An observation should be emitted only when a PE write actually carries a new trigger annotation: the agent should compare the annotation to the previously-seen value for that PE and skip unchanged ones. And/or the controller should refresh or clear the annotation on non-trigger rewrites so it never accompanies a write it did not trigger. kube-proxy's network_programming_duration_seconds handling of EndpointsLastChangeTriggerTime — which is cited as the pattern being followed — is the prior art: it only measures when the trigger time changes.
How to reproduce it (as minimally and precisely as possible):
Environment:
Kubernetes version (use kubectl version): 1.35
CNI Version: 1.22.3
Network Policy Agent Version: 1.3.7