Skip to content

feat: Annotate edge NetworkServices with their load balancer - #913

Merged
0xmc merged 1 commit into
mainfrom
feat/issue-888-nlb-service-labels
Nov 17, 2026
Merged

0xmc merged 1 commit into
mainfrom
feat/issue-888-nlb-service-labels

Conversation

@0xmc

@0xmc 0xmc commented Nov 17, 2026

Copy link
Copy Markdown
Contributor

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

  • A served listener's NetworkService names its load balancer and listener, including a name longer than 63 characters
  • Renaming a listener updates the annotation on the next reconcile, and other annotations survive
  • A NetworkService the operator doesn't own is left unannotated

Fixes #888

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
@0xmc
0xmc force-pushed the feat/issue-888-nlb-service-labels branch from 565cc19 to 08a4e9c Compare November 17, 2026 18:28
@0xmc
0xmc marked this pull request as ready for review November 17, 2026 19:18
@0xmc
0xmc requested a review from a team as a code owner November 17, 2026 19:18
@0xmc
0xmc enabled auto-merge November 17, 2026 19:18
@0xmc

0xmc commented Nov 17, 2026

Copy link
Copy Markdown
Contributor Author

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 ecv left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@0xmc
0xmc merged commit ef2cb87 into main Nov 17, 2026
10 of 11 checks passed
@0xmc
0xmc deleted the feat/issue-888-nlb-service-labels branch November 17, 2026 19:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Label edge NetworkServices with their load balancer and listener

2 participants