Commit Graph
15 Commits
Author SHA1 Message Date
Abhay Krishna 51dc0c4dae feat!: make apiAuth the only API authentication source (#1938)
apiAuth in nvke-controller-config becomes the only place the
controller reads its API authentication configuration from. This is
the breaking second step of phase 2.

- The controller refuses to start when AUTH_CONFIG_PATH is set, naming
  apiAuth as the replacement, and passes authn.Setup only the apiAuth
  section. authn.Load and Options.ConfigPath stay for
  management-engine's --auth-config.
- The chart no longer renders or mounts nvke-auth-config. It refuses
  apiAuth.configMap and an AUTH_CONFIG_PATH env entry by name, and a
  caBundlePath into the old mount, pointing at jwks.caBundle.
- apiAuth.permissive requires apiAuth.enabled, in the chart and at
  startup. Tilt passes it only with authentication on.
- controllerconfig, which decodes the apiAuth section, gets the
  decoder-strictness tests.
- nvkectl and the token scripts keep their fallback to the
  authentication ConfigMap for controllers from before this change.
- The e2e suite reads the enforcement mode from apiAuth alone.
- The pod template carries a checksum of nvke-controller-config, so an
  upgrade that changes apiAuth rolls the controller without Reloader,
  which the NVKE stack does not install.
- API authorization (#2125) counts authentication as on exactly when
  apiAuth.enabled is.

BREAKING CHANGE: AUTH_CONFIG_PATH and apiAuth.configMap are removed.
A site that managed its own authentication ConfigMap moves audiences
and issuers into apiAuth.config, CA bundles into jwks.caBundle, and
sets apiAuth.enabled. apiAuth.permissive without apiAuth.enabled is
refused. nvkectl older than the previous step gets 401.

Signed-off-by: Abhay Krishna Arunachalam <abhaykrishna@nvidia.com>
2026-11-17 13:25:25 -08:00
Dan Budris df72e7d18e feat(chart): turn on API authorization from Helm values (#2173)
* feat(chart): turn on API authorization from Helm values

Expose apiAuthz in the controller chart. With apiAuthz.enabled, the
chart mounts the bundle ConfigMap at /etc/nvke/authz and points
authorizer.localBundle.dir at it. With apiAuthz.configMap.create, the
default, it also renders that ConfigMap from apiAuthz.policies,
apiAuthz.roles and apiAuthz.config.

- The default policies let admin call every API operation and viewer
  every get and list.
- The chart supplies the AuthorizationConfiguration's apiVersion and
  kind.
- Reloader does not watch the bundle: the controller reloads it itself,
  so a bundle change needs no restart.

The render fails on settings the controller would refuse at startup:
authorization without authentication, enforcing authorization behind
permissive authentication, and a config that would not be rendered or
carries apiVersion or kind.

Signed-off-by: dbudris <dbudris@nvidia.com>

* refactor(chart): nest apiAuthz bundle values under authorizer.localBundle

The values now follow the controller config: apiAuthz.authorizer.backend
picks the backend, and apiAuthz.authorizer.localBundle configures
LocalBundle, the only one. configMap, config, policies and roles move
under localBundle. The render fails on any backend but localBundle.

Signed-off-by: dbudris <dbudris@nvidia.com>

---------

Signed-off-by: dbudris <dbudris@nvidia.com>
2026-11-16 09:22:50 -07:00
Abhay Krishna ddab4187b5 feat: read API authentication from apiAuth first (#1935)
Prepare for apiAuth in nvke-controller-config to be the only source of
the NVKE API authentication configuration. Nothing here is breaking;
retiring AUTH_CONFIG_PATH and the external-ConfigMap mode follows once
an nvkectl with this change is released.

- nvkectl, the e2e token helper and hack/nvke-token.sh read apiAuth
  from nvke-controller-config first and fall back to the
  authentication ConfigMap when the section is off or absent.
- permissiveMode moves to apiAuth.permissive, beside the rest of the
  section and matching the Helm value. A config.yaml that still sets
  the top-level key is refused with an error naming the new one.
- Issuers take an inline jwks.caBundle as an alternative to
  caBundlePath, so a private CA no longer needs a file mounted from
  nvke-auth-config.
- Tilt and the CAPNICo e2e path render the configuration from chart
  values, as CAPD already does, and their nvke-auth-dev manifests drop
  the ConfigMap. Nothing in the repository uses
  apiAuth.configMap.create=false any more.
- The design document replaces its phase 2 outline with the design.

Signed-off-by: Abhay Krishna Arunachalam <abhaykrishna@nvidia.com>
2026-10-25 13:24:07 -07:00
Abhay Krishna e7ebbc4b1b feat(controller): read chart-rendered API authentication from nvke-controller-config (#1812)
When the chart renders the API authentication configuration
(apiAuth.configMap.create), the controller now reads it from an apiAuth
section of nvke-controller-config instead of the file at
AUTH_CONFIG_PATH. auth/authn stays the only owner of the schema: the
section reuses authn.Issuer and is validated with the new
Config.ValidateStartup, which authn.Load also uses.

The section is required and carries an explicit enabled switch, so a
missing section is a startup failure rather than "off". A section
filled in but switched off is refused, and enabling it while
AUTH_CONFIG_PATH is set is a startup failure. A ConfigMap managed
elsewhere keeps the AUTH_CONFIG_PATH path, and the chart still renders
the authentication ConfigMap for nvkectl and extraFiles.

The CAPD e2e lane moves to the chart-rendered configuration; Tilt and
capnico-e2e keep the external ConfigMap, so CI covers both. The e2e
suite and the token and demo scripts treat either source as
authentication being on, whichever name the settings ConfigMap has.
The auth-mode gauge now follows whether authn.Setup built an
authenticator.

Also renames the remaining references to the settings ConfigMap,
nke-controller-config, to nvke-controller-config, the chart's default
since #1769, in docs, comments, test messages and help text. Kept: the
legacy pins and fallbacks for installs that predate the rename, and
the "Loaded nke-controller-config" startup log line, which the e2e
OIDC site helper matches and released images still print.

Includes the design doc,
controller/docs/api-auth-in-controller-config-design.md.

Signed-off-by: Abhay Krishna Arunachalam <abhaykrishna@nvidia.com>
2026-10-23 16:33:27 -07:00
Dan Budris a3cabe2db2 refactor(auth): move the authN library to auth/authn (#1903)
Move controller/internal/auth to auth/authn as package authn, in a new
module, github.com/dsx-ai-factory/nvke/auth. This is a pure move with no
behavior change: only the package name, import paths, the qualifier and
path references change. The new module is wired the way controller/api
is: go.work use, a require and replace in controller/go.mod, a replace
to ../controller/api in auth/go.mod, the root Makefile module lists,
the lint and unit-test CI matrices, the e2e path filters, the coverage
registry, the notices and licence ignore lists, CODEOWNERS and the
labeler.

Signed-off-by: dbudris <dbudris@nvidia.com>
2026-10-23 11:40:55 -06: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
Abhay Krishna 8c6e47fc1e feat(controller)!: read settings only from nke-controller-config (#1527)
The controller now takes the 61 settings nke-controller-config carries
from the mounted file only. Each config.Config field that moved trades
its env tag for a controllerconfig tag naming its config.yaml key, and
controllerconfig.LoadStartupConfig fills them at startup from the file
CONTROLLER_CONFIG_PATH names, which is now required. The chart stops
setting the 61 variables, and config.Validate checks only what the
environment still supplies; the file validates the rest when it loads.

With no tracing.endpoint in the file, the controller falls back to the
OTEL_EXPORTER_OTLP_* variables the OpenTelemetry Operator injects, as
it did before. The exporter gets the endpoint as a URL whose scheme
carries the resolved transport, so an injected http:// endpoint cannot
downgrade a secure tracing.endpoint, and an https:// one stays secure.

Host-local runs and the gofail e2e worker start from
hack/local-controller-config.yaml. The e2e helpers that toggled OIDC
and permissive mode on the Deployment now edit nke-controller-config
and restart the controller.

Rolling back across this change needs the chart and the image rolled
back together: an older image under this chart runs on Go defaults for
every setting the chart no longer passes.

Signed-off-by: Abhay Krishna Arunachalam <abhaykrishna@nvidia.com>
2026-10-12 15:17:34 -07:00
Davanum SrinivasandClaude Fable 5.1 6029bf16ab chore: say NVKE in the comments and display text that still said NKE (#1470)
* chore: say NVKE in the comments that still said NKE

The word NKE in comments becomes NVKE: Go comments through the token
scanner, so no string literal moves; proto doc comments, with the
generated *.pb.go files regenerated by `make -C agent protos`; and the
comment lines of YAML, shell, Make, Tilt, systemd, Packer, Nix and
template files. The provisioned provider's CRD description comes from a
doc comment, so `make -C cluster-api-provider-provisioned manifests` and
`make -C cli provider-manifest` regenerated the CRD and the CLI's
embedded copy of it.

Kept on purpose: the comment quoting the "NKE Agent Version:" line the
updater parses, and the comments about the NGC organisation that is
named NKE.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Signed-off-by: Davanum Srinivas <dsrinivas@nvidia.com>

* chore: say NVKE in the display text that still said NKE

User-facing text that carried the word NKE now says NVKE: nvkectl help
text; log, error and condition messages; Ginkgo suite and spec names;
deb and OCI package metadata; systemd unit descriptions; workflow step
names and input descriptions; Helm render failures; and the nine
Markdown lines the prose sweep (#1462) missed. The tests that assert
these strings move with them.

Kept on purpose, because something parses or persists them: the
"NKE Agent Version:" and "NKE Agent Updater Version:" lines the updater
reads; the "update NKE RBAC:" errors of the UpdateNKERBAC rpc; the 2025
migration text; the OIDC upstream CA's CN and OU, since re-issuing that
CA would break tenant trust; the nico-sim tenant "Forge-Tenant-NKE"; the
Keycloak lab realm; and the NGC organisation that is named NKE.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Signed-off-by: Davanum Srinivas <dsrinivas@nvidia.com>

---------

Signed-off-by: Davanum Srinivas <dsrinivas@nvidia.com>
Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
2026-10-10 18:28:35 -04:00
Abhay Krishna 97cc189dec feat(controller)!: mount nke-controller-config and load it at startup (#1325)
BREAKING CHANGE: The chart refuses an env entry for a setting
nke-controller-config carries. Set it through its chart value instead.

Signed-off-by: Abhay Krishna Arunachalam <abhaykrishna@nvidia.com>
2026-10-08 13:22:34 -07:00
Abhay Krishna 7beaf77b8f feat(chart): render the nke-controller-config ConfigMap (#1163) 2026-10-07 17:45:38 +00: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
Dan BudrisandClaude Opus 5 d9f90b2481 feat(chart): let the authentication ConfigMap carry a CA bundle (#333)
#322 let the chart render the AuthenticationConfiguration from values. This
extends that to issuers whose keys endpoint sits behind a private CA -- SPIRE,
and most internal providers -- which need the CA bundle as a file on disk.

apiAuth.configMap.extraFiles is a filename-keyed map rendered into the same
ConfigMap. The volume mount carries no items selector, so every key in that
ConfigMap already surfaces as a file at apiAuth.mountPath; this makes that
reachable from values, and SPIRE now configures inside the apiAuth block alone.
A CA bundle is a public certificate rather than a secret, so values is a
reasonable home for one; anything an operator would rather keep elsewhere still
goes through .Values.volumes.

Three render-time guards come with it, in the shape #322 established: refuse the
values that would render clean and then behave unexpectedly, and leave the rest
to auth.Load.

  - A caBundlePath under the mount path naming a file nothing supplies, which
    would otherwise start the pod and fail it on a missing file. The message
    names the issuer and the key to add. A path outside the mount path is an
    operator-managed volume and is left alone.
  - extraFiles set without configMap.create, which would be silently ignored --
    the case the existing config-without-create guard already covers.
  - auth.yaml listed in extraFiles, which would render a duplicate key taking
    precedence over the rendered configuration.

Verified:

  - With the feature unused, rendered output is byte-identical to main, both
    with apiAuth off and with it on. Diffed, not asserted.
  - Both files land in the ConfigMap, the certificate is carried through
    unaltered, and auth.yaml still parses as one document.
  - Each guard fires with its own message, and the Kubernetes recipe, whose
    caBundlePath sits outside the mount path, is unaffected.
  - Eight assertions added to hack/chart-auth-assertions.sh; the suite passes,
    helm lint is clean, shellcheck finds nothing at error level.

make chart-check pins helm v4.2.4 and this machine has v4.0.5, so its steps were
run individually with the helm available. kubeconform is not installed locally,
so the rendered ConfigMap was parsed with PyYAML instead. CI covers both.

Part of NKX-15206.

Signed-off-by: dbudris <dbudris@nvidia.com>
Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-27 07:54:44 -06:00
Dan BudrisandClaude Opus 5 f5345488a6 feat(chart): render the authentication configuration (#322)
The chart mounts nke-auth-config but does not create it. That works when the
file is applied by hand, and does not survive contact with nke-site-deploy:
every app in aoa-nke-site is a chart from a registry, with no git-path app and
nowhere for a loose manifest to live.

Add apiAuth.configMap.create, which renders apiAuth.config into that ConfigMap.
The document is passed through toYaml with only apiVersion and kind supplied
here. internal/auth/config.go is a strict loader whose errors name the field at
fault, and a second copy of its rules in Helm would drift the first time an
issuer gains a key -- so the chart checks only what it must, and leaves the rest
to startup. The cost is that a bad value is a CrashLoopBackOff rather than a
failed render, which the README now says.

What it must check is the three ways values and chart can disagree, each of
which otherwise renders clean and then does the wrong thing:

  - apiAuth.config set without configMap.create, or the reverse: one of the two
    is silently ignored.
  - audiences or issuers missing: NKE refuses to start with either absent.
  - apiVersion or kind repeated inside apiAuth.config: the chart supplies both,
    so a copy renders duplicate keys, and auth.Load's strict parse rejects them.
    The README's own example invited this, and no longer does.

Rendering the ConfigMap does not change how it is applied. auth.Load runs once
at startup and Kubernetes restarts nothing when a mounted ConfigMap changes, so
whenever apiAuth is enabled the Deployment carries the Reloader annotation --
the same mechanism the chart already uses for three Secrets, and one that
catches an edit from any source rather than only one arriving through values.
As before, an operator who sets that annotation in deploymentAnnotations keeps
it.

The default is create: false, so the rendered output is unchanged and
deploy/k8s/nke-auth-dev.yaml keeps applying its own ConfigMap.

Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-26 13:20:59 -06:00
Dan BudrisandClaude Opus 5 63790e8540 feat(chart): ship the authentication configuration, and the dev scaffolding (#237)
* feat(chart): ship the authentication configuration, and the dev scaffolding

Packaging for the wiring that landed in the previous commit. Two halves: what
a deployment needs, and what a developer needs to exercise it locally.

The chart gains an `apiAuth` block that mounts a ConfigMap, sets
AUTH_CONFIG_PATH and PERMISSIVE_MODE, and binds the RBAC that lets CWE read
the cluster's own JWKS at /openid/v1/jwks -- that endpoint is not anonymous,
and without the binding the fetch is 403 and an enforcing CWE refuses to
start. The grant is gated on apiAuth.clusterIssuerDiscovery rather than
inferred, because the issuer list lives in a ConfigMap this chart mounts and
never parses. Issuers and audiences are deliberately absent from values.yaml
for the same reason.

apiAuth.enabled defaults to false, so an existing release upgrades with
AUTH_CONFIG_PATH absent and behaves exactly as before. hack/chart-auth-assertions.sh
asserts that in 14 render checks, because `helm lint` proves the chart parses,
not that enabling authentication yields a deployment that can authenticate --
and not that disabling it leaves AUTH_CONFIG_PATH unset rather than empty.

The dev half adds Tilt wiring behind NKE_AUTH_ENABLED, an example auth
ConfigMap, two sample service accounts (one admitted, one not), hack/nke-token.sh,
and credentials to the bootstrap scripts that would otherwise start failing the
moment authentication is on.

chart-auth-assertions.sh resolves the chart relative to itself rather than to a
"repository root" that means two different directories in this layout; CHART
still overrides, which is what the chart workflow sets.

Signed-off-by: dbudris <dbudris@nvidia.com>

* fix(chart): address review on the authentication packaging

nke-auth-demo.sh assigned AUDIENCE a fallback on the line after a `die` that
already guaranteed it was non-empty. Unreachable; removed.

Both scripts read AUTH_CONFIG_PATH and PERMISSIVE_MODE off containers[0]. The Go
side deliberately does not -- SetOIDCEnabled errors rather than guessing, and
the e2e helper picks by name -- because a sidecar can sort first and its
environment is not NKE's. Both now select the container by name, which is also
what makes the demo's mode detection agree with what the specs report.

The demo's metrics parser took $NF as the sample value. An exposition line may
carry a trailing timestamp, in which case $NF is the timestamp. Take the field
after "}", the way test/e2e's sumCounter does.

Comment fixes: the Tiltfile said the config is mounted by
hack/tilt-cwe-chart-values.yaml, which says the opposite and is right -- the
chart mounts it from the apiAuth values the Tiltfile sets. A chart assertion
described itself as "and nothing else", which describes nothing.

The README said a stock cluster already works because Kubernetes ships a
bootstrap binding for system:service-account-issuer-discovery. It ships the
ClusterRole bound to nobody, and the paragraph above already said an enforcing
NKE will not start without the binding. The two contradicted each other.

Not changed: the `required` guard on apiAuth.configMap.name. Review called it
unreachable behind the values.yaml default, but it fires on an explicitly
blanked name, which is the case that would otherwise render a volume with no
name. Verified with helm.

helm lint clean, all 14 chart assertions pass, bash -n on every touched script.

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

* docs(readme): apply the review notes on the local-development section

The three suggestions left on the wiring PR were never applied: "You need no
identity infrastructure" reads better as "You don't need", and the em-dash
clause about what you exercise locally being what ships was a flourish on top of
a sentence that already made its point.

RBAC Prerequisite opened and closed with the same fact. The closing sentence is
merged into the opening one, which now says why the binding is needed rather
than saying it twice.

"the RBAC below" pointed at a section two headings away; it names it.

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

* docs(readme): tighten the local-development and RBAC sections

Same pass. Two "already"s that carried no meaning, "a working example to start
from" saying example twice, and a sentence about the issuer-discovery binding
that put its conclusion in the middle.

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

* refactor(chart): fix the auth mount path and file name in the chart

apiAuth exposed five values where three vary. mountPath and configMap.key were
neither: nothing outside the pod observes either, AUTH_CONFIG_PATH is the two
joined, and an operator writing the ConfigMap the chart tells them to write is
already choosing the key. Their only effect was to give the mount and the path a
way to disagree.

Both are now template helpers with one definition each. What stays is what a
deployment genuinely differs on: enabled, permissive, the ConfigMap name, and
whether to bind the issuer-discovery ClusterRole.

Removing a value is breaking and adding one is not, so this is the moment: the
chart has not shipped, and nothing sets either key today.

The assertion that mountPath and key flow into AUTH_CONFIG_PATH is replaced by
one that the mount and the path still agree on the fixed value, which is the
property that mattered. 15 checks across 6 renders.

configMap.name's comment said "Required when enabled", which reads as an input
an operator must supply; it has a default and is only required in the sense that
explicitly blanking it fails the render. It now says that.

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

* ci(chart): run the apiAuth render assertions

hack/chart-auth-assertions.sh landed here with nothing invoking it; the workflow
step was in the e2e pull request further up the stack. If this merged and that
one stalled, the chart's authentication rendering would be unverified in CI,
which is the gap the script exists to close.

The script arrives with its caller now. The step is unconditional: the chart
renders apiAuth in every state the script asks for, including disabled, so there
is nothing to gate it on.

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

* fix(chart): correct why AUTH_CONFIG_PATH is omitted when disabled

Two comments said an empty AUTH_CONFIG_PATH crash-loops the deployment because
NKE treats a set-but-unreadable path as a startup failure. It does not. The
empty string takes the same branch as unset: auth.Setup returns (nil, nil) and
the process starts with authentication off. Confirmed by calling it.

The template's behaviour was right and the assertion guards the right thing, but
the stated reason was inverted in the direction that matters. It described a loud
failure where the truth is a silent fail-open, so anyone who tested the claim,
found no crash, and concluded the comment was stale could reasonably decide that
always emitting the variable is harmless.

Both now say what actually happens: an empty value renders a deployment that
looks configured and authenticates nobody. That also matches what chart.yml
already said, so the three statements agree rather than contradicting.

Presence, not value, is what carries the meaning, and test/e2e's
detectAuthnEnforcement reads it that way: it returns disabled only when the
variable is absent from the container, so an empty one would report a disabled
deployment as enforcing.

Also moves the apiAuth mount helpers to the end of _helpers.tpl. Inserting them
above serviceAccountName left "Create the name of the service account to use"
reading as documentation for them.

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

* fix(tilt): correct the same AUTH_CONFIG_PATH claim in the Tiltfile

A fourth copy of the crash-loop reason, missed in the previous commit. Same
correction: an empty value is read as unset and disables authentication, so it
fails nothing and renders a deployment that looks configured.

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

* docs: tighten the comments added by this branch

Comments only; no code changed. Three habits ran through them:

They argued for decisions instead of describing behaviour. "Deliberately not
optional", "Gated on X rather than inferred, because...", "Nothing for apiAuth
here on purpose", "TokenRequest, not a long-lived Secret". A reader needs to
know what the line does and, occasionally, what breaks without it -- not the
case for choosing it.

The same three-sentence argument about an empty AUTH_CONFIG_PATH appeared in
five places. It now appears once, in the chart template where the decision is
expressed; the Tiltfile and the assertion script just state the rule.

Several were one long sentence with the point buried mid-clause. The chart
workflow's was five lines with a nested aside, and the JWKS ClusterRoleBinding
led with an assertion about the issuer list before saying what it grants.

Signed-off-by: dbudris <dbudris@nvidia.com>

* fix(tilt): default API authentication off until the suite can authenticate

Both e2e lanes went red on this branch. The Tiltfile defaulted
NKE_AUTH_ENABLED to true, so CI deployed an enforcing NKE, and the suite on this
branch has no credential to present: internal/authtoken arrives with the
authentication specs, one pull request later. Every spec that calls the API got
401.

    "API authentication is enabled","mode":"enforcing"
    "rejected request","reason":"no_token","status":401,"path":"/api/clusters/..."

capd-e2e 3 passed / 4 failed, nico-e2e 0 / 1, and in both cases the four
failures are cluster creation. The health specs passed throughout, which is the
anonymous surface behaving as intended.

The default is off here and flips on with the specs that can authenticate. That
is what this branch can actually back: nothing on it is able to present a token,
so deploying enforcing by default claims a capability it does not have.

Enabling by hand still works and is what hack/nke-auth-demo.sh and
hack/nke-token.sh are for.

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

* docs(readme): document the chart values, the ConfigMap and the token path

The authentication section described the two environment variables NKE reads,
but not the Helm values an operator actually sets. It also never said where the
ConfigMap comes from, or how a script gets a token.

Adds the apiAuth values to Enabling Authentication, the kubectl that creates the
ConfigMap the chart mounts but does not create, and a section on hack/nke-token.sh
for scripts and CI, including the overrides that matter: NKE_AUTH_TOKEN to supply
a token directly, NKE_AUDIENCE to skip discovery.

Signed-off-by: dbudris <dbudris@nvidia.com>

---------

Signed-off-by: dbudris <dbudris@nvidia.com>
Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-25 11:37:27 -06:00