Repository navigation
feat: Annotate edge NetworkServices with their load balancer - #913
Conversation
The gateway labels its per-listener counters with VIP, port and protocol only, and the edge NetworkService carried nothing naming the load balancer or listener it serves. A metrics pipeline had no way to attribute that traffic to its owner. The cell programming controller now writes the load balancer and listener names from the cell intent as annotations on the service it owns. It updates them on every reconcile, removes the listener annotation when the intent names none, and keeps annotations other writers set. These are annotations, not labels, because a load balancer name can be up to 253 characters and a label value allows 63. A label would make the service write fail and leave the load balancer unprogrammed. Fixes #888
565cc19 to
08a4e9c
Compare
|
Two independent reviewers re-reviewed head 08a4e9c and both agreed. pr-rereviewer: VERDICT merge. The co-author trailer blocker and the Resolves/Fixes nit are fixed at 08a4e9c, and the code diff from the previously reviewed head 565cc19 is empty. Remaining: nit, the commit subject is exactly 50 characters where the repository guide says under 50. pr-conventions-reviewer: VERDICT merge. Reach is limited to the operator's NLB cell programming controller, with no overlays and no collisions. Remaining: the same 50-character subject nit, which was left as is. An earlier pass had pr-adversary at merge (code and tests correct; the labels-versus-annotations deviation was settled and recorded on issue #888) and pr-conventions-reviewer at hold for the co-author trailer, since fixed. The reviewer reports' RAN lists were not passed to the agent that posted this comment, so they are not repeated here. Applied in the fix phase: the co-author trailer fix and the Resolves/Fixes wording. Nothing further was changed in this phase. CI at 08a4e9c is green. The e2e job first failed on vpcendpointslice-reachability-event, a known flake on main that passed on rerun (it also failed on main in runs 42994595394 and 43409484291). Auto-merge is enabled with the merge method, the only one the base ruleset used first. The ruleset requires one approving review including a code owner, so the PR still waits for a human approval. |
ecv
left a comment
There was a problem hiding this comment.
Approve.
Each served listener's NetworkService gets networking.datumapis.com/nlb-name and nlb-listener from the intent's Source.ParentName/ListenerName. It's one service per intent, so shared addresses and port ranges are carried by the intent, not mixed up.
- Project owner is not annotated: it is the service's namespace (and controller owner ref). The #9435 join must take project from the namespace, not from an annotation.
- Updates and removal are covered. The mutate func rewrites both keys on every reconcile through CreateOrUpdate, deletes an empty one, and keeps other annotations (tests for rename, clear, a >63-char name, and a foreign service left unannotated). Un-served or deleted intents delete the service, so the annotation dies with it.
- No hot loop: CreateOrUpdate skips the update when nothing changed. The map clone is not mutated in place.
- Removal test only clears the listener annotation; the parent-name delete branch is not exercised. Minor.
- Nothing here fixes infra#9442: a reused VIP/port by a service with no project labels still hits the stale 30m window in the metrics join. Because the annotations are only on the new NetworkService, #9435 can use them as the key (credit by current nlb-name + namespace, never by VIP/port history) to close #9442.
Follow-ups:
- Rename and removal are covered at the object level only, with no check that exported counters switch owner at the gateway.
Summary
The gateway counts each load balancer listener's traffic by VIP, port and protocol, but nothing on the edge says which load balancer or listener a counter belongs to.
Each edge NetworkService the operator writes now carries annotations naming its load balancer and listener, so a metrics pipeline can join the counters to their owner.
They're annotations rather than the labels the issue proposed. A load balancer name can run to 253 characters and a label value allows 63, so a label would fail the write and leave that load balancer unprogrammed.
Test plan
Fixes #888