Skip to content

Copy resolver context labels and description to its managed zone - #456

Merged
scotwells merged 5 commits into
mainfrom
feat/managed-zone-context-labels
Nov 3, 2026
Merged

scotwells merged 5 commits into
mainfrom
feat/managed-zone-context-labels

Conversation

@scotwells

@scotwells scotwells commented Nov 3, 2026 •

Copy link
Copy Markdown
Contributor

Requested by Scot Schuchert-Wells

What

A resolver context's managed zone and zone association now carry:

  • dns.networking.miloapis.com/managed: "true" (as before) and the Kubernetes well-known app.kubernetes.io/managed-by: dns.networking.miloapis.com;
  • the context labels the context names, comma separated, in its dns.networking.miloapis.com/managed-object-labels annotation;
  • the context's kubernetes.io/description.

Existing zones and associations are updated on the next pass. Copied labels and the description are added or corrected, never removed. A failed write is logged and never stops the pass, and the association is left alone while its zone is being deleted.

Only listed labels are copied, so labels that track the context itself (for example GitOps instance labels) never select the managed objects.

Why

Whoever creates a resolver context can then say what its zone is for, and clients can show or select zones by it without following owner references.

Related: datum-cloud/enhancements#921

Companion PRs: datum-cloud/network-services-operator#851, #456, datum-cloud/cloud-portal#1788

The managed zone and association now carry the context's labels next to
the managed marker, and existing ones are labelled on the next pass, so
the creator of a context can say what its zone is for.
Copy only the labels a context lists in the
dns.networking.miloapis.com/managed-object-labels annotation, so labels
that track the context (GitOps) never select its managed zone. A failed
label write is logged instead of stopping the pass, and the association
is left alone while its zone is being deleted.
Managed zones and associations also carry the Kubernetes well-known
managed-by label, valued dns.networking.miloapis.com.
The context's kubernetes.io/description annotation is copied to the
managed zone and association, so clients show what the zone is for.
@scotwells scotwells changed the title Copy resolver context labels to its managed zone Copy resolver context labels and description to its managed zone Nov 3, 2026
@scotwells
scotwells marked this pull request as ready for review November 3, 2026 17:57
@scotwells
scotwells requested a review from a team as a code owner November 3, 2026 17:57

@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.

Request changes.

The failing Run on Ubuntu check is the linter, and this PR causes it: task lint runs with --new-from-merge-base=origin/main, so it flags only this PR's lines, and main's CI at a3b3a88 is green. Both failing runs (126095605585, 126095650212) show the same two errors and no test failure, so TestTrustedPROXYDestinationSurvivesTCP is not involved.

  • internal/internaldns/controlplane/context_reconciler.go:804: goconst, the string "true" now has 3 occurrences. Make it a constant.
  • internal/internaldns/controlplane/context_reconciler.go:830: revive import-shadowing, the local labels shadows an imported package name. Rename it.
  • Behavior reads correctly otherwise: only labels the context lists are copied, managed and managed-by are always forced, labels and the description are added or corrected and never removed, and writes on a deleting zone are skipped.

Follow-ups:

  • app.kubernetes.io/managed-by is now stamped on every existing managed zone and association; confirm nothing selects on that label before it ships.
  • A failed metadata write is only logged, so a persistent webhook rejection on the zone would go unnoticed; consider an event.

@scotwells
scotwells requested a review from ecv November 3, 2026 19:28

@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.

a8a2541 fixes both lint findings that held this: "true" becomes managedObjectValue, and the local labels that shadowed the import is renamed objLabels at every use. Behaviour is unchanged, and CI is green at the head.

Follow-ups:

  • The earlier ones stand: confirm nothing selects on app.kubernetes.io/managed-by before every existing managed zone gets stamped with it, and surface a persistently failing metadata patch as an event rather than a log line.

@kevwilliams kevwilliams 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.

Checked the annotation and description keys match network-services-operator#851, managed and managed-by can't be overridden by listed labels, and pre-existing zones are patched.

@scotwells
scotwells merged commit 59657cb into main Nov 3, 2026
24 checks passed
@scotwells
scotwells deleted the feat/managed-zone-context-labels branch November 3, 2026 19:44
scotwells added a commit to datum-cloud/cloud-portal that referenced this pull request Nov 3, 2026
<!-- claude-projects-attribution: {"github_login":"scotwells"} -->
_Requested by **Scot Schuchert-Wells**_

## Description

Private DNS zones (`spec.visibility: Private`, such as each VPC's
`datum.internal` zone) never get public nameservers, so the DNS list
showed "Looking up..." for them forever.

- The DNS Host column shows "Private" for private zones instead of the
spinner.
- The zone page hides the Nameservers tab for private zones.

Which VPC a zone serves shows up in the existing Description column: the
operator changes linked below set the zone's `kubernetes.io/description`
to "Private DNS for the ‹network› VPC".

Related: datum-cloud/enhancements#921

Companion PRs: datum-cloud/network-services-operator#851,
datum-cloud/dns-operator#456, #1788
@scotwells scotwells mentioned this pull request Nov 4, 2026
5 tasks
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.

3 participants