refactor(operators): migrate k8s labels to agents.nanohype.dev/*#43
Merged
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 reservedagents.nanohype.dev/*prefix (already used by tenant-chart-base + the OTelagents.*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.godefines 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(thetenantNamespaceLabel+ NP marker),charts/tenantCR 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/enabledGitOps selector, theapp.kubernetes.io/managed-byvalue, the IAM tenants path.Verification
go build+go vet+ gofmt clean · controller unit tests green · tenant + bedrock-egress charts renderagents.nanohype.dev/*(helm lint clean) ·packages/clitypecheck clean · noeks-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).