Skip to content

refactor(operators): migrate k8s labels to agents.nanohype.dev/*#43

Merged
stxkxs merged 1 commit into
mainfrom
label-prefix-migration
Jun 16, 2026
Merged

refactor(operators): migrate k8s labels to agents.nanohype.dev/*#43
stxkxs merged 1 commit into
mainfrom
label-prefix-migration

Conversation

@stxkxs

@stxkxs stxkxs commented Jun 16, 2026

Copy link
Copy Markdown
Member

Closes the bulk of #42. The operator stamped eks-agent-platform/* on every object it creates — the one place the stack diverged from the resource-tagging standard, which renders agent/tenant identity under the reserved agents.nanohype.dev/* prefix (already used by tenant-chart-base + the OTel agents.* namespace). This migrates the whole surface, key-for-key.

Atomic rename, not a dual-write — there's no live EKS cluster, so there's no in-place state to migrate around; everything comes up with the new labels on the next deploy.

The fix

A new operators/internal/controller/labels.go defines each of the 12 keys once. Every reconciler now references the constant for both an object's metadata label and the selector that matches it (NetworkPolicy podSelectors, the immutable Deployment/Service selectors) — so a label and its selector can no longer drift, which was the real risk (they were scattered inline literals). The investigation confirmed every label-that-is-also-a-selector is set in the same reconcile function as its selector, so sharing one constant is sufficient + safe.

Migrated in lockstep within this repo: charts/bedrock-egress (the tenantNamespaceLabel + NP marker), charts/tenant CR labels, the agentctl + packages/cli (TS) scaffolders, the blank-tenant example, the conformance assertion, and the runbook/onboarding CLI examples.

Out of scope (unchanged): the cluster-level eks-agent-platform/enabled GitOps selector, the app.kubernetes.io/managed-by value, the IAM tenants path.

Verification

go build + go vet + gofmt clean · controller unit tests green · tenant + bedrock-egress charts render agents.nanohype.dev/* (helm lint clean) · packages/cli typecheck clean · no eks-agent-platform/<key> label literal remains.

Companion

cloudgov's platform audit (the only external reader of these labels) is updated separately with an old-key fallback (tolerant — it reads labels off fetched namespaces, doesn't select by them).

The operator stamped eks-agent-platform/* on every object it creates — the one
place the stack diverged from the resource-tagging standard, which renders
agent/tenant identity under the reserved agents.nanohype.dev/* prefix (already
used by tenant-chart-base + the OTel agents.* namespace). This migrates the whole
surface, key-for-key, to that prefix.

No live cluster exists, so this is a clean atomic rename rather than a dual-write:
every object comes up with the new labels on the next deploy. It's anchored on a
new operators/internal/controller/labels.go defining each of the 12 keys
(platform, tenant, persona, fleet, agent, agent-fleet, agentsandbox, sandboxpool,
metrics-bridge, eval-suite, pass-threshold, model-family) once. Every reconciler
now references the constant for BOTH an object's metadata label AND the selector
that matches it (NetworkPolicy podSelectors, the immutable Deployment/Service
selectors) — so a label and its selector can no longer drift, which was the real
risk (they were scattered inline literals).

Migrated in lockstep within this repo: charts/bedrock-egress (the
tenantNamespaceLabel + the NP marker) and charts/tenant CR-metadata labels; the
agentctl scaffolder, the packages/cli (TS) scaffolder, and the blank-tenant
example; the conformance test assertion + the runbook/onboarding CLI examples.

Out of scope (unchanged): the cluster-level eks-agent-platform/enabled GitOps
selector, the app.kubernetes.io/managed-by value, and the IAM tenants path.

Verified: go build + vet + gofmt clean; controller unit tests green; the tenant +
bedrock-egress charts render agents.nanohype.dev/* (helm lint clean); packages/cli
typecheck clean; no eks-agent-platform/<key> label literal remains. cloudgov's
platform audit (the external reader) is updated in a companion PR with an old-key
fallback.
@stxkxs stxkxs merged commit 161b12b into main Jun 16, 2026
9 of 12 checks passed
@stxkxs stxkxs deleted the label-prefix-migration branch June 16, 2026 01:20
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.

1 participant