Commit Graph
15 Commits
Author SHA1 Message Date
Terry Howe 8eed5173c8 feat(deploy)!: move the greenfield overlays and the release namespace to nvke-controller (#1889)
* feat(deploy)!: move the greenfield overlays and the release namespace to nvke-controller

This moves them, and with them the persisted identifiers a site carries:
the Helm release and its namespace, the database, and the Temporal
namespace and task queue.

In the three greenfield stacks: nameOverride, fullnameOverride,
namespaceOverride, serviceAccount.name, serviceMonitor.name,
appDb.dbName, the Temporal namespace and queue, the field managers and
the managed-by values, tracing.serviceName, and the objects the stacks
render around them -- the Namespace manifest, the Postgres CREATE
DATABASE, the SPIRE admin ID and ClusterSPIFFEID namespace selectors,
the auth-dev ConfigMap's namespace, the CAPD RBAC ClusterRole and its
subject, and the spire-client probe URL.

Consumers that move with it: controller/Tiltfile (release name,
namespace, SPIRE admin path and the string-matched resource names),
deploy/check-site.sh, the e2e site helpers and their collect script,
cli/internal/bootstrap/controllerdeploy (including the NodePort Service
nvke-controller-external), cli/internal/deploypath's admin path,
management-engine/hack/nvke-controller.sh, and the CI lane scripts.

The discovery paths search the new name first and keep the old one:
nvkectl's authConfigNamespaces, nvke-token.sh, nvke-auth-demo.sh and
dev-env-spire.sh now try nvke-controller, then nke-controller, then
cloud-workflow-engine. The reference health dashboard matches all three
workload names, and Tilt's preflight refuses to take over a cluster
that still runs the nke-controller release rather than failing later.

The published image keeps its name per #1554 decision 2, as do the
nke-controller-config ConfigMap and the nke-controller-chart release
artifact; hack/name-check-allowlist.txt now carries one entry per
reason rather than one blanket token.

Refs #1861, #1554, #1496, #1818

Signed-off-by: Terry Howe <thowe@nvidia.com>

* fix: address review feedback

Name nke-controller as the intermediate namespace in the authentication
docs, matching authConfigNamespaces, and restore the legacy node-agent
audience in the exchange mock's test.

Signed-off-by: Terry Howe <thowe@nvidia.com>

* fix: address review feedback

Signed-off-by: Terry Howe <thowe@nvidia.com>

* fix(e2e): point the nico bootstrap lane at the nvke-controller namespace

The nico lane still asserted the tenant credentials Secret landed in
nke-controller, so both e2e (nico) jobs failed after the rename.

Signed-off-by: Terry Howe <thowe@nvidia.com>

* fix(deploy): carry the nvke-controller rename into the rebased files

The rebase onto main replayed the rename over two files that gained
nke-controller references after the branch was cut: the management-engine
dev overlay, which succeeds the hack script this branch had edited and
was removed in #1918, and an API-authentication example added in #1935.

Refs #1861

Signed-off-by: Terry Howe <thowe@nvidia.com>

* fix: address review feedback

Continue namespace discovery past a Forbidden lookup in nvke-token.sh and
nvke-auth-demo.sh. --ignore-not-found suppresses absence, not denial, so a
kubeconfig scoped to nke-controller alone died on the nvke-controller probe
before reaching the namespace it can read -- the migration case this branch
adds. Keep the first denial, try the remaining candidates, and fail with it
only when none was readable, since falling back to cloud-workflow-engine
needs a confirmed absence.

Refs #1861

Signed-off-by: Terry Howe <thowe@nvidia.com>

---------

Signed-off-by: Terry Howe <thowe@nvidia.com>
2026-10-29 08:17:40 -06:00
Terry Howe 589d922c83 feat(chart): make the tenant RBAC ConfigMap name a value and move it to nvke (#1891)
* feat(chart): make the tenant RBAC ConfigMap name a value and move it to nvke

The nke-rbac ConfigMap name was a literal in two templates and a compiled
constant in controller/internal/nvkerbac, so a site could not keep it while the
chart's defaults moved. rbacConfigMap.name now drives the ConfigMap, the Role
and RoleBinding that grant get on it, and that Role's resourceNames, and the
controller reads it from rbacConfigMapName in nvke-controller-config rather
than from the constant. The default is nvke-rbac; a site installed before the
value pins nke-rbac, which is also what the Go fallback resolves to, so a
binary upgrade alone never moves a site that has not pinned.

The Role's resourceNames is the entry that matters: a ConfigMap the Role does
not name renders clean, installs clean, and is then denied at reconcile time,
leaving tenant RBAC unapplied. check_pinnable_names now asserts all four
consumers plus the rendered config key follow the value together.

nvkerbac.Source carries the namespace and the name as one value, because a name
resolved against the wrong namespace silently reads nothing — and a missing
read degrades the reserved-subject control that stops a fleet-wide OIDC
provider claiming an NVKE identity.

Closes #1862

Signed-off-by: Terry Howe <thowe@nvidia.com>

* fix(chart): follow rbacConfigMap.name in the RBAC and identity assertions

chart-rbac-check looked up a literal nke-rbac ConfigMap and failed once the
default moved. It asserts what the manifest grants, not what it is called, so
it now renders with rbacConfigMap.name set and resolves the ConfigMap by that;
moving the default again cannot break it.

chart-identity-assertions.py had the same literal in two scenario-scoped
places. Both passed only because the legacy scenario pins the old name and the
default scenario renders no RBAC ConfigMap at all, so the namespace and SPIFFE
subject checks silently skipped a default render. Both now read the scenario's
own name, and each scenario asserts rbacConfigMapName in its rendered config.

Signed-off-by: Terry Howe <thowe@nvidia.com>

* fix(chart): quote the rendered RBAC ConfigMap name

rbacConfigMap.name is operator-supplied, and a DNS-1123-valid name YAML 1.1
reads as another scalar type (n, y, true, off) rendered as a bare scalar: the
ConfigMap metadata.name and the Role resourceNames entry both became booleans
and the install failed. Quote both. The Role and RoleBinding names interpolate
after controller.fullname and a dash, so they are already strings.

Signed-off-by: Terry Howe <thowe@nvidia.com>

---------

Signed-off-by: Terry Howe <thowe@nvidia.com>
2026-10-28 16:54:03 -04:00
Terry Howe 6f84d0e01b feat(chart)!: move the remaining chart names, mount paths and filenames to nvke (#1818)
* refactor(controller): move the controller pod's mount paths to /etc/nvke

The controller pod mounts its authentication ConfigMap, its controller-config
ConfigMap and its node-agent client identity under /etc/nke. Nothing outside
the pod observes any of them: the chart owns both the mount and the path it
joins into AUTH_CONFIG_PATH and CONTROLLER_CONFIG_PATH, and the client
identity paths are compiled constants the chart's volumeMounts match. So the
three move together with no values key and nothing for an existing site to
pin -- an upgraded pod simply mounts them one directory over.

Moved: /etc/nvke/auth, /etc/nvke/controller-config,
/etc/nvke/node-agent-client-tls and the e2e mock's /etc/nvke/dsx-identity.

Not moved: the node-side paths (/etc/nke/spire.env, /etc/nke/trust-bundle.pem,
/etc/nke/controller-ca.crt, /etc/default/nke-agent). Those are the node
contract, they are chosen per node from the agent's version, and they belong
to #1497.

While here, chart-node-agent-auth-assertions.sh asserted the absence of
`mountPath: /etc/nke/node-agent-tls`, a path the chart never rendered under
either name, so the check could not fail. It now names the real mount.

Related: #1554, #1496
Signed-off-by: Terry Howe <thowe@nvidia.com>

* feat(chart)!: default the authentication ConfigMap to nvke-auth-config

apiAuth.configMap.name was already a value an install can pin, so this moves
only the default. A new install mounts nvke-auth-config; an install that
predates the rename keeps nke-auth-config by pinning the key, which
chart-legacy-pinned-values.yaml now carries and chart-auth-assertions.sh now
proves.

The consumer moved first. nvkectl discovers the API audience by reading this
ConfigMap, and the name was a compiled constant, so flipping the default alone
would have left one nvkectl unable to talk to the other kind of site.
cli/internal/auth now searches both names in every controller namespace --
greenfield name first, pinned legacy name second -- in the same shape it
already searched the two namespaces, because a site that pinned one of the two
need not have pinned the other.

Also moved with it, all of them internally consistent and none observable
outside this repository: the e2e authtoken constant and the nvke-auth-dev
scaffolding that creates the ConfigMap the suite reads, the two e2e copies of
it, and the pod-internal volume names (nke-auth-config, nke-controller-config)
in deployment.yaml.

nvke-token.sh and nvke-auth-demo.sh take NKE_AUTH_CONFIGMAP, defaulting to the
new name, alongside the NKE_CONTROLLER_CONFIGMAP that #1769 added.

The chart's two env-refusal messages named nke-controller-config literally and
so went stale whenever the value moved. They now interpolate
controller.controllerConfig.name and say whatever the install configured.

Related: #1554, #1496
Signed-off-by: Terry Howe <thowe@nvidia.com>

* feat(chart)!: name the chart nvke-controller

Chart.yaml's name is the last path segment of the OCI repository helm pushes
to, so this moves the published GHCR chart from
ghcr.io/dsx-ai-factory/nvke/charts/nke-controller to .../charts/nvke-controller
and the packaged tarball with it. It is an artifact-location change: what an
install renders comes from nameOverride, not from here.

chart-publish-nvcr.yml rewrites this line with an anchored sed before pushing,
so its anchor moves too -- left behind, the rename would silently not apply and
the chart would push to NVCR under whatever name Chart.yaml happened to carry.
NVCR already publishes as nvke-controller-chart and is otherwise unaffected.

malware-backfill.yml pulls the chart by path to scan published tags, including
tags that predate this rename. It already chained fallbacks for the two earlier
chart renames; the new name goes at the front of that chain.

Not moved, deliberately:

- image.repository. #1554 decision 2 settled that the chart moves and the image
  does not, so ghcr.io/dsx-ai-factory/nvke/nke-controller and the sed in
  chart-publish.yml that pins it stay as they are.
- `component: nke-controller-chart` in the record-digest step. That is a key in
  the release manifest, read outside this repository, and nothing in #1554
  calls for moving it.

Related: #1554, #1496
Signed-off-by: Terry Howe <thowe@nvidia.com>

* feat(deploy)!: rename the OIDC upstream CA Issuer to nvke-oidc-upstream-ca

The cert-manager Issuer that signs the OIDC discovery provider's leaf serving
certificate. #1554 lists it as a Secret; it is an Issuer -- the Secret it reads
is oidc-provider-upstream-ca and carries no nke.

Renaming the Issuer is safe: spec.ca.secretName is unchanged, so the renamed
Issuer signs with the same CA key, and nothing a tenant holds is derived from
the Issuer's name. All ten references move together (deploy/nico, both e2e
stacks, helm-values/spire.yaml, deploy/k8s, the Tiltfile and the identity
exchange mock), so the issuerRef never dangles.

NOT changed, and it needs a decision before anyone does: the CA subject
(commonName "NKE OIDC Upstream CA", OU "NKE") on the Certificate in the same
file. #1554 wants it moved "for new sites only", but these items are what
`nvkectl ... install` applies, and the file's own comment says any subject
change forces a re-issue with a new private key, which invalidates every
tenant's embedded trust anchor. Nothing here distinguishes a new site from an
existing one re-running install, so moving the subject would re-key the CA
under an existing site. That gate has to exist first.

Related: #1554, #1496
Signed-off-by: Terry Howe <thowe@nvidia.com>

* refactor: rename the nke-prefixed chart templates and deploy manifests

Filenames only. Nothing these files render changes: Helm takes no object name
from a template's filename, and the two renamed Go files keep package
nvkerbac and every identifier in it.

  templates/nke-rbac.yaml             -> templates/nvke-rbac.yaml
  templates/rbac-nke-system.yaml      -> templates/rbac-nvke-system.yaml
  deploy/k8s/nke-auth-dev.yaml        -> deploy/k8s/nvke-auth-dev.yaml
  deploy/k8s/nke-spire-client.yaml    -> deploy/k8s/nvke-spire-client.yaml
  deploy/k8s/spire-nke-services-spiffe-id.yaml
                                      -> spire-nvke-services-spiffe-id.yaml
  internal/nvkerbac/nkerbac{,_test}.go -> internal/nvkerbac/nvkerbac{,_test}.go

and the e2e stacks' copies of the first three, whose directories were already
named nvke-*.

rbac-nke-system.yaml was named for the management namespace, which moved to
nvke-system in #1698, so its filename was already one rename behind.

Every reference moves with them, including the two Tilt resource names derived
from the filenames (nke-auth-dev and spire-nke-services-spiffe-id), the
_controller_resource_deps list that names both, and the resource_deps of two
opt-in providers -- the dsx-identity-exchange mock and dsx-imds-attestation --
that wait on nvke-auth-dev.

Those two matter more than they look. Tilt matches resource_deps by string and
SILENTLY DROPS a name it does not know: with the stale name, the Tiltfile still
loads and `tilt alpha tiltfile-result` still reports no error, but
dsx-identity-exchange-ca comes out depending on ["oidc-upstream-ca-ready"]
alone, having lost its wait on the scaffolding that creates the namespace it
writes a ConfigMap into. That is a race, not a failure, and no lane would have
caught it -- both providers are off by default. Verified by loading the
Tiltfile against a kind cluster with the provider enabled, before and after.

The allowlist entry for this group loses its `nkerbac` alternative, which now
matches nothing, and its comment says why `nke-rbac` is still there: the
ConfigMap's name is a compiled constant in that package, so it needs to become
a chart value before the name itself can move.

Related: #1554, #1496
Signed-off-by: Terry Howe <thowe@nvidia.com>

* docs(chart): document the pins an existing site needs before upgrading

Addresses both CodeRabbit findings on #1769, which are the same finding twice:
the legacy pins existed in the test fixture and in the pull request body, but
not where an operator planning an upgrade would read them.

- nameOverride's doc comment was a plain `#` comment, so helm-docs never
  rendered it and the README's row for the one value that FAILS an upgrade was
  empty. It is now a `# --` comment and reaches the README.
- controllerConfig.name said an install that predates nvke-controller-config
  pins "nvke-controller-config". It pins "nke-controller-config"; a rename in
  #1769 caught the legacy value too. This is the key sentence on the key the
  finding is about, and it was telling operators to pin the new name.
- apiAuth.configMap.name, whose default moved earlier in this branch, gains the
  same note.
- A new "Upgrading an existing site: names and identity" section collects every
  pin in one block, beside the management-namespace section that already
  existed, and says which failure mode each one has: nameOverride is rejected
  by the API server, the rest succeed and quietly leave something behind.
- The README title was still nke-controller after this branch renamed the
  chart.

The section states what the second finding asks for and what the fixture
cannot: chart-identity-assertions.py proves the chart still honours the pins,
not that any site supplies them, so the deployed values of all 41 sites have to
be checked before a chart carrying these defaults is published.

teleport.* is deliberately excluded from the pin block. Those defaults moved to
nvke-* in #1563, in a chart every existing site already runs, and no site ever
pinned them -- so pinning them now would be a behaviour change rather than a
preservation, whatever their own value descriptions say. The section says so.

Related: #1554, #1496, #1769, #1563
Signed-off-by: Terry Howe <thowe@nvidia.com>

* fix: address review feedback

Three findings on the authentication ConfigMap search, all of them consequences
of this branch adding a second name to look for.

A denied read of the greenfield name no longer ends the search. RBAC scoped to
resourceNames denies every name it does not grant, so a site pinned to
nke-auth-config can deny nvke-auth-config while permitting the name it actually
runs -- and with one name that denial was correctly terminal, while with two it
stopped nvkectl before the readable one. Forbidden is now kept and the search
continues; it is returned only if nothing turns out to be readable, so a denied
read still never degrades into "authentication is off" and a bare request the
controller rejects with a confusing 401. Any other error stays terminal.

The regression test reproduces the reviewer's case and fails without the fix.
A second test covers the other half: when no candidate is readable, the
Forbidden is surfaced rather than reported as authentication being off.

The e2e helper searched one name too. On a pinned site RawConfig found nothing,
which does not fail a run -- it quietly turns the authn specs into assertions
about an unauthenticated NVKE and skips the SPIRE one. It now searches both
names, and ConfigMapName stays the name the suite's diagnostics quote.

cli/README.md and cli/docs/user-flow.md named only nvke-auth-config. Both now
name each ConfigMap the CLI looks for and state the narrower condition for
sending no token: neither name found in either namespace. Both also say that an
unreadable ConfigMap is not that condition.

Signed-off-by: Terry Howe <thowe@nvidia.com>

* style(cli): gofumpt the forbidden-reactor helper

golangci-lint's gofumpt wants the closing paren of a split call on its own
line. I checked the new test with gofmt, which accepts it; the gate is
golangci-lint fmt (gci + gofumpt), which does not.

Kept as its own commit rather than squashed into fd51855ea: the review replies
on this pull request cite that SHA, and rewriting it would strand them.

Signed-off-by: Terry Howe <thowe@nvidia.com>

* docs: name the chart nvke-controller in the publication reference

Two rows in artifact-publication.md still said the controller's chart is
nke-controller. This branch moved the published chart to
charts/nvke-controller while deliberately leaving the image at nke-controller,
so a row naming both artifacts with one name is now wrong about the chart.

- the NVKE_GITHUB_PUBLISH table listed "`nke-controller` image and chart"
- the SBOM section listed the chart among "`nke-controller` and `nktp`"

Every other nke-controller in the file is the image and stays.

Reported on the chart-publish row; the SBOM row is the same defect one section
further down.

Signed-off-by: Terry Howe <thowe@nvidia.com>

* fix(e2e): make the legacy auth ConfigMap name a constant

gochecknoglobals is on in controller/test/e2e and rejected the package-level
slice the two-name search was reading:

  internal/authtoken/token.go:41:5: ConfigMapNames is a global variable

LegacyConfigMapName joins ConfigMapName as a const and RawConfig ranges over an
array literal of the two, so there is no package-level variable. Nothing else
referenced the slice.

I had run `make lint` for cli and not for controller/test/e2e, which is a
separate module with its own lint job. Both now pass, as does controller --
the three modules this branch touches Go files in.

Signed-off-by: Terry Howe <thowe@nvidia.com>

* fix: address review feedback

Keeps the authentication mount at /etc/nke/auth, and fixes the same
Forbidden-stops-the-search bug in the e2e helper that was already fixed in the
CLI.

The mount path move was wrong, and my own commit message argued it was safe on
a premise that does not hold. It claimed "nothing outside the pod observes
either" path. An operator's auth.yaml does: jwks.caBundlePath is an absolute
path into that mount, written by whoever configured the issuer, and it lives in
their values or in a ConfigMap they supply. Pinning apiAuth.configMap.name
preserves the ConfigMap's name but not where it is mounted.

Confirmed by rendering the chart with a pre-rename configuration
(caBundlePath: /etc/nke/auth/spire-ca.crt plus the matching extraFiles): the
render SUCCEEDS and emits auth.yaml naming /etc/nke/auth/spire-ca.crt while
mounting the file at /etc/nvke/auth/spire-ca.crt. The guard does not catch it
either -- it only rejects an unlisted file under the current mount, so a
legacy path reads as "a CA outside the mount" and is left alone. An enforcing
controller then cannot load that issuer's CA, which is an authentication outage
on upgrade, arriving silently.

So /etc/nke/auth stays. The other three mounts this branch moved are kept at
/etc/nvke: controller-config, node-agent-client-tls and the e2e mock's
dsx-identity. Those are chart-owned or compiled constants -- checked that
nothing outside the chart names them, and that the only values an operator can
point into a mount are caBundlePath, which names the auth mount, and
profilesDir/runbooksPath, which name a different one this branch never touched.

authtoken.RawConfig had the same defect as cli/internal/auth did: it returned
on a Forbidden read of the greenfield name and never tried the pinned one. It
now keeps the denial, continues, and returns it only when no candidate is
readable -- so a denied read is never reported as authentication being absent.

Docs, all four of them saying something that is no longer true:

- cli/docs/user-flow.md and cli/README.md said the first name that *exists* is
  used; it is the first *readable* one, and they now say why that differs.
- controller/docs/configuring-api-authentication.md said nvke-auth-config is
  the single name fixed in the CLI, and that any read error stops the command.
- controller/test/e2e/README.md said the suite sends no token when
  nvke-auth-config is missing; it sends none only when neither name exists.

Signed-off-by: Terry Howe <thowe@nvidia.com>

---------

Signed-off-by: Terry Howe <thowe@nvidia.com>
2026-10-20 11:46:56 -04:00
Terry Howe e34e07e355 feat(chart)!: default the controller chart names and SPIFFE service path segment to nvke (#1769)
* test(chart): assert default, legacy-pinned and greenfield renders separately

chart-identity-assertions.py asserted the legacy names against the default render, so moving a default and keeping an existing install on its names could not be told apart. It now renders three scenarios, each with its own expectations: the chart's defaults, hack/testdata/chart-legacy-pinned-values.yaml, and a renamed greenfield install.

A default that moves now changes DEFAULT only. A pin that stops holding the old name fails the legacy-pinned render. The management namespace check is folded into the scenarios, and every check runs so a failure shows which render it was.

Signed-off-by: Terry Howe <thowe@nvidia.com>

* feat(chart)!: default nameOverride and the controller config ConfigMap to nvke-controller

A new install now gets nvke-controller for the Deployment, Service and every object named from the fullname, and nvke-controller-config for the settings ConfigMap. The ServiceAccount, the ServiceMonitor and the nke-rbac objects keep their names; they move separately.

BREAKING CHANGE: an install that predates this must set nameOverride to cloud-workflow-engine and controllerConfig.name to nke-controller-config before it takes this chart. The Deployment's spec.selector is immutable, so an upgrade that moves nameOverride fails, and the ConfigMap rename orphans the live object. hack/testdata/chart-legacy-pinned-values.yaml lists the pins.

The default scenario of chart-identity-assertions.py moves to the new names and the legacy-pinned scenario does not. The chart scripts, the chart test and the e2e helpers that select the ConfigMap by name follow the default; nvke-auth-demo.sh takes it from NKE_CONTROLLER_CONFIGMAP.

Signed-off-by: Terry Howe <thowe@nvidia.com>

* style: gofmt map literal alignment in oidc site_test

Signed-off-by: Terry Howe <thowe@nvidia.com>

* feat(chart)!: default the SPIFFE service path segment to nvke-service

A new install issues the controller the ID spiffe://<trust domain>/nvke-service/<service account>: the chart's default RBAC subjects, the ClusterSPIFFEID and the SPIRE admin ID now agree on nvke-service. The CLI bootstrap, the deploy path, the e2e stacks, Tilt and the e2e helpers that name the controller's ID follow.

BREAKING CHANGE: an install that predates this must set spiffe.servicePathSegment to nke-service and keep its ClusterSPIFFEID and SPIRE admin ID on /nke-service/. Node agents from before the nvke rename admit only that path, and the controller dials every node with one SVID, so moving it on such a site breaks controller-to-node mTLS.

chart-identity-assertions.py checks each scenario's SPIFFE subjects against its segment: nvke-service by default, nke-service in the legacy-pinned render.

Signed-off-by: Terry Howe <thowe@nvidia.com>

* fix: address review feedback

Name the auth demo's controller ConfigMap setting NVKE_CONTROLLER_CONFIGMAP, the prefix AGENTS.md requires for settings that name the controller. Show the default SPIFFE subjects in the chart README under spiffe.servicePathSegment instead of a fixed /nke-service/.

Signed-off-by: Terry Howe <thowe@nvidia.com>

---------

Signed-off-by: Terry Howe <thowe@nvidia.com>
2026-10-19 11:34:48 -06:00
Terry Howe 687d642ea4 feat(chart): make the controller config ConfigMap name and SPIFFE path segment values (#1758)
* feat(chart): make the controller config ConfigMap name and SPIFFE path segment values

controllerConfig.name and spiffe.servicePathSegment replace two literals, nke-controller-config and nke-service. Their defaults are unchanged, so a default render is byte-identical to before. This lets a later change move the chart defaults while an existing install pins the names it already has.

chart-identity-assertions.py renders with both pinned to other values and asserts the ConfigMap, the Deployment's mounted volume, the Reloader annotation and every default SPIFFE subject follow them.

Signed-off-by: Terry Howe <thowe@nvidia.com>

* fix: address review feedback

Assert the pinned render actually contains a Deployment before checking its
config mount and Reloader annotation, so a chart that drops the Deployment
under a pinned controllerConfig.name cannot pass a zero-iteration loop.

Compare the pinned render's full ClusterRoleBinding subject set against all
five expected SPIFFE IDs instead of substring-matching the path segment. The
old spiffe:// prefix filter silently dropped a missing or non-SPIFFE subject,
and the substring test accepted a subject whose first path segment was wrong
so long as one other subject was still correct.

Signed-off-by: Terry Howe <thowe@nvidia.com>

---------

Signed-off-by: Terry Howe <thowe@nvidia.com>
2026-10-19 15:33:39 +00:00
Terry Howe 6e8871aa40 feat!: make the management namespace configurable and default it to nvke-system (#1698)
* feat(controller): make the management namespace configurable

The shared management-plane namespace was the compile-time constant
constants.NamespaceNVKESystem. It is now the nke-controller-config key
managementNamespace, read through config.Config.ManagementNamespaceOrDefault
and threaded to what addresses that namespace: the tenant-access publish and
Secret-reconcile paths, the nke-rbac read, the CAPI cluster and machine
activities, failure-domain discovery, the Teleport token controller, the OIDC
rollout operation and the Secret cache the manager builds.

An unset key resolves to nke-system, which is what a config.yaml written before
the key existed decodes to, so a controller upgrade alone never moves a site.
The old constant is renamed LegacyManagementNamespace to say which of the two
it is.

Signed-off-by: Terry Howe <thowe@nvidia.com>

* feat(chart): default the management namespace to nvke-system

nvkeSystemNamespace.name is new and defaults to nvke-system. One helper,
controller.managementNamespace, feeds the Namespace object, the nke-rbac
ConfigMap, the Role and RoleBinding scoped to it and the managementNamespace
key the controller reads, so the grant and the namespace it covers cannot
drift apart.

This moves the default a new install gets. The old namespace is not also read,
so a site installed before the value existed must pin nvkeSystemNamespace.name
to nke-system before it upgrades; the chart README says so and
chart-identity-assertions.py now renders that pin and asserts every object and
the controller config land on it.

Signed-off-by: Terry Howe <thowe@nvidia.com>

* feat(cli): read kubeconfig Secrets from a configurable namespace

nvkectl get kubeconfig reads nvke-system and then nke-system, so it finds the
Secret whether or not the site has pinned the old management namespace, and
--namespace names one outright. The error from a miss names the last namespace
searched rather than reporting only the first.

The bootstrap engine installs the chart with default values, so its own
constant moves to nvke-system with the chart default.

Signed-off-by: Terry Howe <thowe@nvidia.com>

* chore: move the greenfield deploy, e2e and docs to nvke-system

The base-config Namespace manifests, Tilt, the e2e lanes, the CI helper scripts
and the user-facing docs all name the management namespace. They describe a new
install, so they follow the chart default. Nothing here is read by a site that
has pinned nke-system.

Signed-off-by: Terry Howe <thowe@nvidia.com>

* fix: address review feedback

fix: address CI failures
Signed-off-by: Terry Howe <thowe@nvidia.com>

* fix: address CI failures

The CLI falls back from nvke-system to nke-system and its not-found error names the last namespace tried, so the smoke test accepts either.

Signed-off-by: Terry Howe <thowe@nvidia.com>

---------

Signed-off-by: Terry Howe <thowe@nvidia.com>
2026-10-16 20:23:38 -04:00
Terry Howe a9aa1b975d refactor(chart): rename nkeSystemNamespace and nkeOIDCAuth values keys, failing on the old ones (#1562)
* refactor(chart): rename nkeSystemNamespace and nkeOIDCAuth values keys, failing the render on the old ones

Helm ignores an unknown values key silently, so a site still setting the old keys would fall back to chart defaults, including tenant-cluster OIDC reverting to disabled. Rename both keys to nvkeSystemNamespace and nvkeOIDCAuth, keep the old keys in values.yaml empty, and add a render guard that fails naming the replacement.

Part of #1496. Closes #1550.

Signed-off-by: Terry Howe <thowe@nvidia.com>

* fix(chart): key the renamed-values guard off presence, not truth

An explicitly supplied empty map is false in a Helm condition, so
--set-json 'nkeOIDCAuth={}' slipped past the guard and rendered on the
new key's defaults. Drop the empty defaults for both legacy keys so
presence only ever comes from the caller, switch the guard to hasKey,
and assert the empty-map case.

Signed-off-by: Terry Howe <thowe@nvidia.com>

* fix: rename the last nkeOIDCAuth readers the chart rename missed

The site deploy path still wrote nkeOIDCAuth into the controller values,
which the new guard refuses outright, and the CAPD and NICo VMs e2e
preflights still read nkeOIDCAuth.enabled from the installed release, so
they saw null and failed the run.

Signed-off-by: Terry Howe <thowe@nvidia.com>

* docs(chart): document the renamed values keys and their replacements

Signed-off-by: Terry Howe <thowe@nvidia.com>

---------

Signed-off-by: Terry Howe <thowe@nvidia.com>
2026-10-14 10:27:21 -06:00
Terry Howe 92d0f1541b refactor: rename CRD group to internal.nvke.nvidia.com and NKECluster to NVKECluster (#1585)
* refactor: rename CRD group to internal.nvke.nvidia.com and NKECluster to NVKECluster

Moves the management-engine's internal API group from internal.nke.nvidia.com
to internal.nvke.nvidia.com and renames the NKECluster kind to NVKECluster,
with its plural, controllers, finalizers and generated artifacts.

A group change is a new CRD: there is no conversion webhook and no automatic
migration, so existing sites copy their CRs across by hand. The procedure is
documented in docs/operations/crd-group-migration.md.

Regenerated with `make generate manifests` in management-engine and
`make chart-crds` from the root.

Two names the issue listed stay as they are, and the allowlist entry is
re-scoped rather than removed:

- NKENodePool and nkeClusterRef belong to the DGXC platform API
  (compute.private.x-dgxc.nvidia.com), which this repository emits CRs for in
  controller/scripts/cwe-to-platform-crs.sh but does not own.
- NKECluster also appears there, and in hack/test_name_check.py, where it is
  the fixture that proves the name-check detector still catches the shape.

Refs #1551

Signed-off-by: Terry Howe <thowe@nvidia.com>

* fix: add the migration page to docs/README.md and reformat after the rename

docs-check requires every page under docs/ to have a row in docs/README.md,
not only an entry in docs/index.yml.

The longer group name pushed a map literal out of gofmt alignment in
cli/internal/operator/dynamic_test.go, which golangci-lint reports as gci.

Refs #1551

Signed-off-by: Terry Howe <thowe@nvidia.com>

* docs: rewrite annotation keys and order CWE in the CRD group migration

The release CRs carry machine-init-kubernetes-version annotations under the old group prefix; copying them verbatim would hide them from the controller. Rewrite the keys, drop last-applied-configuration, verify in step 5, and document the CWE ordering and why status must be restored while the engine is stopped.

Signed-off-by: Terry Howe <thowe@nvidia.com>

---------

Signed-off-by: Terry Howe <thowe@nvidia.com>
2026-10-13 14:59:44 -06:00
Terry Howe 5427e14ac7 refactor: launch rename E, identity and RBAC dual-accept windows and nke: prune (#1563)
* refactor: accept both identity spellings and rename tenant RBAC to nvke

Accept both forms for one release on the receiving side: the nvke-controller
and nke-controller JWT audiences, the nke: and nvke: reserved identity
prefixes, and the auth.nvke/auth.nke auth-config apiVersions.

Rename the tenant RBAC objects to nvke:cwe and nvke:capi-cluster-admin, move
the server-side-apply field manager to nvke, and prune the old nke: objects
from each tenant cluster after the new manifest applies. A site that pins the
old tenantRbacName keeps what it applies.

Make the Teleport resource-group label a setting and move the managed-by,
token prefix and resource-group defaults to nvke for new sites; existing
sites pin the old values.

Leave the leader-election leases alone permanently and record them under
existing-sites identity in the name-check allowlist.

Part of #1496

Signed-off-by: Terry Howe <thowe@nvidia.com>

* fix: align the local controller config with the new Teleport defaults

Signed-off-by: Terry Howe <thowe@nvidia.com>

* fix: satisfy the controller linters in the legacy RBAC prune

golangci-lint flagged the new prune helper: legacyRBACObjects as a package
global, the repeated "nke:cwe" literal, and the Delete error checked inline
through IgnoreNotFound. Make the list a function, name the literal, and split
the Delete out of the if. Also fix a misspelling the US locale rejects.

Signed-off-by: Terry Howe <thowe@nvidia.com>

---------

Signed-off-by: Terry Howe <thowe@nvidia.com>
2026-10-13 10:08:43 -06:00
Aaron Patten 596f26ddd1 feat(chart): name the tenant RBAC subject spiffe.controllerSubject (#1383)
* feat(chart): name the tenant RBAC subject spiffe.controllerSubject

spiffe.controllerSubject is the chart's name for the subject the tenant RBAC
bindings grant. spiffe.cweSubject is still read; when both are set,
spiffe.controllerSubject wins. With spiffe.jwtExchangeEndpoint set, either key
satisfies the required-subject check.

Signed-off-by: Aaron Patten <apatten@nvidia.com>

* docs(chart): note that spiffe.cweSubject still satisfies the exchange requirement

Signed-off-by: Aaron Patten <apatten@nvidia.com>

---------

Signed-off-by: Aaron Patten <apatten@nvidia.com>
2026-10-09 13:16:47 +00:00
Abhay Krishna 7beaf77b8f feat(chart): render the nke-controller-config ConfigMap (#1163) 2026-10-07 17:45:38 +00:00
Miancheng Lin 5577f5cc1d feat(chart): install the release CRDs with the controller chart (#1144)
Package the MachineImage, ClusterRelease and NodePoolRelease CRDs in the
controller chart so a Helm install carries the schema the releases need,
and grant the controller read access to the three kinds.

The CRDs stay controller-gen output in management-engine/config/crd/bases.
controller/deploy/release-crds is a kustomize overlay that picks the three
the chart installs and adds the deployment annotations, and `make
chart-crds` renders it into files/crds.yaml, which the chart template
installs and which fails when it is missing or empty. The rendered file is
committed, as the provisioned provider's embedded manifest is, so Helm,
Tilt and chart packaging work from a clean checkout. `make
chart-crds-check` fails when it is stale and runs in generate-check,
beside provider-manifest-check, with the same pinned kubectl.

Only the chart needs the deployment annotations, so the CRD definitions in
management-engine stay free of them: helm.sh/resource-policy: keep makes
`helm uninstall` leave the CRDs in place, since deleting a CRD deletes
every custom resource of its kind, and the Argo CD sync-wave -2 and
Prune=false annotations order the CRDs before the resources and keep them
from being pruned.

The chart identity assertions cover the new resources, and the regenerate
skill, AGENTS.md and the management-engine README list the new generated
file and its command.

Signed-off-by: Miancheng Lin <mianchengl@nvidia.com>
2026-10-05 11:09:29 -07:00
srekhi93 4dc747ff82 fix(chart): close two greenfield-naming traps ahead of the values preset (#853)
* fix(chart): close two greenfield-naming traps ahead of the values preset
- serviceMonitor.matchLabels defaulted to a literal that duplicates a
  label the selector already derives from nameOverride/
  fullnameOverride, and silently wins over it on conflict. A renamed
  site that didn't know to clear this value got a ServiceMonitor whose
  selector never matched the Service -- metrics stop, with no error
  and no failed sync. Default it to {} so the derived labels pass
  through unless explicitly overridden.
- The existing spiffe.cweSubject guard only fires when
  jwtExchangeEndpoint is set, leaving the plain serviceAccount.name
  rename case unguarded: the default subject still hardcodes
  "cloud-workflow-engine", so a renamed service account authenticates
  under a SPIFFE ID that matches no nke:cwe binding and is denied
  every authorization check -- which reads like an RBAC bug, not a
  naming bug. Fail the render instead.
2026-09-29 15:18:00 -05:00
Aaron PattenandClaude Opus 5 dfc5095854 chore(chart): publish the Helm chart as nke-controller (#825)
* chore(chart): publish the chart as nke-controller

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Signed-off-by: Aaron Patten <apatten@nvidia.com>

* chore(chart): drop sitespec and docs edits from the chart rename

The nkectl sitespec bootstrapChart default and the site-bootstrap docs are
tracked separately and are deliberately on hold pending the SBOM decision;
they do not belong in the publish-name change.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Signed-off-by: Aaron Patten <apatten@nvidia.com>

* fix(composition): resolve the controller dependency by its published name

The nke-stack umbrella declared its controller dependency as `controller`,
which is the component key rather than the name the chart publishes under.
Renaming the published chart to nke-controller therefore broke both paths
that consume it: the OCI dependency pull resolved a coordinate that no
longer exists, and build/nke-stack.sh vendored a chart whose name did not
match the declaration.

EmitChart now takes the dependency name from helm.defaultChart and emits an
alias when it differs from the component key, so the values key and the
condition stay on the key and no consumer of the composition has to change.
That makes defaultChart load-bearing, so loading now rejects a component
that omits it rather than emitting a nameless dependency helm only refuses
at install time.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Signed-off-by: Aaron Patten <apatten@nvidia.com>

* fix(build): retarget the umbrella dependency by its published name

nke-stack-retarget.py matched the controller dependency by the literal
name `controller`, which the publish rename moved to `nke-controller`.
re.sub reports nothing on a miss, so `nke-stack.sh package` and
`build_local` would have left the dependency pinned to the committed
0.0.0 placeholder on GHCR instead of the just-published version and
registry -- a wrong chart resolved silently rather than a build failure.

Match the published name and exit non-zero unless each dependency is
rewritten exactly once, so the next rename fails loudly here.

Also corrects three comments that describe the packaged chart by its
former name.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Signed-off-by: Aaron Patten <apatten@nvidia.com>

* fix(build): detect a duplicate dependency in the retarget guard

The guard passed count=1, so re.subn could never report more than one
replacement and the "exactly once" check could only ever catch zero. A
Chart.yaml carrying the dependency twice would have had one entry
retargeted and the other left on its placeholder version and GHCR
repository, silently.

Drop the limit so a duplicate raises the count instead of hiding behind
it, and report the count found. The guard exits before the file is
written, so a rejected run leaves it untouched rather than partly
rewritten.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Signed-off-by: Aaron Patten <apatten@nvidia.com>

---------

Signed-off-by: Aaron Patten <apatten@nvidia.com>
Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-18 12:19:40 -04:00
Aaron PattenandTerry Howe 7f8b58cb7f chore: publish the controller chart as charts/controller (#472)
* chore: publish the controller chart as charts/controller

The last path segment of an OCI chart reference is the chart's `name:`, so
moving the artifact to ghcr.io/nvidia/nke/charts/controller means renaming
the chart itself: the directory, `name:` in Chart.yaml, and the
cloud-workflow-engine.* helper templates.

Renaming the chart would otherwise rename every object it owns, because the
name helper falls back to .Chart.Name. So nameOverride is pinned to
cloud-workflow-engine: it feeds app.kubernetes.io/name, every resource name
derived from the fullname template, and the serviceMonitor.matchLabels
selector, which would stop matching its Service on upgrade of an existing
release. The container name moves from .Chart.Name to the same helper for
the same reason -- a renamed container breaks every `kubectl logs -c` and
every log or metric selector keyed on it. Rendered output is unchanged
except for the helm.sh/chart label.

The NVCR mirror gains the `charts/` segment GHCR already had. Without it the
chart would land in nvcr.io/<org>/controller, the same OCI repository as the
controller image, told apart only by whether the tag carries a "v".

Charts published through controller/v0.1.1-rc.1 keep the old name and the
old path; nothing republishes them. The malware backfill scans those tags,
so it tries the new path and falls back to the old one.

Signed-off-by: Terry Howe <thowe@nvidia.com>

* fix(chart): resolve the helpers renamed with the chart package

configmap-auth.yaml and rbac-jwks-discovery.yaml landed on main after the
chart rename was branched, so they call the pre-rename helper names:

  error calling include: template:
  no template "cloud-workflow-engine.fullname" associated with template "gotpl"

_helpers.tpl had ended up with two naming schemes. The core helpers moved to
controller.* with the package, while the apiAuth.* helpers arrived afterwards
and kept the old prefix, so deployment.yaml still resolved and the breakage
was confined to the two newer templates.

Normalise all 16 references onto controller.*. Helper names are internal to
the chart, so rendered output is unchanged.

helm lint and kubeconform both pass on the broken chart because the failure
only appears with apiAuth.enabled=true, which the default render never
exercises. controller/hack/chart-auth-assertions.sh is what caught it.

* fix: repoint chart-path consumers after the rename

Consumers of controller/deploy/charts/cloud-workflow-engine that were added
to main after the chart rename was branched, so the rename never saw them:

  make/checks.mk                CHART, which four merge-gate targets read:
                                helm lint, chart render, chart-rbac-check
                                and chart-package-check
  docs/README.md                dangling link; hack/docs-check.sh fails on it
  docs/architecture.md          names the chart directory in prose
  RELEASE.md                    says the chart publishes to
                                charts/cloud-workflow-engine
  chart-auth-assertions.sh      CHART fallback default
  chart-package-assertions.sh   CHART fallback default

Also moves nkectl's chart resolver. resolveChartPath joins the chart
directory literally and stats it, so bootstrap fails outright once the
directory moves. That is NKX-15142's story, but leaving it would put
nkectl-bootstrap-e2e red for no reason.

cweReleaseName and cweNamespace stay as they are. Those are deployed
identities, not paths, and this change moves nothing that runs.

Chart.yaml still described "the cloud-workflow-engine service" under
name: controller; the description is published with the chart.

* test(chart): guard the deployed identities the rename must preserve

The chart package is controller; everything it renders stays
cloud-workflow-engine, held there by nameOverride in values.yaml. That split
is permanent rather than transitional: existing sites keep the legacy runtime
naming indefinitely, and only new site installs take controller naming. So
"default values render the legacy names" is a durable invariant.

Nothing asserted it. Emptying nameOverride renames the container to
controller, changes app.kubernetes.io/name in the Deployment selector, and
renames six resources -- while helm lint, helm template and kubeconform all
still pass. Fleet dashboards select on container="cloud-workflow-engine", and
spec.selector is immutable once applied, so an upgrade would fail rather than
rename.

Adds chart-identity-check to chart-check. Verified by emptying the pin and
confirming the check fails with each of those findings.

Not asserted: helm.sh/chart and the "# Source:" comments. Both encode the
chart's own name by design and both moved with the package. Neither is a
selector or a consumer-visible identity, so rendered output is identical
apart from them -- confirmed against the pre-rename chart with default values
and with apiAuth.enabled=true.

Co-authored-by: Terry Howe <thowe@nvidia.com>

---------

Signed-off-by: Terry Howe <thowe@nvidia.com>
Co-authored-by: Terry Howe <thowe@nvidia.com>
2026-09-03 15:22:53 +00:00