mirror of
https://github.com/dsx-ai-factory/nvke.git
synced 2026-12-07 04:35:58 +08:00
pull-request/2437
7
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
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> |
||
|
|
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> |
||
|
|
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> |
||
|
|
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> |
||
|
|
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> |
||
|
|
a5ac8947e3 |
chore(chart): say controller, not CWE, in chart and deploy-path comments (#1395)
Signed-off-by: Aaron Patten <apatten@nvidia.com> |
||
|
|
db44f7a9b8 |
feat(controller): support external node-agent mTLS certificates (#826)
- load and validate an externally managed controller client identity - inject the controller CA and agent flag through CAPI and NICo bootstrap data - add chart configuration and real TLS integration coverage Signed-off-by: Vivin Wilson <vwilson@nvidia.com> |