Commit Graph
53 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
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
Anisha Gupta US 82e717988b feat(cli): export a command's telemetry to its site's OTLP endpoint (#1931)
* feat(cli): export a command's telemetry to its site's OTLP endpoint

A site's config can hold an OTLP endpoint, set with nvkectl config set-site --otlp-endpoint and --otlp-insecure. Commands that use the site export their spans and log records there, ahead of OTEL_EXPORTER_OTLP_ENDPOINT.

Signed-off-by: Anisha Gupta <anisgupta@nvidia.com>

* refactor(cli): inline the bootstrap export check and list the site commands

The bootstrap export annotation is read in two places, so the helper that wrapped it is gone, and the commands that use a site are a list rather than a map.

Signed-off-by: Anisha Gupta <anisgupta@nvidia.com>

* fix(cli): do not send to a stored https endpoint in clear text

A hand-edited site config could pair an https otlp-endpoint with otlp-insecure, which set-site rejects. The site endpoint is now treated as unusable, with the one warning that names the site, so the headers are never sent without TLS.

Signed-off-by: Anisha Gupta <anisgupta@nvidia.com>

---------

Signed-off-by: Anisha Gupta <anisgupta@nvidia.com>
2026-10-28 10:40:07 -04: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
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
Jonathan MeierandClaude Opus 5 1697fa157b docs: remove the manual management-plane install path (#1784)
The published documentation carried two ways to install the management
plane: the hand-run `deploy/check-site.sh` and `deploy/nvke-deploy.sh`
procedure, and the local-site flow added in #1725. This removes the first
and leaves the second as the only documented path.

Deletes docs/operate/install-management-plane-services.md, which was the
manual procedure end to end, and its entries in docs/index.yml and
docs/README.md. Seventeen pages named it as a prerequisite; each now points
at Run NVKE end to end on one machine.

Rewrites the install commands in Secure the NVKE API, Configure OIDC for
workload clusters and cli/docs/user-flow.md onto
`deploy/nvke-deploy-local.sh install`, which takes the same pass-through
flags and reads its inputs from the NVKE_* variables env.sh exports.
Removes the `deploy/check-site.sh` references from Troubleshoot, Supported
platforms, the NKTP pages and cli/docs/sitespec.md.

No script is removed or changed in behaviour. deploy/check-site.sh,
deploy/nvke-deploy.sh, deploy/nvke-deploy-local.sh and deploy/nico stay as
they are; local-site runs on them. Two script comments that named the
deleted page now name the local-site page.

Signed-off-by: Jonathan Meier <jomeier@nvidia.com>
Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
2026-10-19 15:49:32 -04:00
Vineeth Bandi 55612dce98 docs: rename NKTP to NVKE telemetry pipeline (#1765)
Signed-off-by: Vineeth Bandi <vbandi@nvidia.com>
2026-10-19 13:45:42 -05:00
Jonathan Meier bc75b98193 docs(cli): generate the nvkectl command reference from the command tree (#1773)
The repository has a hand-maintained quick reference and workflow guides, but
no complete reference. An operator cannot browse the whole public CLI without
a built binary, and nothing ties the prose to the commands, so the two drift
apart silently.

Add cli/docs/reference: an index and one page per public command, generated
from the cobra tree nvkectl itself runs. Each page carries the command's
purpose, invocation and positional arguments, aliases, examples, local and
inherited options with types and defaults, the required and mutually exclusive
option groups, and a deprecation notice when it has one.

cobra's doc package writes the body of each page. It does not emit aliases,
deprecation notices, flag-group constraints or an index, and it never removes
the page of a deleted command, so internal/clidocs adds those around it. All
of it is read from the command, so there is no second catalogue to maintain.

Deterministic, so repeated generation from unchanged source produces identical
files:

  - cobra's generated-on timestamp is switched off on every command.
  - The NVKECTL_ and NKECTL_ variables are cleared before the tree is built.
    Two of `bootstrap site`'s flag defaults -- --diagnostics-dir and --timeout
    -- are read from the environment by the command constructor, through
    internal/envalias, which still honours the old prefix. Without this the
    pages would record whatever the generating shell happened to have set.
  - HOME and the XDG config directory are pinned, and the build metadata is a
    fixed placeholder.

Generation runs no command and contacts nothing: it builds the tree and reads
its metadata, so it needs no credential, kubeconfig, configured site or
cluster. newRootCmd is exported for it, which is what the move to an
importable package was for.

`make -C cli docs` regenerates and `make -C cli docs-check` verifies, failing
on output that is stale, missing, obsolete, or newly generated and never
committed. The check joins the generated-artefact gate, which already covers
the provisioned-provider manifest and the generated API code, and joins
`make gate` and `make preflight` locally.

Two commands lazily added by cobra needed initialising before the traversal,
or the root page would link to pages that were never written: `help` and
`completion`. cobra's doc package also calls InitDefaultHelpCmd on every
command it renders, not just the root, which invented a `help` subcommand
under each group command -- `nvkectl bootstrap help` is not a command -- so
each one is given a hidden help command first to decide what cobra adds.

Hidden commands and help topics are excluded, which is why `render` and
`inspect` do not appear; a deprecated command keeps its page for as long as it
still runs.

Constraints enforced inside RunE are invisible to cobra. Those on `config
set-site` and the two patch commands are now stated in the flag usage strings
and Long text, so --help and the reference agree. No behaviour changes: the
checks still run where they did, with the messages they had.

cobra/doc brings go-md2man and blackfriday into cli/go.mod. Neither is
reachable from ./cmd/nvkectl, so the shipped binary is unaffected and
THIRD_PARTY_NOTICES.md is unchanged.

Signed-off-by: Jonathan Meier <jomeier@nvidia.com>
2026-10-19 14:27:19 -04:00
Davanum Srinivas 647fcdf595 docs: fix what an end-user walk of the published site found (#1747)
* docs: repair links and anchors that break on the published site

Seventeen relative links pointed at repository files outside docs/index.yml, which the site does not serve, and two anchors named a heading that does not exist. Point them at navigation pages or at the files on GitHub.

Signed-off-by: Davanum Srinivas <dsrinivas@nvidia.com>

* docs(install): say when to install without --release

The artifacts page says a Release from NVKR's maintained Definition is refused, but the install commands pass --release by default. Name that case where the commands are.

Signed-off-by: Davanum Srinivas <dsrinivas@nvidia.com>

* docs: correct statements that contradict the code

The OIDC verify step read a label the controller deletes. Five other pages described the sitespec default, scale-down, config restarts, an error prefix and a reserved prefix differently from the code.

Signed-off-by: Davanum Srinivas <dsrinivas@nvidia.com>

* docs(nktp): fix the verification steps and the host-process guide

The management-cluster verification queried the old trace service name and expected ten certificates where the chart default makes 21. The host-process guide named the wrong Collector, one page kept a site-controller phrase, and a design page misspelled pseudocommand.

Signed-off-by: Davanum Srinivas <dsrinivas@nvidia.com>

* docs: use the repository callout syntax and unbreak the sitespec table

GitHub alert markers render as literal text on the site, and a paragraph with no blank line before it landed inside the schema table.

Signed-off-by: Davanum Srinivas <dsrinivas@nvidia.com>

* docs(nktp): add the registry login and say where the chart versions are

The install command named no version and fails with unauthorized when the registry wants a login.

Signed-off-by: Davanum Srinivas <dsrinivas@nvidia.com>

* docs: drop the unused catalog entry from the API layout

Both Catalog operations are x-fern-ignore, so Fern logs the identifier as unknown.

Signed-off-by: Davanum Srinivas <dsrinivas@nvidia.com>

* docs: say in one sentence that a config change needs a restart

Wording from the review of #1747: the file is read once at startup, so restart NVKE after you change it.

Signed-off-by: Davanum Srinivas <dsrinivas@nvidia.com>

---------

Signed-off-by: Davanum Srinivas <dsrinivas@nvidia.com>
2026-10-19 07:06:59 -04:00
Eric ChapmanandClaude Opus 5.5 f0a043d73e docs: call NVKE's cluster the management cluster, not the site controller (#1744)
Replace "site controller" with "management cluster" (the cluster) or
"management plane" (the NVKE API and controllers) in docs, CLI docs and
help text, examples, and deploy-path comments. Identifiers such as
nke.site-controller.internal, the site-controller e2e lane and the
dashboard UID are unchanged.

Supersedes #1737, which was closed so the launch batch had no ordering
dependency on #1733.

Signed-off-by: echapman13 <echapman@nvidia.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-18 17:37:06 -04:00
Eric ChapmanandClaude Opus 5.5 e6b0974b10 docs(nktp): rename NKTP to NVKE telemetry pipelines (#1733)
Expand NKTP as "NVKE telemetry pipelines (NKTP)" on first mention per
page, merge the two NKTP nav sections into one with a "Management
cluster telemetry" subsection, retitle the site-telemetry pages, and
rename the reference dashboard to "Reference - NVKE Management Cluster
Health". Chart name, label, paths, value keys and dashboard UID are
unchanged.

Signed-off-by: echapman13 <echapman@nvidia.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-18 09:59:39 -04:00
Pete MacKinnonandClaude Sonnet 4.6 ca7371ad3d docs: fix dead links and nav title mismatches on published site (#1656)
* docs: fix dead links and nav title mismatches on published site

Twenty links on five published pages pointed to files not in the site
navigation (module READMEs, root RELEASE.md, legacy docs/ pages). Fern
rewrites those relative links to raw .md URLs that return soft-404s.
Replace them with github.com/dsx-ai-factory/nvke/blob/main/... URLs.

Ten entries in docs/index.yml had page: names that differed from the
page's # heading. Align them so the sidebar title and the page heading
match. The controller/docs/configuring-api-authentication.md entry is
left unchanged — it is owned by in-flight PR #1161.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Signed-off-by: Pete MacKinnon <mackinnon.pd@gmail.com>

* docs: quote site-telemetry nav entries containing colons

YAML plain scalars cannot contain `: ` (colon-space), which would be
parsed as a nested mapping key-value pair. Quote the five Site Telemetry
page names that use the "Telemetry on a site controller: ..." pattern.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Signed-off-by: Pete MacKinnon <mackinnon.pd@gmail.com>

* docs: fix dead NVKR links after definitions/ moved to inputs/

dsx-ai-factory/nvkr#175 moved authored inputs from definitions/ to
inputs/, leaving four links 404. Update all references in
build-node-images.md and supported-platforms.md.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Signed-off-by: Pete MacKinnon <mackinnon.pd@gmail.com>

* docs: correct NVKR paths after inputs/definitions/ restructure

The previous commit used inputs/nvke-m2/ and inputs/nvke-os/ but
nvkr#175 placed them under inputs/definitions/:

  definitions/nvke-m2/README.md  -> inputs/definitions/nvke/README.md
  definitions/nvke-os/README.md  -> inputs/definitions/diagnostics/README.md

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Signed-off-by: Pete MacKinnon <mackinnon.pd@gmail.com>

---------

Signed-off-by: Pete MacKinnon <mackinnon.pd@gmail.com>
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-10-16 14:32:39 -04:00
MilanandClaude Opus 5.5 144fc99a67 feat(cli): show NicoIdentity credential health in get providers (#1602)
* feat(cli): read and classify NicoIdentity credential health

Add a credentials package that lists a provider's Identity objects through
the Kubernetes dynamic client and classifies the one naming the provider's
credentials Secret as HEALTHY, FAILING, UNKNOWN, STALE, PENDING, NO-IDENTITY,
UNSUPPORTED or UNREADABLE. It reads only the status the provider's manager
publishes, never triggers a check or reads the Secret, and treats a result
older than ten minutes as stale. The provider registry now records NICo's
NicoIdentity kind and the manager flags that limit what the manager watches.
util gains FormatDuration so ages can be formatted against an injected clock.

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Milan Landaverde <mlandaverde@nvidia.com>

* feat(cli): show credential health in get providers

nvkectl get providers now adds CREDENTIALS and LAST CHECK columns that
report the provider's own last credential check and how long ago it ran,
so operators can tell working credentials from a Secret that merely
exists. STATE, every existing JSON field and the exit code are unchanged;
-o json and -o yaml gain an additive credentials object for providers that
publish an Identity. The Identity client is built only when the Identity
CRD is established, and DETAIL keeps explaining STATE problems before
credential health. The help text lists each value and marks the command
alpha.

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Milan Landaverde <mlandaverde@nvidia.com>

* docs: document the credential health columns in get providers

Explain the CREDENTIALS and LAST CHECK columns of nvkectl get providers:
what each value means, the 10-minute staleness rule, and that nvkectl reads
the provider's own check instead of running one. The CLI README lists the
new permission, list on nicoidentities, and shows the NicoIdentity that
turns NO-IDENTITY into a reported result. The FAQ no longer calls CONFIGURED
a healthy NICo site, names the CAPNICo Deployment the shipped manifest uses,
and gains an entry for credential health that is not HEALTHY.

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Milan Landaverde <mlandaverde@nvidia.com>

* docs: name UNREADABLE and PENDING where credential values are summarized

The site-bootstrap summary of the CREDENTIALS column named only NO-IDENTITY
and UNSUPPORTED as the alternatives to HEALTHY, but a kubeconfig that cannot
list NicoIdentity objects reads UNREADABLE. Name all three, with the
condition behind each, in the order nvkectl checks them.

The operations FAQ's list for a CREDENTIALS value other than HEALTHY now
covers PENDING and UNREADABLE too.

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Milan Landaverde <mlandaverde@nvidia.com>

* docs: describe the credentials column in the operator guide

The operator guide said nothing checks the NICo token before the first
workload cluster, and its troubleshooting page had no entry for the new
CREDENTIALS column of nvkectl get providers.

Say that CREDENTIALS reports CAPNICo's own credential check when CAPNICo
serves NicoIdentity and a NicoIdentity names nico-credentials, and that it
reads UNSUPPORTED with the CAPNICo release the install deploys, which does
not serve NicoIdentity. Add a troubleshooting entry for a CREDENTIALS value
other than HEALTHY.

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Milan Landaverde <mlandaverde@nvidia.com>

* docs: say when CAPNICo checks the NICo token before credential health

The operator guide said nothing checks the NICo token until the first
workload cluster. CAPNICo checks it whenever it reconciles a NicoCluster
that belongs to a Cluster API Cluster, which can happen before any machine
exists. Say that, and that a workload cluster is what normally triggers it.

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Milan Landaverde <mlandaverde@nvidia.com>

---------

Signed-off-by: Milan Landaverde <mlandaverde@nvidia.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-16 10:48:08 -07:00
LiaandClaude Fable 5.1 8bcb48d4f9 feat(cli): the stack install reads a stack config file (#1682)
* feat(cli): the stack install reads a stack config file

The controller stack install takes its site-specific input from a JSON
file of its own, the stack config, loaded by the new
cli/internal/deploypath/stackconfig package: the NICo API and the optional
image overrides and mirror. The file is decoded strictly through
sigs.k8s.io/json, so an unknown, duplicate or differently cased key is
refused, as are a REPLACE_* placeholder, an empty required value, a null
object, an endpoint without a scheme or with a user and password, and a
mirror with a scheme. Every problem is reported at once as
"<json path>: <problem>", a stray key beside the value problems.

The credentials stay in the environment and move to the same package:
NVKECTL_NICO_TOKEN, NVKECTL_NODE_USER, NVKECTL_NODE_PASSWORD and
NVKECTL_DATABASE_PASSWORD are the stack install's input, not the site
spec's.

The site spec carries the bootstrap's fields only: the site name, the
control-plane VIP, the SPIRE trust domain and CA. The render reads both
files, --sitespec with --stack-config and neither without the other, and
takes the nodes' architecture from --arch, validated, for both the release
artifacts and the SPIRE TPM attestor checksum; without the flag the host's
architecture is used with a warning.

nvkectl inspect stack-config, a hidden reader like inspect sitespec,
validates the file and the credentials and prints STACK_CONFIG,
STACK_NICO_ENDPOINT and STACK_NICO_ORG_ID for the install scripts.
validate sitespec checks the site spec and prints "valid"; inspect
sitespec prints the three site facts. deploy/examples/stack-config.json is
the operator's starting point.

Co-developed-by: Claude <noreply@anthropic.com>
Signed-off-by: Lia Campbell <liac@nvidia.com>

* feat(deploy): the scripts take --stack-config and read the node architecture

check-site.sh and nvke-deploy.sh take the stack config beside the site
spec and refuse one without the other. Both start with an inputs line
that names the two files, the site and the NICo endpoint. The check
validates the stack config and the NVKECTL_* credentials through
nvkectl inspect stack-config and fails on nodes that report two
architectures or none. The executor reads the architecture from the
cluster and passes it to the render as --arch; --arch on the executor
stands in for the read, and a dry run with an unreachable API renders
for the host. The kind lane fills a stack config template next to the
site spec template. The deploy READMEs and the cli docs describe the
file.

Co-developed-by: Claude <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Signed-off-by: Lia Campbell <liac@nvidia.com>

* docs(operate): the install reads a stack config file

The install page gets a "Write the stack config" section with the
credentials step, the example file and every key. The inputs table,
the artifact-source table, the check and install commands, the
troubleshooting entries and the pages that link to the section follow.
The node architecture is read from the cluster, so no page asks for it.

Co-developed-by: Claude <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Signed-off-by: Lia Campbell <liac@nvidia.com>

---------

Signed-off-by: Lia Campbell <liac@nvidia.com>
Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
2026-10-15 17:54:58 -07:00
Abhinav Pandey 1ededf3bce refactor(cli)!: read site credentials from the environment and drop unused site spec fields (#1644)
The site spec describes the site, so it can be committed and used unchanged
on any machine. Credentials and machine-local file paths now come from the
environment of the command that needs them, and fields nothing consumed are
removed. A spec that still sets a removed field fails to load, and
generate sitespec --set refuses it, naming the replacement.

- spire.caCertFile/caKeyFile -> NVKECTL_SPIRE_CA_CERT_FILE/_KEY_FILE, with
  spire.upstreamCA: true recording that the site uses the CA; with it every
  run requires the variables, so none falls back to a self-signed root
- SPIRE_CA_CERT_FILE/SPIRE_CA_KEY_FILE are refused, naming their replacements
- controllerStack.nico.tokenFile -> NVKECTL_NICO_TOKEN
- controllerStack.tenant -> NVKECTL_NODE_USER, NVKECTL_NODE_PASSWORD
- controllerStack.database.passwordFile -> NVKECTL_DATABASE_PASSWORD; the
  render no longer generates and writes a password file, and the
  removed-field error names the old file whose contents to use
- controllerStack.nktpValuesFile -> nvke-deploy.sh --values-for nktp=<file>
- registry block, --registry-api-key and REGISTRY_* overrides removed: no
  code read them; private image pulls use nerdctl login
- validate sitespec checks the environment; bootstrap site logs the CA paths
- CI harnesses and docs follow the same inputs; the bootstrap e2e asserts a
  supplied CA is the root SPIRE publishes

Signed-off-by: Abhinav Pandey <abhinavmpandey08@gmail.com>
2026-10-15 16:07:51 -07:00
Miancheng Lin 3317737e1e refactor(api): rename the OS profile surface to releases (#1612)
* refactor(api): rename the OS profile surface to releases

/osProfiles becomes /releases and nico.osProfile becomes nico.release, so
the REST API uses the release vocabulary the rest of the management plane
already does. Internal db and workflow structs keep their field names.

Signed-off-by: Miancheng Lin <mianchengl@nvidia.com>

* refactor(controller): rename the OS profile to the release

Nico payloads gain a release key. os_profile is still written alongside
it and still read as a fallback, so a CWE predating the rename keeps
reading and writing the value through a rolling upgrade or a rollback.
No stored data changes. A later release backfills release from
os_profile, then drops the mirror and the fallback.

The os_profile Prometheus label is deliberately unchanged.

Signed-off-by: Miancheng Lin <mianchengl@nvidia.com>

* docs: follow the OS profile rename

The request YAML in the workload-cluster guides named a field the API no
longer accepts, and two troubleshooting entries quoted error text that no
longer appears. The dashboard panel descriptions in operate/observe.md
keep the old wording: the panels and the os_profile metric label they
read are unchanged.

Signed-off-by: Miancheng Lin <mianchengl@nvidia.com>

* fix(scripts): read cluster NICo fields from .nico and allow an absent configProfile

The cluster-level orgID, siteID and vpcID live under .nico in the API
response, as the node pool fields already corrected do, so the script
exited before generating anything. configProfile is optional in the same
schema, and requiring it skipped a valid node pool.

Signed-off-by: Miancheng Lin <mianchengl@nvidia.com>

---------

Signed-off-by: Miancheng Lin <mianchengl@nvidia.com>
2026-10-15 11:56:35 -07:00
Lia 1dbd483a98 docs: the install pages follow the operator guide; the Deploy Path reference (#1616)
* docs: the install guide, the deploy README and the pages that point at the install

docs/site-bootstrap/install-site-controller.md describes
deploy/nvke-deploy.sh install: its inputs, the six steps, removal,
upgrade and the GitOps mapping. deploy/README.md lists every flag and
variable of the script. The first-cluster page, the docs index and the
site-bootstrap pages that pointed at deploy/install.sh point at the
command. The site spec reference and the e2e README no longer mention
a registry pull secret.

Co-developed-by: Claude <noreply@anthropic.com>
Signed-off-by: Lia Campbell <liac@nvidia.com>

* docs(cli): user-flow follows the real order: release, site spec, bootstrap, one install command

The example starts with nvkr release verify and export, bootstraps the
site, then installs the controller stack with deploy/nvke-deploy.sh
install as one command. The deploy path is the interface and the script
is the reference executor; an operator can apply the items another way.
The command table replaces the two manual rows with that command, and
the dead README anchor is gone.

Co-developed-by: Claude <noreply@anthropic.com>
Signed-off-by: Lia Campbell <liac@nvidia.com>

* docs: deploy-repository.md describes the deploy path as implemented

The page described tooling that no longer exists: a Go binary that
cloned a deploy repository and shipped it to the init node, ArgoCD items
with sync monitoring, a BootstrapConfig with database and monitoring
fields, and a deploy/reference directory. It now describes deploy/nico:
nvke-deploy.yaml, the four item types as nvke-deploy.sh applies them,
the template context the site spec supplies, what a render adds, and
what another executor has to do. The pages that linked to it as a
GitOps repository are updated with it.

Co-developed-by: Claude <noreply@anthropic.com>
Signed-off-by: Lia Campbell <liac@nvidia.com>

* docs: nvkectl comes from the NVKR release; build from source without one

The release carries nvkectl as an executable output built from the same
commit as the controller image. The install page takes it from there:
read the output's reference from the release description, pull it, and
unpack the binary. Building from the clone stays as the path without a
release. The GitHub Releases download is gone.

Co-developed-by: Claude <noreply@anthropic.com>
Signed-off-by: Lia Campbell <liac@nvidia.com>

* docs: the install guide offers the script, by hand and GitOps; the overview sends readers to it

The install guide's Release section is a paragraph with deep links to
NVKR's release quickstart. The install itself is three options that
apply the same deploy path: the script, the six steps by hand, and
GitOps. The overview's after-bootstrap section no longer tells readers
to install Cluster API and a provider first; the install does that, and
the page lists it as the fourth step.

Co-developed-by: Claude <noreply@anthropic.com>
Signed-off-by: Lia Campbell <liac@nvidia.com>

* docs: the site spec page opens with its two parts and shows what validate says between them

The bootstrap part is all the bootstrap requires; the controllerStack
section is read by the install and can stay unfilled until then. The
validation section shows the output on a freshly generated spec: the
bootstrap line, the values still to fill in, and the non-zero exit that
says the bootstrap can run now.

Co-developed-by: Claude <noreply@anthropic.com>
Signed-off-by: Lia Campbell <liac@nvidia.com>

* refactor(deploy): drop the argocd item type; docs no longer say NVKE needs Argo CD

No deploy path has an argocd item and nothing tested the code that
applied one. A deploy path is template, manifest and helm items; a
GitOps tool delivers the same items, as the install guide's GitOps
option describes. The concepts, lifecycle and pre-provisioned-nodes
pages said the stack is managed by Argo CD and installed from a deploy
repository; they now point at the install from the deploy path.

Co-developed-by: Claude <noreply@anthropic.com>
Signed-off-by: Lia Campbell <liac@nvidia.com>

* docs: the install guide no longer lists an untaint step

The bootstrap removes the control-plane taint; the readiness check
reports one that is left.

Co-developed-by: Claude <noreply@anthropic.com>
Signed-off-by: Lia Campbell <liac@nvidia.com>

* docs: the install guide separates what the install does from what the operator does

Five steps: readiness, Cluster API, the site controller, secure, verify.
The StorageClass, the site registration and the client network policy
are the operator's, listed after the install with the commands. The
deploy README, the user flow and the nico README match.

Co-developed-by: Claude <noreply@anthropic.com>
Signed-off-by: Lia Campbell <liac@nvidia.com>

* docs: the site controller install is a list of commands

check-site.sh, clusterctl init, the executor, the release resources, the
exec-auth patch, then set-site and the network policy on the operator's
machine, each a command that stands on its own. The install guide gives
them in order with what each one does, how to take the executor apart,
and how a GitOps tool delivers the same items. The deploy README
describes check-site.sh and the executor; the user flow, the nico README
and the pages that pointed at a single command point at the list.

Co-developed-by: Claude <noreply@anthropic.com>
Signed-off-by: Lia Campbell <liac@nvidia.com>

* docs: review fixes on the install pages

The removal section deletes the stack's namespaces and says what that
removes and what stays. The lifecycle page no longer installs CAPNICo a
second time. The credential claims are limited to the controllerStack
file paths, with registry.apiKey left to the environment. The values
order names the files a render adds. The CLI's plain-HTTP NodePort is
called out as trusted-network only. jq and oras are named where the
release download uses them.

Co-developed-by: Claude <noreply@anthropic.com>
Signed-off-by: Lia Campbell <liac@nvidia.com>

* docs: review fixes on the install list

The release resources are published with nvkectl create, after the
site is registered; they are not manifests. The hand-apply and GitOps
recipes name helm dependency build for a path chart with a Chart.lock,
chart.setFile entries, and the nktp-cluster ConfigMap the base-config
item renders. The removal block pins its kubeconfig. The Deploy Path
page names the executor's one subcommand and says where an unknown item
type is refused. The first-cluster page folds the separate Cluster API
and CAPNICo install into the install guide's list and registers the
plain-HTTP NodePort. The nvkectl download filter accepts a description
whose executable output declares no architecture. Anchors fixed.

Co-developed-by: Claude <noreply@anthropic.com>
Signed-off-by: Lia Campbell <liac@nvidia.com>

* docs: nvkectl create writes the release resources through the site kubeconfig

The step needs the registration, which records the kubeconfig, and not
the network policy, which admits clients to the controller API.

Co-developed-by: Claude <noreply@anthropic.com>
Signed-off-by: Lia Campbell <liac@nvidia.com>

* docs: second review round on the install pages

The nico README publishes the release resources with nvkectl create
after set-site and leaves the taint to the bootstrap and the check. The
Deploy Path page names the executor's subcommand in its two examples.
The concepts page describes the PostgreSQL item rather than CNPG and
no longer names Argo CD as the GitOps controller. The local-run
sentence says what still comes from a repository and where images
land. The check prints the commands that remain. The GitOps section
says the render writes the per-site values. The validate sample shows
the trust-domain line. The custom base OS page no longer downloads
nvkectl from GitHub Releases.

Co-developed-by: Claude <noreply@anthropic.com>
Signed-off-by: Lia Campbell <liac@nvidia.com>

* docs: the install pages that stay point at the operator guide

The legacy site-bootstrap pages are left as they are on main; the
operator guide under docs/operate describes the install. The CLI docs,
the deploy READMEs, the concepts, lifecycle and first-cluster pages and
the Deploy Path reference link to it. The install page publishes the OS
release resources with nvkectl create after nvkectl points at the API,
and the artifacts page writes them as the metadata-and-spec documents
that command takes; the check's description names the kubeadm
providers it confirms.

Co-developed-by: Claude <noreply@anthropic.com>
Signed-off-by: Lia Campbell <liac@nvidia.com>

* docs: two links follow the install guide to the operator pages

Co-developed-by: Claude <noreply@anthropic.com>
Signed-off-by: Lia Campbell <liac@nvidia.com>

* docs: third review round on the install pages

The executor's parser no longer accepts argocd, so both parsers refuse
an unknown type before anything is applied, as the Deploy Path page
says. The command lists in the deploy README and the user flow include
the NetworkPolicy step. The first-cluster page publishes a second
release rather than the first. The artifacts page lists nvkectl among
its prerequisites and names the kubeconfig the publish goes through.
The check prints the commands that remain. The deploy README's Cluster
API and egress rows say what the check reads.

Co-developed-by: Claude <noreply@anthropic.com>
Signed-off-by: Lia Campbell <liac@nvidia.com>

---------

Signed-off-by: Lia Campbell <liac@nvidia.com>
2026-10-14 11:59:55 -07:00
Chao 6bc0e1c9e8 fix(agent): rename node agent package and contracts to nvke (#1565)
* fix(agent): rename node agent package and contracts to nvke

Signed-off-by: Chao Chen <chaoch@nvidia.com>
2026-10-12 14:14:32 -07:00
LiaandClaude Fable 5.1 6334975cdf feat(cli): the site spec carries the controller stack install input (#1429)
The site spec gains an optional controllerStack section: node
architecture, the NICo API, the registry pull secret, the tenant login
and paths to the files that hold tokens and passwords. generate sitespec
writes it with REPLACE_* placeholders, bootstrap site lists the ones still
in the file, and nvkectl validate sitespec checks the whole file by
section, so the install refuses a placeholder.

Co-developed-by: Claude <noreply@anthropic.com>

Signed-off-by: Lia Campbell <liac@nvidia.com>
Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
2026-10-12 10:26:02 -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
Davanum SrinivasandClaude Fable 5.1 668bc38a9b feat(cli)!: rename nkectl to nvkectl, keeping the old names for one release (#1456)
The binary, its directory, its config directory and its environment
variables take the new name. For one release the previous names still
work: every NVKECTL_* setting is also read under its NKECTL_* name with a
deprecation warning (the NKECTL_CWE_* names of the generation before are
no longer read), a config file left under nkectl/ is read and copied to
nvkectl/ once, and releases publish both nvkectl-<os>-<arch> and
nkectl-<os>-<arch>, to GitHub and to S3 under the existing prefix.

The e2e helper package, the e2e test, the smoke and fetch scripts and
the bootstrap e2e workflow follow the binary; the fetch script accepts a
release that carries only the old asset name. The CLI's own documents
and the two installation documents that print the download URLs change
with it.

Kept on purpose: the NVCR repository name until an nvkectl repository
exists in the NGC org, the S3 prefix the publishing role's policy names,
and the prose in the other documents.

BREAKING CHANGE: the CLI is installed and invoked as nvkectl. The
previous binary name, environment variable names and config directory
are honoured for one release, as described above.

Closes #1455

Signed-off-by: Davanum Srinivas <dsrinivas@nvidia.com>
Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
2026-10-10 17:04:03 -04:00
Davanum SrinivasandClaude Fable 5.1 4409efc29b build: move the Go module paths and repository URLs to dsx-ai-factory/nvke (#1449)
The repository was renamed from dsx-ai-factory/nke to dsx-ai-factory/nvke
on 2026-10-10. Its id is unchanged, so guards, rulesets, environments and
the OIDC subject carried over, and GitHub redirects the old URLs. The
tree still named the old repository where the name is a contract rather
than a URL: the module lines of the 12 Go modules and about 1,700 import
lines, the proto go_package (embedded in node_agent.pb.go, regenerated
here), both THIRD_PARTY_NOTICES.md files (regenerated), the lint
local-prefix and depguard entries, ldflags, the go-licenses ignore lists,
the documented repository URLs and gh commands, and the
ghcr.io/dsx-ai-factory/nke image paths in workflows, the chart default
and the e2e defaults.

Only the organisation and repository segments change. Directories,
identifiers, binary, image, chart, package, label, namespace and
environment variable names, the CODEOWNERS team slugs and CHANGELOG.md
stay as they are.

Closes #1448

Signed-off-by: Davanum Srinivas <dsrinivas@nvidia.com>
Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
2026-10-10 16:03:26 -04:00
Aaron PattenandTerry Howe b4e6656ff6 docs: say controller, not CWE, in the published pages (#1405)
* docs: say controller, not CWE, in the published pages

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

* docs: name the NKE controller on first mention and say NICo, not Forge

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

* Update docs/qualification/hardware-lane.md

Co-authored-by: Terry Howe <thowe@nvidia.com>
Signed-off-by: Aaron Patten <apatten@nvidia.com>

* Update docs/architecture.md

Co-authored-by: Terry Howe <thowe@nvidia.com>
Signed-off-by: Aaron Patten <apatten@nvidia.com>

* Update docs/architecture.md

Co-authored-by: Terry Howe <thowe@nvidia.com>
Signed-off-by: Aaron Patten <apatten@nvidia.com>

* Update docs/architecture.md

Co-authored-by: Terry Howe <thowe@nvidia.com>
Signed-off-by: Aaron Patten <apatten@nvidia.com>

* docs: keep Forge naming and call the hardware lane's site the site controller machine

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

---------

Signed-off-by: Aaron Patten <apatten@nvidia.com>
Co-authored-by: Terry Howe <thowe@nvidia.com>
2026-10-09 18:20:49 +00:00
Anisha Gupta USandClaude Opus 5.5 f914db3ddd docs(cli): add a bootstrap troubleshooting guide (#1082)
* docs(cli): add a bootstrap troubleshooting guide

Add cli/docs/bootstrap-troubleshooting.md for operators whose
`nkectl bootstrap site` run failed: where the evidence is (terminal
output, the diagnostics directory, the retained bootstrap cluster, the
nodes), how to read the wrapped error chain, the common failures by
phase with their fixes, and when it is safe to re-run.

Link it from the docs index, the user flow, the first cluster guide and
the pre-provisioned nodes troubleshooting section.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Anisha Gupta <anisgupta@nvidia.com>

* docs(cli): put the retained-cluster warning before the delete command

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Signed-off-by: Anisha Gupta <anisgupta@nvidia.com>

* docs(cli): use the nke-controller namespace and deployment names

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Signed-off-by: Anisha Gupta <anisgupta@nvidia.com>

* docs(cli): refer to the controller instead of the engine

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Signed-off-by: Anisha Gupta <anisgupta@nvidia.com>

* docs(cli): point registry auth failures at the credential, not a login step

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Signed-off-by: Anisha Gupta <anisgupta@nvidia.com>

* docs(cli): say where the registry credential comes from for a failed pull

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Signed-off-by: Anisha Gupta <anisgupta@nvidia.com>

* docs(cli): name the incorrect login token as the registry auth cause

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Signed-off-by: Anisha Gupta <anisgupta@nvidia.com>

* docs(cli): tighten the reset, attestation and key-recovery guidance

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Signed-off-by: Anisha Gupta <anisgupta@nvidia.com>

* docs(cli): require the root login shell for the registry check

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Signed-off-by: Anisha Gupta <anisgupta@nvidia.com>

* docs(cli): use the NKECTL_CONTROLLER_* names and the current missing-image error

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Signed-off-by: Anisha Gupta <anisgupta@nvidia.com>

* docs(cli): drop the registry-specific token example from the pull failure entry

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Signed-off-by: Anisha Gupta <anisgupta@nvidia.com>

---------

Signed-off-by: Anisha Gupta <anisgupta@nvidia.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-09 12:17:24 -04:00
LiaandClaude Opus 5 b759bd5ea6 docs(bootstrap): make the site bootstrap guides match nkectl (#667)
* docs(site-bootstrap): state the CLI tools, endpoints and flags bootstrap needs

The prerequisites named kind and nerdctl but not helm, kubectl and clusterctl,
which the bootstrap shells out to for the Helm releases, the manifests, and
`clusterctl init`. Only the container runtime is pre-flighted, so a missing one
of these surfaces mid-bootstrap once the Kind cluster is already up. The
outbound hosts the run needs (go.temporal.io, spiffe.github.io, github.com for
clusterctl, and the image registries) were also unstated.

The two images are loaded from containerd's store; one with a registry host is
pulled with nerdctl first, so the host-level `nerdctl login` is what makes a
registry image work. Say so next to the example.

Correct the teardown claim (the Kind cluster is kept on a post-create failure or
under --keep-bootstrap-cluster, not torn down unconditionally), name SPIRE and
the Cluster API providers in the deployment order, and add a table for the
flags with operational impact that were documented nowhere.

Signed-off-by: Lia Campbell <liac@nvidia.com>
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>

* docs(first-cluster): put nkectl on PATH and correct the failure behaviour

Step 1 builds with `make -C cli build`, which writes cli/bin/nkectl (BINARY :=
bin/nkectl). Every step after it called `nkectl` unqualified, so path C broke at
step 2 with "command not found". Export the path, and say the alternative.

The failure note claimed the seed cluster is always left behind. It is kept only
under --keep-bootstrap-cluster or when the run fails after the site cluster was
created; the commoner early failures -- a missing image variable, a failed pull,
an unhealthy CWE -- tear it down. Readers were being told to delete a cluster
that usually is not there.

Name --timeout and --diagnostics-dir, which the section described the effects of
without ever naming, and add helm/kubectl/clusterctl to the prerequisites for
the same reason as the site-bootstrap page.

Signed-off-by: Lia Campbell <liac@nvidia.com>
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>

* docs(site-bootstrap): fix the overview's teardown claim

The overview repeated the unconditional teardown claim corrected in the previous
two commits, omitted SPIRE and the Cluster API providers from the list of what
bootstrap installs, and did not say that --timeout (default 30m) bounds the
provisioning wait.

Signed-off-by: Lia Campbell <liac@nvidia.com>
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>

* docs(site-bootstrap): run nkectl in the same mode as the agents, and make the cloud-init example runnable

The pre-provisioned-nodes guide configures every nke-agent with
--disable-mtls but ran `nkectl bootstrap site` without it, so CWE dialled
plaintext agents over mTLS and never connected. Pass --disable-mtls on the
nkectl side too, say plainly that this is the development-only plaintext
mode, and point at first-cluster.md path C for the attested path.

The custom-base-os cloud-init ran nkectl with none of the three required
image variables, no container runtime or CLI dependencies on the host, and
a v1.32 Kubernetes repository against a 1.34.2 site spec. Name all of it.

Also: verify with the kubeconfig the command writes, stop telling operators
to keep a Kind cluster that is gone by the time the command returns, list
the TPM and SPIRE fields and their env overrides in configuration.md, add
helm/kubectl/clusterctl and the rootful-nerdctl note to installation.md,
publish the darwin-amd64 download, and put SPIRE and Cluster API in the
overview diagram.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Signed-off-by: Lia Campbell <liac@nvidia.com>

* docs(cli): document what bootstrap site actually needs and does

The README predates the move to nerdctl and the provisioned provider: it
named two of the three required images, never mentioned nerdctl, said the
CWE image had to be pulled by hand, that SPIRE was unreachable from outside
the Kind cluster, that the cluster is torn down on every exit path, and
that get providers reads Secrets in nke-system. Correct each against the
code, list every env knob the command reads, and add the commands and
flags the quick reference left out. Drop `describe` from user-flow.md; the
command no longer exists.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Signed-off-by: Lia Campbell <liac@nvidia.com>

* docs(first-cluster): give the real reason nerdctl must be rootful

nkectl installs no iptables rule and assigns no bridge address; the e2e
harness does. What nkectl does is exec a bare nerdctl with no sudo, as does
kind's nerdctl provider, and rootful is the only configuration CI exercises.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Signed-off-by: Lia Campbell <liac@nvidia.com>

* docs(site-bootstrap): say the nke-agent apt repository is not published yet

Step 1's node-agent block reads as four runnable commands, and none of them
work: packages.nvidia.com/nke serves neither the key nor the suite.

    $ curl https://packages.nvidia.com/nke/nke-apt-public.key
    <Error><Code>NoSuchKey</Code><Key>origin/nke/nke-apt-public.key</Key></Error>

HTTP 404, so the apt-get install that follows fails too. The page already
carried a TODO about confirming the URL before publishing, but it sat above
commands formatted as if they worked, and a reader runs them.

State plainly that the repository does not exist yet, and name the interim
route: build the agent from this repository and install it with a unit and an
/etc/default/nke-agent of your own, as controller/hack/capd-kindest-node/
already does for the bootstrap e2e's nodes. Keep the TODO, pointed at removing
the workaround rather than at confirming a URL.

Found by trying to follow the page from a clean machine.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Signed-off-by: Lia Campbell <liac@nvidia.com>

---------

Signed-off-by: Lia Campbell <liac@nvidia.com>
Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
2026-10-08 16:37:25 -07:00
Lia 878b6cab4b feat(nkectl): add --controller-image and --provisioned-provider-image (#1171)
* feat(nkectl): add --controller-image and --provisioned-provider-image

The two images `bootstrap site` side-loads could be named only through
NKECTL_CWE_IMAGE and NKECTL_CAPI_PROVISIONED_IMAGE. The flags name them
for one run, the way --registry-api-key pairs with REGISTRY_API_KEY: a
flag wins over its variable, and a variable wins over the manifest
default. The help text, the README table, the manifest header,
first-cluster.md, user-flow.md and pre-provisioned-nodes.md say so.

Co-developed-by: Claude <noreply@anthropic.com>
Signed-off-by: Lia Campbell <liac@nvidia.com>

* feat(nkectl): name the image flags in the errors and test them end to end

The three errors an operator can hit now name the flags beside the
variables. The precedence test covers both orderings for both images.
A command-level test drives the flags through runBootstrapSite and
checks the images they name are the ones loaded. README and Makefile
wording follows.

Co-developed-by: Claude <noreply@anthropic.com>
Signed-off-by: Lia Campbell <liac@nvidia.com>

---------

Signed-off-by: Lia Campbell <liac@nvidia.com>
2026-10-07 12:34:37 -07:00
Aaron PattenandClaude Opus 5.5 020e5da7f7 feat(nkectl): install the bootstrap controller as nke-controller (#1158)
`nkectl bootstrap site` installs its controller under the name greenfield
sites use. The namespace, Helm release, fullname, pod name label and
ServiceAccount are all nke-controller, and so are the SPIRE admin ID, both
ClusterSPIFFEID namespace selectors and the external NodePort Service. The
chart pins nameOverride and serviceAccount.name, so the bootstrap values set
both alongside the fullname.

nkectl authentication reads nke-auth-config from nke-controller, then from
cloud-workflow-engine, so it works against a site of either naming. Only
NotFound moves on to the next namespace.

The bootstrap e2e checks that the controller runs as nke-controller and that
SPIRE issues its SPIFFE ID.

Signed-off-by: Aaron Patten <apatten@nvidia.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-02 12:17:41 -07:00
Davanum Srinivas 2a7c3fb2cc docs(api): generate the REST API Reference from openapi.yaml (#1172)
* chore(api): lint openapi.yaml and mark the internal surface for Fern

Fern builds the REST API Reference tab of the documentation site from
controller/api/openapi.yaml, and the docs team is about to move the prose
of the "NKE REST API Reference" into that file. This is the tooling that
has to be in place first.

Lint gate. `make -C controller/api lint` now also runs `lint-spec`, which
lints openapi.yaml with vacuum against openapi-lint.yaml. vacuum is a
Spectral-compatible linter written in Go, so `go run` pins it the way
generate.go pins gofumpt, with no install step; the version lives in
make/tool-versions.mk with the other tools. Errors fail the gate: every
example matches its schema, no component is unused, operationIds are
unique. Warnings measure the prose the spec still lacks (16 operations
and 40 properties without a description, 31 schemas, no tags) and fail
nothing yet; each is raised to error once the prose port lands, so that
coverage cannot regress afterwards. Rules the API breaks on purpose
(camelCase paths and properties, a DELETE with a body, extensions beside
`$ref`) are off, with the reason beside each.

The one error it found is fixed here: the `nodePools` example on
CreateClusterRequest named a `namePrefix` field that does not exist and
had neither `name` nor `nodeNamePrefix`, both required.

Internal surface. The `infra` provider, `teleportEnabled`, the legacy
`controlPlane` node-pool flag, the `/osProfiles` and `/configProfiles`
endpoints, and the schemas only they reach now carry `x-fern-ignore:
true`. Fern leaves them out of the published reference; Swagger UI at
/api/docs/ and the generated Go are unchanged. `x-fern-audiences` was the
first choice and does not fit: `fern ir --audience public` returns an
empty API unless every element is tagged, so a new endpoint would vanish
from the customer docs by default. The ignore marker is opt-out, and the
IR confirms it removes exactly the listed items.

The two "exactly one of `nico` or `infra`" sentences move from the schema
descriptions onto the `infra` properties, so the published reference,
which does not show `infra`, no longer refers to it. Only comments change
in the generated Go.

Signed-off-by: Davanum Srinivas <dsrinivas@nvidia.com>

* fix(api): keep `infra` out of the text the customer reference shows

The previous commit moved the "exactly one of `nico` or `infra`" sentences
onto the `infra` properties and said the published reference no longer
refers to `infra`. That was wrong on two counts, found by rendering the
spec with Redoc and dumping Fern's intermediate representation.

A description written beside a `$ref` is read by Fern and ignored by
Redoc, Swagger UI and oapi-codegen, which show the referenced schema's
description instead. So is `x-go-type-skip-optional-pointer` beside a
`$ref`: the generated field was a pointer all along. And six schema
descriptions that Fern does show still named `infra`: the control-plane
create and update configs, the node pool update request, and the three
NICo provider schemas.

Those six no longer mention the other provider. The exclusivity rule now
lives on the Infra* schemas, which the published reference omits and
Swagger UI shows. The four `nico` and `infra` properties touched before
wrap their `$ref` in `allOf`, so every reader applies the description, and
drop the pointer extension that was never in effect; the generated Go
changes only in comments. no-$ref-siblings moves from off to warn, with
an accurate note, so the docs port can work the remaining 28 down.

Verified: Fern IR has 0 docs strings mentioning `infra`; Redoc shows the
new `nico` text and none of the old sentences; make -C controller/api
lint passes with 0 errors.

Signed-off-by: Davanum Srinivas <dsrinivas@nvidia.com>

* docs(api): port the REST API Reference prose into openapi.yaml

The docs team wrote "NKE REST API Reference (Alpha) - Customer Edition"
by hand. This moves its language into the spec, so the reference is
generated from the file the code is generated from. The text is taken
as written; claims the code contradicts are corrected in the commits
that follow, each with its evidence, so the review can see both.

What moved: the info block (title, version, and the conventions: base
URL, authentication, errors, asynchronous operations, PATCH merge
semantics, lists, unauthenticated endpoints); tags carrying the concept
text (infrastructure provider, Kubernetes versions, networking, control
plane, OS releases); a summary, a description and the documented 400
and 409 rules for each of the 22 operations; request examples for the
five writes and response examples for the error cases the PDF shows;
path and query parameter text; and a description for every schema and
property.

Structure is unchanged: no required list, enum, pattern or bound moved,
no schema was renamed, and the health endpoints stay out of `paths`.
They are described in the info block instead, because the generated
router would mount them under /api. Every property whose `$ref` had
sibling keys now wraps the `$ref` in `allOf`: Redoc, Swagger UI and
oapi-codegen ignore the siblings and Fern reads them, so this is the
only form all four render. The `x-order` and
`x-go-type-skip-optional-pointer` keys beside those `$ref`s are dropped,
since neither ever applied there. The generated Go changes only in
comments; struct fields keep their order.

vacuum reports no warnings left. Its coverage rules are raised to
errors in a later commit.

Signed-off-by: Davanum Srinivas <dsrinivas@nvidia.com>

* docs(api): configProfile is required, the PDF left it out

The PDF never mentions `nico.configProfile`, and its create examples omit
it. The server requires it: a NICo node pool without one is rejected
("nico.configProfile is required when creating a nico node pool",
controller/internal/server/node_pools.go:298), and so is a control plane
("controlPlaneConfig.nico.configProfile is required for a nico cluster
control plane", cluster_control_plane_config.go:206 and :239). Every
example in the PDF would have failed with 400.

The field is now described as required on the node pool and control-plane
create schemas, the two create operations list it among their 400 causes,
and the three request examples carry it.

Signed-off-by: Davanum Srinivas <dsrinivas@nvidia.com>

* docs(api): describe OS profiles as the controller resolves them today

The PDF describes `osProfile` as the name of a release in an Operator
curated catalog of MachineImage, ClusterRelease and NodePoolRelease
entries, managed with nkectl. Those kinds exist as CRDs in
management-engine/ (#1085, 2026-09-29), but nothing consumes them yet:
management-engine/README.md says lifecycle reconciliation and the public
API are not implemented, and the controller still reads OS profiles from
its profiles directory (controller/internal/server/os_profiles.go:35),
supplied by the Operator as described in controller/profiles/README.md.

The reference now says what the API does today: `osProfile` and
`configProfile` name profiles the Operator supplies to the management
plane, and changing `osProfile` rolls the affected nodes. The catalog
text returns when the controller resolves names against it. Example
names follow the example bundle in controller/profiles/example.

Signed-off-by: Davanum Srinivas <dsrinivas@nvidia.com>

* docs(api): use the server's real error messages in the examples

Three error examples in the PDF are paraphrases. The server says:
"cluster update rejected: <op> in progress since <time>"
(controller/internal/server/clusters.go:67), "Cannot create node pool
when parent cluster is deleting" (node_pools.go:173), and for a
control-plane delete that would breach the minimum, the sentence in
controller/internal/nodes/control_plane_delete_request.go:57.

ClusterConditions also listed `upgrading` as required, a property the
schema does not define. The PDF's required list (provisioning,
provisioned, deleting) is the correct one. Nothing in the generated Go
refers to it, so only the spec changes.

Signed-off-by: Davanum Srinivas <dsrinivas@nvidia.com>

* chore(api): make the OpenAPI prose coverage rules errors

With the REST API Reference prose in the spec, vacuum reports nothing.
The coverage rules that were warnings so the gate could land first now
fail the gate: every operation, parameter, schema and property has a
description, and no description sits beside a bare `$ref`.

Signed-off-by: Davanum Srinivas <dsrinivas@nvidia.com>

* docs(api): quote the node-name pattern so renderers do not eat the angle brackets

Redoc rendered "Node names are <cluster>-<prefix>-<NNNN>" as "Node names are --":
markdown treats the angle brackets as HTML tags. Backticks keep them.

Signed-off-by: Davanum Srinivas <dsrinivas@nvidia.com>

* docs: make fern check pass and pin the Fern CLI

`fern check` could not run: fern/docs.yml named a `components` directory
that does not exist in the repository, so the checker failed to
initialize. With that line gone it ran, and reported three broken links,
all pointing at repository directories the documentation site cannot
serve. They now point at the directories on GitHub.

fern/fern.config.json pinned the CLI to `latest`; it now pins the version
CI runs, which make/tool-versions.mk carries as FERN_VERSION. Related:

Signed-off-by: Davanum Srinivas <dsrinivas@nvidia.com>
#330.

* ci(api): render the REST API Reference with Redocly and check the docs site

`make -C controller/api docs` renders openapi.yaml into one self-contained
HTML page with Redocly. It bundles first, because `build-docs` applies no
decorators, and redocly.yaml's `remove-x-internal` decorator is pointed at
`x-fern-ignore`, so the page drops the same surface the Fern site drops.
The output lands in controller/.local/, which git ignores. Node is
required; npx fetches the pinned CLI.

The new `API docs` workflow is advisory: it builds that page on every pull
request that touches the spec or the docs and uploads it as the
`api-reference` artifact, runs `fern check`, and on main publishes the
Fern site when FERN_TOKEN is set. The secret is not configured yet, so
that step is skipped and says so. Publishing needs a secret, which the
workflow design guide keeps out of the required gate; that is why this is
not a merge-gate member.

Both CLIs are pinned in make/tool-versions.mk. The runner's preinstalled
Node is used rather than a new pinned setup action.

Signed-off-by: Davanum Srinivas <dsrinivas@nvidia.com>

* fix(api): keep request-schema $ref properties bare

Wrapping a request property's `$ref` in `allOf` changed the 400 body.
kin-openapi reports a failure inside an `allOf` as a raw schema error,
"Error at \"/controlPlaneConfig\": Doesn't match schema \"not\"" followed
by a dump of the schema, instead of the one-line "request body has an
error: ..." message, and the middleware passes it through whole.
TestOpenAPIValidator_CreateRequiresExactlyOneProvider caught it: the
control-plane cases no longer carried the request-body prefix the test
uses to tell a schema rejection from a handler rejection.

The fifteen `$ref` properties in request schemas are bare again, with
their prose on the referenced schemas, which every renderer shows. The
response schemas keep the `allOf` form; nothing validates responses.
The sibling rule is an error, with the five deliberate `x-fern-ignore`
siblings on the `infra` properties listed in openapi-lint-ignore.yaml.
The generated Go changes only in comments.

Signed-off-by: Davanum Srinivas <dsrinivas@nvidia.com>

* build(api): regenerate with the Go toolchain api/go.mod declares

generate-check failed on the pull request while passing locally and on
the Linux box. The embedded copy of openapi.yaml in server.gen.go is
gzip-compressed, and compress/flate output differs between Go releases:
the workspace asks for Go 1.27.1, so a developer regenerating in the
workspace produces one blob, while generate-check.yml installs the
1.26.5 that controller/api/go.mod declares and produces another.

`make -C controller generate-api` now runs the generator with GOWORK=off,
since the api module is self-contained, and GOTOOLCHAIN pinned to the
version api/go.mod declares, so every developer regenerates the bytes
the gate expects. server.gen.go is regenerated that way here; only the
embedded blob changes.

Signed-off-by: Davanum Srinivas <dsrinivas@nvidia.com>

* docs: render the tag descriptions in the Fern API tab

controller/api/openapi.yaml now carries the concept text on its tags.
`tag-description-pages: true` makes Fern render each tag description as
the intro of its section in the REST API Reference, so that text ships
with the reference instead of only in Swagger UI.

Signed-off-by: Davanum Srinivas <dsrinivas@nvidia.com>

* ci(api): publish a Fern preview of the site for pull requests

The `API docs` workflow now publishes a Fern preview, API Reference tab
included, on every pull request and manual run that has FERN_TOKEN, and
writes the preview URL to the job summary and as a notice. A stable id,
pr-<number>, makes a later push overwrite the same preview, and a cleanup
job deletes it when the pull request closes.

FERN_TOKEN is an organization secret, but GitHub withholds secrets from
`pull_request` runs of fork pull requests, so those runs say why no
preview was published instead. Push the branch to this repository and
dispatch the workflow to preview a fork pull request.

Signed-off-by: Davanum Srinivas <dsrinivas@nvidia.com>

* docs(api): give Fern an absolute server and order the reference sections

The spec's only server was the relative `/api`, which is right for the
embedded Swagger UI and the request validator but left Fern rendering
request examples against `https:/https://api/...`. A second server with
the placeholder host the PDF uses, `https://nke.acme.example/api`, now
carries the examples; the relative one stays first, so Swagger UI's
default and the validator's routing are unchanged, and is marked
`x-fern-ignore`, so Fern and the Redocly page show only the absolute one.
The validator still accepts requests on any host through the relative
server; the server tests cover it.

In docs/index.yml the API tab is flattened, so the path no longer repeats
`rest-api-reference`, and the sections are laid out in reading order,
Clusters first, instead of in order of first appearance, which put the
one-endpoint Catalog section at the top.

Signed-off-by: Davanum Srinivas <dsrinivas@nvidia.com>

* docs: do not repeat rest-api-reference in the API tab's URL

The tab slug and the api item's slug were both derived from the same
title, so every reference page lived under
/nke/rest-api-reference/rest-api-reference/. skip-slug on the tab keeps
one segment.

Signed-off-by: Davanum Srinivas <dsrinivas@nvidia.com>

* docs: skip the api item's slug, not the tab's

skip-slug on the tab left the path unchanged on the preview; the
duplicated segment comes from the api item, so skip that one.

Signed-off-by: Davanum Srinivas <dsrinivas@nvidia.com>

---------

Signed-off-by: Davanum Srinivas <dsrinivas@nvidia.com>
2026-10-02 08:28:37 -04:00
Lia 7f3f41daa3 docs(nkectl): say where the bootstrap artifacts come from; drop the calico example (#1123)
* docs(nkectl): say where the bootstrap artifacts come from; drop the calico example

user-flow.md and first-cluster.md say what the Kind cluster runs, that
`nkectl get bootstrap-manifest` lists the charts and images the
bootstrap fetches, which NKECTL_* variables change where they come from,
and that Cluster API and cert-manager still come from github.com.
first-cluster.md also points at hack/mirror-bootstrap-images.sh.

The `--set cluster.cniName=calico` example is gone from the docs, the
site spec template and example, and `generate sitespec --help`. calico
is the development CNI; customers run ovn-kubernetes. Every place that
listed the two CNIs now says "calico is accepted for development". The
first-cluster.md Path C cloud-init installs the OVN packages, matching
the CNI its example selects, and its --set example uses cluster.podCidr,
which needs no BGP peering.

Also: the TestHasRegistryHost comment names the upper-case rule.

Co-developed-by: Claude <noreply@anthropic.com>
Signed-off-by: Lia Campbell <liac@nvidia.com>

* docs(nkectl): keep the lab example valid and state what the manifest leaves out

The --set examples used podCidr 10.100.0.0/16, which sits inside the
default serviceCidr 10.96.0.0/12; they now use 10.244.0.0/16. The
first-cluster.md lab example sets controlPlaneVIP again, with the note
that a VIP is advertised over BGP, and the VIP value matches the other
examples.

first-cluster.md and user-flow.md say the manifest leaves out the kind
node image and what clusterctl init installs, and that images from
ghcr.io, registry.k8s.io and cgr.dev come from those registries. The
remaining places that listed both CNIs now say calico is accepted for
development, and the second cloud-init installs the OVN packages. The
end-to-end claim names the CNI it ran with.

Co-developed-by: Claude <noreply@anthropic.com>
Signed-off-by: Lia Campbell <liac@nvidia.com>

---------

Signed-off-by: Lia Campbell <liac@nvidia.com>
2026-10-01 12:55:13 -04:00
Anisha Gupta USandClaude Opus 5.5 1e3531e247 docs: move the cluster examples to controlPlaneConfig and document it (#796)
* docs(cli): move the example cluster specs to controlPlaneConfig

CWE expresses a cluster's control plane as a cluster-level
controlPlaneConfig once control-plane controller provisioning is enabled,
and rejects a node pool flagged controlPlane. The three example specs
carried the node pool, so an operator copying one against such a
deployment gets a 400 naming the shape it wanted instead.

Each example now carries the control plane as controlPlaneConfig, keeping
the same cluster: one control-plane node per the previous pool's count,
the same reserved memory, machine template and attestation method, and
the same worker pools under nodePools.

The two shapes are mutually exclusive, so these files are for a
deployment with the flag on. They replace the node-pool versions rather
than sitting beside them: one example per provider is what the docs and
`create cluster --help` already point at, and a reader choosing between
two files would have to know which mode their site controller is in
before they could start.

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

* docs(cli): assert the examples' control-plane shape and correct two comments

TestExampleClusterSpecsDecode now fails if an example lacks a
controlPlaneConfig or declares a control-plane node pool, so a regression to
the node-pool shape fails CI instead of the first create against a site
controller.

In nico-cluster.yaml, state that the control plane and every node pool must
carry the provider payload the cluster's top-level nico or infra sets, and
that a control-plane node stays on the instance type it provisioned with
rather than moving back up the preference list.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Anisha Gupta <anisgupta@nvidia.com>

* docs: document the cluster-level control plane

Add a control-plane section to the first-cluster guide: what
controlPlaneConfig holds, the provider rule, that a control-plane node
cannot be deleted while fewer than three joined ones would remain, and that
a version upgrade waits for enableCPNodeRecycling. Correct the guide and the
nkectl command reference where they still described the control plane as a
node pool or stated the provider rule as "never both".

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Anisha Gupta <anisgupta@nvidia.com>

* docs: show a controlPlaneConfig example instead of a field table

Replace the field table and the delete/upgrade notes in the control-plane
section with an annotated controlPlaneConfig snippet.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Anisha Gupta <anisgupta@nvidia.com>

---------

Signed-off-by: Anisha Gupta <anisgupta@nvidia.com>
Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-30 08:20:14 -07:00
Lia a7bd66bc76 feat(nkectl): add the bootstrap manifest and read chart identities from it (#1068)
* feat(nkectl): add the bootstrap manifest and `get bootstrap-manifest`

The bootstrap manifest lists every chart and image `bootstrap site`
pulls, with the version and digest of each. nkectl embeds it in the new
`internal/bootstrap/manifest` package. `nkectl get bootstrap-manifest`
prints the file as shipped.

Not listed: the controller chart, the Postgres chart and the provisioned
provider's manifest. They ship inside nkectl.

Co-developed-by: Claude <noreply@anthropic.com>
Signed-off-by: Lia Campbell <liac@nvidia.com>

* refactor(nkectl): read bootstrap chart identities from the bootstrap manifest

cwedeploy pinned the Temporal, SPIRE and SPIRE CRDs charts in its own
constants. The bootstrap manifest pins the same charts. Deploy now reads
name, repository and version from the manifest, so one file pins what
the bootstrap installs.

The helm arguments do not change. The order test pins every chart's
repository and version as a literal, and a new test checks that the
charts Deploy pulls and the charts the manifest pins are the same set.
The NKECTL_CWE_*_CHART overrides keep working.

Co-developed-by: Claude <noreply@anthropic.com>
Signed-off-by: Lia Campbell <liac@nvidia.com>

* docs(nkectl): say what the bootstrap manifest pins and what it leaves out

nkectl installs each chart at the manifest's version. It does not verify
the digests; they are a record for mirroring. The manifest also omits
what clusterctl init installs and the kindest/node image. The manifest
header, the package doc and the get bootstrap-manifest help now say so.

Also:
- The controller and provisioned entries name the env vars this branch
  reads, NKECTL_CWE_IMAGE and NKECTL_CAPI_PROVISIONED_IMAGE.
- The Temporal entry notes that controller/Tiltfile pins the same version.
- chartArgs gets its doc comment back.
- Version assertions match whole arguments, so 0.30.1 no longer matches
  0.30.10.
- user-flow.md lists get bootstrap-manifest.
- hack/mirror-bootstrap-images.sh points at the manifest for versions.

Co-developed-by: Claude <noreply@anthropic.com>
Signed-off-by: Lia Campbell <liac@nvidia.com>

* refactor(nkectl): drop the unused Chart.Ref field from the bootstrap manifest

No manifest entry sets ref, and nothing reads it. The Chart doc said a
chart could be named by Ref, which nkectl does not support. Chart now
names a chart by repository, name and version only.

Co-developed-by: Claude <noreply@anthropic.com>
Signed-off-by: Lia Campbell <liac@nvidia.com>

---------

Signed-off-by: Lia Campbell <liac@nvidia.com>
2026-09-29 14:26:32 -07:00
Davanum Srinivas 827c4ba3f9 docs: install Cluster API and an infrastructure provider on a site cluster (#960)
nkectl bootstrap site installs Cluster API only into the ephemeral Kind
cluster it destroys, so a permanent site cluster has no Cluster API and no
provider on it. Nothing documented the gap end to end.

New page, docs/site-bootstrap/infrastructure-providers.md, with the
verified order:

  1. untaint the control-plane nodes
  2. install Cluster API core, pinned to NKE's v1.12.3
  3. install CAPNICo, by Helm or clusterctl
  4. create the credentials Secret, after the install
  5. install the site controller (CWE) last

CWE last matters: it reads the Machine and NicoMachine CRDs once, at
process start, and silently skips three controllers when they are absent.
first-cluster.md and cli/docs/user-flow.md both installed CWE before the
provider; both are corrected to match, with the ordering reason stated
inline.

Both routes were verified live: a throwaway kind cluster, both CAPNICo
install methods, both clusterctl and Helm, and the real nkectl binary.
Findings that would have shipped wrong otherwise:

- Helm 4 is required; Helm 3 cannot install the chart
- the credentials Secret must be created after the install, not before,
  or the chart's own namespace creation fails on ownership metadata
- clusterctl on macOS does not read ~/.config/cluster-api/clusterctl.yaml
- CAPNICo's own clusterctl init line pins no CAPI version; use NKE's
- nkectl get providers reports CONFIGURED without checking Cluster API
  core is present or that credentials work

Everything CAPNICo owns (the credentials Secret schema, allocations,
proving credentials, stall conditions) links to CAPNICo's own docs by
verified anchor rather than restating it.

Wired into docs/README.md, docs/index.yml, first-cluster.md, both site
bootstrap pages, and cli/docs/user-flow.md.

Signed-off-by: Davanum Srinivas <dsrinivas@nvidia.com>
2026-09-22 02:02:33 -04:00
Lia 4abbf7f340 feat(nkectl)!: encrypt site cluster etcd data at rest by default (#754)
* feat(nkectl)!: encrypt site cluster etcd data at rest by default

Add cluster.etcdEncryption to the site spec, defaulting to true, and carry
it into the CWE create request. The first control-plane node then starts
with the encryption provider configuration in place, and every node that
joins receives the same key.

Encryption can only be chosen at bootstrap: it is configured during
kubeadm init, and there is no controller on the finished cluster to turn
it on later. An explicit false is therefore permanent, and the field is a
pointer so that "unset" and "false" stay distinguishable.

The field is a YAML bool, so --set and the render path emit it unquoted; a
quoted "false" does not decode into the struct and the generated file would
not load. It is settable through CLUSTER_ETCD_ENCRYPTION like every other
cluster field.

BREAKING CHANGE: nkectl bootstrap site now builds encrypted clusters unless
the site spec sets cluster.etcdEncryption: false.

Co-developed-by: Claude <noreply@anthropic.com>
Signed-off-by: Lia Campbell <liac@nvidia.com>

* feat(nkectl): save the site cluster's etcd encryption key before teardown

CWE keeps a cluster's etcd encryption key in a Secret on the cluster it runs
on. During a bootstrap that is the ephemeral Kind cluster, which the command
deletes on success. The nodes keep the key on disk, but nothing that could
later join a control-plane node or rotate the key does.

Once every control-plane node has joined, read that Secret and write it out
as a manifest beside the kubeconfig: CWE's own name for it, no namespace, and
the cluster name in an annotation. A controller installed afterwards is given
the file with -n for whatever namespace it lands in.

The write never overwrites, links a synced temporary file into place so a
planted symlink is not followed, syncs the directory, and reads the file back
before the copy in the bootstrap cluster is allowed to go. A run whose output
path already exists is refused before anything is built.

A capture failure is its own error: the cluster is up and encrypted, the
bootstrap cluster is kept because it holds the key, and the message gives the
command that saves it. It does not end, as the generic recovery message does,
by telling the operator to delete that cluster. Neither the key nor any
command output that could carry it appears in an error or a log line.

Co-developed-by: Claude <noreply@anthropic.com>
Signed-off-by: Lia Campbell <liac@nvidia.com>

* test(e2e): assert the site cluster's etcd data is encrypted at rest

After every node is Ready, create a Secret and read it straight out of etcd
through the etcd pod: the value carries the secretbox envelope and not the
plaintext, checked only after confirming the read returned something at all.
Then compare, by digest, the key `bootstrap site` saved with the key in each
control-plane node's encryption configuration. Neither check prints key
material or ciphertext.

Co-developed-by: Claude <noreply@anthropic.com>
Signed-off-by: Lia Campbell <liac@nvidia.com>

* fix(nkectl): reject an empty etcdEncryption value

The decoder reads "" as false for a bool field. For cluster.etcdEncryption
that is a silent, permanent opt-out, and "" is exactly what an unset
template variable or a stray substitution produces. Refuse it before
decoding, naming the field.

Co-developed-by: Claude <noreply@anthropic.com>
Signed-off-by: Lia Campbell <liac@nvidia.com>

* fix(nkectl): make the key recovery path write what the tool writes

The command a failed key capture prints now saves to the path the operator
chose, owner-readable only, and is built in cwedeploy from the same names
the real read uses, so it cannot drift from it. The kubeconfig is written
before the capture, so a capture failure leaves the operator holding the
admin credential, and the error says where it is.

requireNoKeyFile treats only a missing path as free; a path that cannot be
checked fails the run at the start rather than at the end.

Co-developed-by: Claude <noreply@anthropic.com>
Signed-off-by: Lia Campbell <liac@nvidia.com>

* refactor(nkectl): build the key manifest as a corev1.Secret

k8s.io/api is already a direct dependency, and the type carries the
omitempty/omitzero tags that keep creationTimestamp and status out of the
file. The constants comment now names the controller file they must match
and the e2e that catches drift.

Co-developed-by: Claude <noreply@anthropic.com>
Signed-off-by: Lia Campbell <liac@nvidia.com>

* chore: ignore etcd encryption key files from any working directory

The key is written relative to the working directory, so the rule has to
live at the root. Cover the temporary file it is assembled in as well; an
interrupted run can leave one behind.

Co-developed-by: Claude <noreply@anthropic.com>
Signed-off-by: Lia Campbell <liac@nvidia.com>

* docs(bootstrap): correct the etcd key recovery and restore procedures

Name the bootstrap Kind cluster correctly, state that the restore needs the
saved key base64-decoded once, describe the recovered file's shape, give the
cloud-init example a key output path with the instruction to move the file
off the host, and list the key file wherever the kubeconfig output is.

Co-developed-by: Claude <noreply@anthropic.com>
Signed-off-by: Lia Campbell <liac@nvidia.com>

* docs(bootstrap): state what the saved etcd key file is for

Every control-plane node holds the key in its kube-apiserver configuration,
and the cluster runs on that. The saved file is a convenience for installing
a controller later, and the disaster-recovery copy for a restore onto hosts
where no node survives. Say so where the file is described, instead of
calling it the only copy.

Co-developed-by: Claude <noreply@anthropic.com>
Signed-off-by: Lia Campbell <liac@nvidia.com>

---------

Signed-off-by: Lia Campbell <liac@nvidia.com>
2026-09-17 09:50:57 -07:00
Anisha Gupta USandClaude Sonnet 5 4872b364ef feat(nkectl): add delete nodepool (#795)
* feat(nkectl): add delete nodepool

Add "nkectl delete nodepool <name> --cluster <cluster>", resolving the pool
by name within the named cluster the same way patch nodepool already does
(FindNodePoolByName), then calling DELETE /nodePools/{id}. No client-side
pre-validation: CWE already enforces and reports the one special case (the
last joined control-plane pool of a cluster cannot be deleted live), so the
CLI just relays CWE's own message.

nkectl-smoke.sh coverage for node pool operations (create/get/patch/delete)
is tracked separately, to land together rather than piecemeal per command.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>

* review: trim redundant wording in delete nodepool docs

Drop "the same as patch nodepool" and "There is no confirmation prompt" from
the user-flow.md delete-nodepool section, and the trailing comment on the
README.md example line, per review.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>

* refactor(nkectl): rename nodepools.ClientFn to CWEClientFn

Match the clusters package's name for the same factory type
(clusters.CWEClientFn), per review. Renames the type across the whole
nodepools package (create, get, patch, delete and their tests), not just the
delete command this PR adds.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>
2026-09-16 23:16:38 -04:00
Abhinav Pandey 0d485f8548 feat(nkectl): add create nodepool (#791)
Adds `nkectl create nodepool -f <spec>`, reading a YAML or JSON
CreateNodePoolRequest from a file or stdin. The spec carries clusterID, so
there is no --cluster flag. A multi-document file is rejected rather than
silently creating the first pool, and a 409 is reported as the parent cluster
being deleted.
2026-09-16 13:23:46 -07:00
Abhinav Pandey f965e776cd refactor(nkectl)!: name clusters positionally on get clusters (#777)
Replace --cluster/-c with positional names, matching every other command
that targets a cluster by name: create, patch and delete cluster, get
kubeconfig, and get nodepools.

  nkectl get clusters prod staging

Naming several clusters lists them all, in the order given, one request per
name so the filter stays with CWE. A name that matches nothing is an error,
as it was with the flag, and the clusters that did match are still printed,
so a typo in one of several names does not hide the rest.

ListClusters takes a params argument, as ListNodePools already does, and
FindClusterByName routes through it rather than calling the generated client
a second way.
2026-09-16 14:28:58 -04:00
Abhinav Pandey 2addc51812 feat(nkectl): add get nodepools (#751)
List the node pools on the site controller. Naming pools narrows the result to
them, in the order given, and --cluster narrows it to one cluster. Names are
passed to CWE as query parameters on GET /api/nodePools rather than applied to
a full list locally, one request per name.

Naming a pool or a cluster that matches nothing is an error, as it is for
get clusters, rather than an empty table that reads as "there are none". Pools
that were found are still printed, so a typo in one of several names does not
hide the rest.

The table prints NAME, CLUSTER, DESIRED, K8S VERSION, CP, STATUS and ID. A
node pool carries its cluster's ID and not its name, so the CLUSTER column is
resolved with a single ListClusters call, and none is needed when --cluster
already names the cluster. -o json and -o yaml print the API objects whole.

There is no AGE column: api.NodePool carries no creation timestamp.

The patch nodepool hint now points at this command, which did not exist when
that hint was written.
2026-09-16 12:29:48 -04:00
Anisha Gupta USandClaude Sonnet 5 ad7f507a06 fix(cli): address #709 review nits (#748)
* fix(cli): address #709 review nits

Deferred from #709's review, addressed now as promised:
- Renamed ClientFn -> CWEClientFn (the type name wasn't specific enough
  for a codebase that may grow more than one kind of client) and the
  clientFn()/FindClusterByName() result variables from c/cl to
  client/cluster, across get/create/patch/delete -- consistent naming,
  not just in the new patch command.
- patch cluster's "clear a field" help example used
  controlPlaneConfig.infra.preKubeadmCommands, which 400s on a Nico
  cluster and needs control-plane-controller mode; switched to the
  provider-neutral controlPlaneConfig.nodeLabels.

Also two real bugs in util.YAMLToGenericMap, found in review and verified
empirically before and after the fix:
- A "---"-separated second YAML document was silently discarded --
  yaml.Unmarshal decodes only the first document -- so a patch with two
  documents dropped everything after the first with no error. Now uses
  yaml.NewDecoder and rejects a second document explicitly.
- A mapping with a non-string key decodes to map[interface{}]interface{}
  under yaml.v3. At the top level this hit the generic "yaml document is
  not a mapping" error; nested one level deeper, it passed that check and
  failed downstream at json.Marshal with a raw "unsupported type" error.
  Both now get one clear error, at any depth.

Plus two CodeRabbit nits: three patch cluster examples in docs used
unquoted <name>/<cluster-name>/<new-version> placeholders, which a shell
parses as input redirection rather than an argument; switched to the
concrete cluster name the surrounding walkthrough actually uses. And two
exported test functions' doc comments didn't start with the function name.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>

* docs(cli): tighten doc comments in files changed by #748

cli/AGENTS.md: doc comments state the API contract; design rationale
belongs in a design doc or a short implementation comment next to the
code. Trimmed three doc comments in files this PR touches that carried
"why", moving what's still worth keeping to an inline comment at the
line it actually explains:

- CWEClientFn: dropped the "why a factory, not a constructed client"
  rationale -- the lazy-construction pattern is standard enough not to
  need explaining at the type declaration.
- YAMLToRequest: moved "why round-trip through JSON instead of
  yaml.Unmarshal directly" to an implementation comment at the
  json.Marshal call it's actually about.
- stringKeyed: dropped "since generated API types decode only from
  string-keyed JSON objects" -- self-evident from the package's own job
  (YAML to JSON) and the calling code.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>

* refactor(cli): validate YAML keys on the syntax tree, not decoded maps

Replaces stringKeyed (recursive conversion of decoded
map[interface{}]interface{} values) with validateStringKeys, which walks
the yaml.Node tree before decoding. No new dependency -- still
gopkg.in/yaml.v3, already in use. sigs.k8s.io/yaml was considered and
rejected: verified empirically that it silently coerces non-string keys
to strings instead of erroring (the opposite of what's wanted here), does
not fix the multi-document bug either, and goes through a YAML 1.1
parser that turns bare y/n/yes/no into booleans.

Also accepts YAML merge keys (<<: *anchor) rather than rejecting them as
non-string, and validates non-string keys inside sequences, not just
nested mappings -- both gaps in the previous version, verified empirically
before this fix and covered by new tests.

Fixed one regression found while validating the rewrite: null, ~, and a
bare "---" with nothing after it now report "yaml document is not a
mapping" instead of the original "empty document". A null document is
a different problem (nothing was supplied) from a non-mapping one (a
list or scalar was supplied), so restored the original message via an
explicit check on the root node's tag.

Verified: go build/vet/test, gofmt, and flox-pinned make fmt/lint/test
all clean.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>

* docs(cli): fix YAMLToGenericMap's doc comment overstating rejection behavior

The comment claimed the function rejects a non-string key "at any depth"
unconditionally, but validateStringKeys explicitly allows YAML merge keys
(<<: *anchor) through -- confirmed intentional by
TestYAMLToGenericMap_MergeKeyAccepted. Dropped the whole
rejection-behavior sentence rather than qualify it, matching
cli/AGENTS.md's guidance to keep doc comments to the contract.

Also added a one-line comment on the second-document decode, since the
switch's intent (probe for a second document, only to reject it) isn't
obvious from the shape of the code alone.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>
2026-09-15 12:44:48 -07:00
Abhinav Pandey 3919b64673 feat(nkectl): add patch nodepool (#664)
Add the nodepool subcommand to the patch verb:

  nkectl patch nodepool <name> --cluster <cluster> --patch 'desiredNodeCount: 8'

The command resolves the pool by name within the named cluster (node pool
names are unique per cluster, not globally) and sends the patch document to
CWE, so a field the document does not carry is left alone. The server side
already implements the update; this is the CLI surface for it.

The input model mirrors patch cluster: --patch takes an inline YAML or JSON
document, --patch-file a file or stdin via '-', and the two are mutually
exclusive.

desiredNodeCount is the only field supported today. UpdateNodePoolRequest
carries more and CWE accepts them, but the document is validated against a
declared subset of that request rather than the request itself, so an
unsupported field is refused before anything is sent. Supporting another field
is declaring it in supportedFields and listing it in settableFields.

A null is refused locally too. CWE declares no field of the request nullable,
so 'desiredNodeCount:' with no value would otherwise come back as a validator
message naming a JSON pointer.

Patches are asynchronous and, like delete cluster, there is no confirmation
prompt. A rejected patch, such as a scale-up the cluster's pod CIDR has no
room for, surfaces CWE's own message.
2026-09-15 10:05:29 -07:00
85480a16af feat(cli): add nkectl patch cluster command (#709)
* feat(cli): add nkectl patch cluster command

Replaces the --set/--set-string input model (removed in the prior commit)
with a simpler --patch/--patch-file interface: the patch document is
standard YAML, decoded generically and validated against
UpdateClusterRequest with unknown fields disallowed, with zero custom
key-path parsing. Mirrors kubectl patch.

  nkectl patch cluster my-cluster --patch 'controlPlaneKubernetesVersion: 1.31.0'
  nkectl patch cluster my-cluster --patch-file patch.yaml

As with the prior implementation, the validated document is sent to CWE as
raw bytes rather than a re-marshaled struct: UpdateClusterRequest's
provider fields carry an omitted/value/empty three-state contract, and
Go's omitempty drops a zero-length slice/map identically to a nil one on
marshal, collapsing an explicit clear into a no-op. util.YAMLToGenericMap
is re-extracted from YAMLToRequest (it was removed along with the --set
engine) to get a generic map without going through that struct.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>

* feat(cli): patch cluster -p shorthand, doc examples, and comment cleanup

- -p shorthand for --patch, matching kubectl patch's -p/--patch convention.
- Worked examples for patch cluster in user-flow.md (step 9, renumbering
  delete to step 10) and first-cluster.md's Path B command block.
- Fixed a stale "describe" reference in both docs' auth paragraphs --
  describe cluster was removed from the CLI in #648, well before this
  branch existed.
- Tightened PatchCluster's and loadPatchClusterRequest's doc comments: the
  omitempty rationale was stated in both, so loadPatchClusterRequest now
  just states its contract and leaves the why to PatchCluster, where the
  raw-bytes send actually happens.
- Fixed a confusingly worded test failure message left over from drafting.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>

* docs(cli): note that patch cluster accepts JSON too

Not a code change -- gopkg.in/yaml.v3 already parses JSON as a YAML
subset, verified empirically against nested objects, arrays, and
multi-line pretty-printed JSON. Just documenting what already works.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>

* test(cli): cover a single --patch with multiple fields

Combines a top-level scalar, a top-level bool, and nested
controlPlaneConfig fields in one patch document, asserting both the full
wire body and that the fields the fake tracks land on the stored cluster.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>

* fix(cli): trim PatchCluster's doc comment to the contract

cli/AGENTS.md: doc comments state the API contract; design rationale
belongs in a design doc, not the exported comment. The omitempty note is
self-evident from the []byte parameter and the lack of any struct
marshaling at the call site, so dropped rather than relocated.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>
Co-authored-by: Lia <liac@nvidia.com>
2026-09-14 16:21:34 -04:00
Anisha Gupta US 7793369046 revert: "feat(nkectl): add nkectl update cluster command (#619)" (#708)
This reverts commit 6521825ddf.
2026-09-11 15:15:11 -07:00
Anisha Gupta USandClaude Sonnet 5 6521825ddf feat(nkectl): add nkectl update cluster command (#619)
* feat(cli): add CWEClient.UpdateCluster and a fake PATCH route

* feat(cli): add --set key parser for nkectl update cluster

* docs: correct plan's Task 2 to match the implemented --set parser

* feat(cli): implement nkectl update cluster command

* docs: sync plan Task 3 snippets with the committed implementation

* feat(cli): register nkectl update cluster and document it

* test(cli): drop redundant client-layer UpdateCluster tests

Covered already by the command-level tests in cwe/clusters, which exercise
CWEClient.UpdateCluster end to end through a real httptest.Server. Matches
the package's existing convention of testing through the command layer
rather than isolated per-method client tests.

Also drop the implementation plan doc from the repo -- it's a local
planning artifact, not something that belongs in the public repo's
history. Kept at knowledge-base/working-docs/2026-09-09-nkectl-update-cluster.md
outside this repo.

* refactor(cli): move the --set flag engine into internal/util

parseSetValue/parseScalar/setPath had no dependency on the cluster API
types, so move them into internal/util as a generic, reusable
util.ApplySetFlags[T], alongside YAMLToRequest which already does the same
YAML/JSON round-trip for -f patch files.

arrayKeys stays in the clusters package: it's UpdateClusterRequest-specific
knowledge (which dot-paths are list-valued) that a generic string->value
parser can't derive on its own without reflecting on the target struct,
which would reintroduce per-field logic into the shared engine.

* fix(cli): align update cluster's help text and messages with create/delete

Drop the async-downstream-effects paragraph from the Long description.
Match create/delete's exact phrasing for the post-update status message
(plain 'nkectl get clusters', no --cluster filter), the -f flag's help
text, and reference the UpdateClusterRequest schema + /api/docs the same
way create's Long text references CreateClusterRequest.

* refactor(cli): fold update cluster into clusters.go

Get/Describe/Create/Delete already live together in clusters.go; update.go
broke that pattern for no reason. Move NewUpdateCmd, applySets, arrayKeys,
and loadUpdateClusterRequest in alongside the others, and relocate its
tests to match the existing test-file split: clusters_test.go for
pre-API validation with clientFnErr (TestUpdateCmdRequiresSetOrFile,
TestUpdateCmdBadSetEntryRejected, new update entries in TestCmdAliases),
clusters_api_test.go for end-to-end fakeCWE tests.

Also drop the TestApplySet* cases that only re-proved generic
util.ApplySetFlags behavior (scalar coercion, unknown-key/missing-equals/
invalid-bool/invalid-int rejection, later-entry-wins) now that applySets is
a one-line wrapper around it -- that's already covered by
util/setflags_test.go. Kept the four that exercise arrayKeys against the
real nested nico/infra provider structs, since nothing else covers that.

* refactor(cli): inline applySets, rename arrayKeys, trim comments

applySets was a one-line pass-through to util.ApplySetFlags with nothing
of its own to test or document; call ApplySetFlags directly at the one
call site and in the tests that exercised it.

Rename arrayKeys to updateClusterArrayKeys: it's a package-level var in
clusters.go, which holds every cluster subcommand, so a name scoped only
to update needs to say so.

Trim several comments down to stating the contract of the function/var
directly below them, dropping the design-rationale asides (why
ApplySetFlags can't infer arrayKeys itself, etc.) per cli/AGENTS.md's
doc-comment guidance -- that reasoning lives in this PR's description,
not in the code.

* refactor(cli): auto-detect --set array fields via reflection

Replace the hand-maintained updateClusterArrayKeys table with
isArrayField[T], which walks T's struct tags to decide whether a --set
path's target is a slice. The clusters package no longer needs to carry
CWE-schema-specific knowledge (which UpdateClusterRequest fields are
lists) -- that was the one piece of API business logic left in CLI code,
and the openapi spec is still actively changing, so keeping the CLI in
sync by hand was a real maintenance risk.

Moves the array-field coverage (nico.subnetIDs, nodeLabels being *[]string,
infra.preKubeadmCommands) into util/setflags_test.go alongside the new
isArrayField tests, since there's no more clusters-specific data to test
in clusters_test.go for --set.

* fix(cli): make TestUpdateClusterSurfacesServerRejection hit the PATCH

newBrokenCWE fails every request, so this test's 409 was actually coming
from FindClusterByName's GET, not UpdateCluster's PATCH -- GET/list aren't
blocked by CWE's in-progress-mutation check per openapi.yaml (only
updateCluster documents 409), so failing the GET didn't model anything
CWE actually does.

Add fakeCWE.failUpdate so the fake can reject just the PATCH while GET
still resolves the cluster name normally, and assert the request sequence
(GET then PATCH) so a regression back to failing before the PATCH is
caught rather than passing for the wrong reason.

* fix(cli): parse real YAML/JSON array syntax in --set array fields

parseSetValue always split an array field's raw value on comma before any
YAML parsing, so a value with real sequence syntax (e.g.
'[{path: /etc/foo, content: bar}]', needed for object-list fields like
bootstrapFiles) got mangled: the comma inside the object broke it into
invalid fragments.

Try the whole value as one YAML document first; if it parses to a list,
use it directly. Otherwise fall back to the existing comma-split-of-
scalars behavior (id1,id2 -> [id1, id2], and a single value with no comma
-> a one-element list), so plain scalar-list fields are unaffected.

* test(cli): cover the remaining controlPlaneConfig.* --set fields

Adds inline --set coverage for every controlPlaneConfig field not already
exercised: maxSurge, systemReservedMemory, provisioningMonitorDisabled,
the control-plane-scoped teleportEnabled (distinct from the top-level
field), nico.configProfile, infra.spireAttestationMethod, the remaining
nico UUID-list fields (instanceTypePreference, sshKeyGroupIDs,
vpcPrefixIDs), and infra.machineTemplate via YAML flow-mapping syntax.
Together with the existing tests, every field in the corrected --set key
reference now has direct inline coverage.

* docs(cli): fix stale update-cluster status and alias list

cli/docs/user-flow.md still listed 'nkectl update cluster' as Planned and
omitted update from the cluster/clusters alias summary, even though this
branch implements and registers it. Flagged by cross-review's integration
check against the changed files.

* fix(cli): send update cluster's PATCH body as raw bytes, not a re-marshaled struct

UpdateClusterRequest's nico/infra provider fields document a three-state
contract: omitted leaves the stored value alone, a value replaces it, and
an empty value clears it. Neither --set nor -f could actually reach the
'clear it' state, for two stacked reasons:

- --set's parseSetValue turned an empty value into YAML null, which
  decodes to a nil pointer/zero slice indistinguishable from an omitted
  field once the client re-marshaled the struct with omitempty.
- Even after fixing that locally, the generated client's typed
  UpdateClusterWithResponse re-marshals the Go struct to build the HTTP
  body, and omitempty drops a zero-length slice/map exactly like it drops
  a nil one -- so an explicit empty value and an omitted field produced
  identical wire bytes regardless of what the CLI computed locally. A
  hand-crafted curl body would not hit this, since it never goes through a
  Go struct's marshal at all; the bug was specific to how nkectl built the
  request, not a CWE/schema limitation.

Fix: build the merged patch (from -f and/or --set) as a
map[string]interface{}, validate it by decoding into a fresh
UpdateClusterRequest (catching unknown fields/type errors, then discarding
the decoded value), and send the validated raw bytes directly via
UpdateClusterWithBodyWithResponse instead of the typed request path. The
raw bytes are exactly what was validated, so an explicit  or [] or {}
survives onto the wire.

Supporting changes:
- util.BuildPatch replaces util.ApplySetFlags as the --set entry point
  (ApplySetFlags is removed: after this change it has no production
  caller, decoding onto a struct is the exact behavior being fixed).
- util.MergeMap deep-merges the -f document with the --set patch before
  the single validate-and-send step.
- util.YAMLToGenericMap extracts YAMLToRequest's YAML-to-map step so -f
  can reuse it without going through a struct.
- emptyValueFor picks the right JSON-empty shape per field kind (array,
  object, or string) via the same reflection-based field lookup
  isArrayField already used.
- setPath now errors instead of silently discarding an earlier --set
  entry when a later one needs to descend through it as an object.
- CWEClient.UpdateCluster takes the raw []byte body instead of a typed
  UpdateClusterJSONRequestBody.

create cluster is unaffected: none of CreateClusterRequest's fields carry
the three-state contract (create has no prior state to distinguish
'leave alone' from), so create's existing typed-struct path stays as is.

Also fixes a --set parsing bug caught along the way: an empty value on a
plain (non-array) field parsed as YAML null via parseScalar, which for an
array-typed field's comma-split fallback produced a one-element list
containing the zero UUID instead of an empty list.

Cross-review findings addressed: #1 (three-state contract unreachable,
confirmed and root-caused further than reported), #2 (setPath silent
discard on scalar/nested conflict).

* docs(cli): trim comments to state contract, not design rationale

Per cli/AGENTS.md's doc-comment guidance, rewrite comments across the
files this branch touches to describe what a function does and how to use
it, dropping the 'why this instead of that' justification that belongs in
the PR description. Also fixes a real duplication bug from an earlier
edit: loadUpdateClusterRequest had two stacked doc comments (the original,
pre-refactor one plus a newer one appended beside it instead of replacing
it).

* docs(cli): drop the empty-value-clears paragraph from update cluster's help text

Now that --set and -f genuinely reach CWE's documented empty-value-clears
semantics for every affected field, the CLI's behavior matches
UpdateClusterRequest's own field docs (/api/docs) exactly -- no separate
CLI-specific caveat needed.

* test(cli): cover MergeMap recursion, -f real-path, and malformed -f for update

Addresses the review's coverage findings:

- MergeMap's recursive branch (two documents each setting a different
  field under the same nested object) had zero test executions. Added a
  direct unit test plus an end-to-end command test
  (TestUpdateClusterSetAndFileMergeSiblingFields) exercising the PR's own
  headline use case through loadUpdateClusterRequest. Verified both catch
  a real regression by temporarily reverting MergeMap to unconditional
  replacement and confirming they fail.
- update cluster -f <path> (a real file, not stdin) had 0% coverage on the
  os.Open branch -- added TestUpdateClusterFileFromRealPath.
- A malformed-YAML -f patch file was untested for update cluster
  specifically (only create cluster had the equivalent case) -- added
  TestUpdateCmdMalformedYAMLRejected, mirroring
  TestCreateCmdMalformedYAMLRejected.

cli/internal/util coverage: 87.3% -> 92.4%. cli/internal/cwe/clusters:
87.1% -> 91.1%. Both now above the pre-branch baseline the review cited.

Left as-is, per the review's own severity call (correctness confirmed
fine, message quality only): --set controlPlaneKubernetesVersion=1.30
YAML-coercing to a float, and an empty value on a non-clearable field
producing a generic json.Decode type-mismatch. Both requests are still
correctly rejected; giving either a field-specific error message would
mean hand-listing field names in the generic --set engine, which is
exactly the hardcoded-per-field-knowledge this design replaced.

* fix(cli): address update cluster review findings, adopt jsonpatch/sigs.k8s.io-yaml

Fixes from review on the --set/-f patch engine: reject an empty element in
a comma-separated list instead of coercing it to JSON null, reject a --set
value that itself parses as YAML null instead of a silent no-op, error on
--set key= for a field with no empty representation (bool/int/struct)
instead of sending the wrong type, catch the reverse-order nested-then-
scalar setPath conflict (only scalar-then-nested was caught before), match
--set keys to their json tag case-insensitively and canonicalize the
casing that reaches the wire, and reject a -f document that merges down to
an empty patch instead of issuing a no-op PATCH. Also fixes update cluster's
Long help text (documents leaf-key-only override and the empty-value clear
syntax) and two error-message wording issues ("applying patch" ->
"validating patch", "spec file is empty" -> "empty document", the latter
now shared with create).

Replaces two hand-rolled pieces with already-vendored libraries flagged in
review: util.MergeMap -> jsonpatch.MergeMergePatches (gopkg.in/evanphx/
json-patch.v4, RFC 7386, already an indirect dependency — verified
byte-identical output before switching), and convert.go's YAML handling ->
sigs.k8s.io/yaml's UnmarshalStrict/YAMLToJSON (also already indirect).
Neither changed cli/go.sum, only promoted the go.mod requires from
indirect to direct.

Also adopts two Helm strvals-style conventions in the hand-rolled --set
parser itself, without a new dependency: \, escapes a literal comma inside
one list element, and a new --set-string flag keeps a value as a literal
string instead of YAML-coercing it (--set-string always wins over --set on
a shared key). This closes the previously-accepted gap where
--set controlPlaneKubernetesVersion=1.31 failed with a generic type-mismatch
error, since bare 1.31 parses as a YAML float.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>

* docs(cli): rewrite update cluster's help text around examples

The --set/--set-string paragraph explained the parser's internals (values
"parsed as YAML", comma-splitting, "coerced to that type") instead of
telling the operator what to type. Replaced it with runnable examples, and
tightened the --set/--set-string flag descriptions so they're useful on
their own for someone who only reads -h.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>
2026-09-10 22:12:46 -07:00
Anisha Gupta USandClaude Sonnet 5 2fa90128e8 feat(nkectl): add get kubeconfig — fetch tenant admin kubeconfig from the management cluster (#269)
* NKX-13899: implement nkectl get kubeconfig (Option B — mgmt cluster Secret)

Reads the admin kubeconfig for a tenant cluster directly from the
management cluster Secret published by the tenantaccess controller
(nke-system/<cluster-name>-kubeconfig, key: value).

Uses k8s.io/client-go; management cluster kubeconfig is resolved via
--mgmt-kubeconfig flag → KUBECONFIG env → ~/.kube/config.

Output defaults to stdout; --output/-o writes to a file.

Also updates the mTLS FIXME comment to reference NKX-15055.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* fix(cli): read the always-admin kubeconfig Secret, resolve mgmt kubeconfig from site config

Since this branch was last rebased, main split the tenantaccess-published
kubeconfig Secret in two: "<cluster>-kubeconfig" is now CWE/CAPI's own
consumed Secret (a SPIRE exec-auth kubeconfig when OIDC auth is enabled,
plain admin otherwise), while "<cluster>-admin-kubeconfig" is always the
verbatim admin.conf. `get kubeconfig` now reads the latter so it doesn't
silently hand back a SPIRE kubeconfig while claiming to be admin.

Also stop resolving the management cluster kubeconfig via --mgmt-kubeconfig
flag -> KUBECONFIG env -> ~/.kube/config. Resolve it from the active site's
configured kubeconfig instead (nkectl config set-site --kubeconfig), the
same way every other command resolves its site, with --mgmt-kubeconfig kept
as an explicit per-invocation override.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>

* fix(cli): return site name from resolveSiteConfig, drop internal-tracker refs

resolveSiteConfig now returns the resolved site's name alongside its
SiteConfig, since SiteConfig itself doesn't carry it (it's only known as the
map key in Config.Sites) -- resolveMgmtKubeconfig no longer has to re-derive
it for its error message. Along the way, restore the ok-check on the
CurrentSite lookup (a dangling CurrentSite would otherwise silently resolve
to an empty SiteConfig instead of erroring) and keep the "no site configured"
and "current site not found" cases distinct with their own messages.

Also drop internal tracker references from code comments, per this repo's
own convention for its public history.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>

* fix(cli): sync workspace vendor tree, narrow mgmtcluster to a secretGetter interface

Running go mod tidy on cli/go.mod (needed to fix real go.sum-completeness
lint failures) surfaced dependencies -- go-logr, structured-merge-diff,
go-openapi/*, x/oauth2, x/term, etc. -- that k8s.io/client-go and clientcmd
had always transitively needed but the original commit never ran tidy to
declare. Once declared, cli/go.mod disagreed with the workspace's shared
vendor/ tree, breaking every module's CI job that builds under go.work
(vendor mode is workspace-wide, not per-module). Run `make work-sync` to
bring go.work.sum and vendor/ back in agreement; only cli/go.mod and
cli/go.sum actually changed, and every version now matches what was already
vendored for other modules.

Also narrow mgmtcluster.Client from the full kubernetes.Interface to a
one-method secretGetter interface, so tests use a hand-rolled fake instead
of k8s.io/client-go/kubernetes/fake -- that package's own dependency
footprint (go-openapi/swag, mailru/easyjson, josharian/intern) came
specifically from the full Clientset's Discovery() machinery, which this
command never uses.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>

* refactor(cli): use controller-runtime client.Client instead of a raw client-go Clientset

mgmtcluster.Client now builds a sigs.k8s.io/controller-runtime client.Client
from the management cluster kubeconfig, matching the pattern already
established in controller/internal/kube (NewClientFromKubeconfig /
NewClientFromRESTConfig) for the identical problem -- reading a kubeconfig
Secret and building a client from it. controller-runtime's typed client is
used in 54 files across controller/ and cluster-api-provider-provisioned/,
versus 1 prior use of the raw client-go Clientset -- this makes cli/ consistent
with the rest of the repo instead of introducing a second pattern.

Tests switch from a hand-rolled secretGetter fake to
sigs.k8s.io/controller-runtime/pkg/client/fake, the same fake client builder
already used throughout controller/'s test suite.

vendor/ stays consistent with no work-sync needed: controller-runtime and its
transitive dependencies are already vendored at compatible versions from
controller/'s own use of the package.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>

* chore(cli): pick up go.sum entries for already-vendored indirect deps

make work-sync (run with full network access, needed to reach sum.golang.org
for checksum verification) adds explicit go.sum entries for indirect
dependencies that were already vendored for the workspace at these versions --
Masterminds/semver, onsi/ginkgo, onsi/gomega, go.uber.org/zap,
k8s.io/apiextensions-apiserver -- but that cli/go.mod hadn't declared. Fixes
the "workspace / Check go.work and go.work.sum are current" CI failure; no
other module's go.mod/go.sum or vendor/ changed.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>

* fix(cli): address review findings on get kubeconfig

- Fix file-permission leak: os.WriteFile only applies its mode argument when
  creating a new file, so writing --output-file to a pre-existing file (e.g. a
  stale kubeconfig at 0644) kept the old, more permissive mode instead of
  0600, leaking the admin kubeconfig's credentials. Chmod explicitly after
  the write.
- Route output through cmd.OutOrStdout() instead of os.Stdout, matching every
  sibling command and cmd/nkectl/output_test.go's convention -- output can
  now be captured via cmd.SetOut() in tests.
- Rename --output/-o to --output-file: -o means "output format" (json/yaml)
  on every sibling get subcommand; this command used the same flag for
  "destination file path", an incompatible meaning under one shorthand.
- Add the missing injection seam (MgmtClientFactory) that let all of the
  above ship untested: NewGetKubeconfigCmd called mgmtcluster.New directly,
  so nothing could be tested without a live management cluster. Every sibling
  command already takes its backend as a factory function; this now does too.
- Add kubeconfig_test.go and extend mgmtcluster/client_test.go, closing the
  coverage gaps a reviewer flagged (0% on NewGetKubeconfigCmd, 0% on
  mgmtcluster.New) -- including a test that specifically reproduces the
  permission bug against a pre-existing file.
- Note mgmtcluster's relationship to cwedeploy.Engine.TenantKubeconfig
  (different Secret, different polling-vs-single-read approach) in a doc
  comment, rather than merging them -- different call contexts, not
  duplication worth unifying here.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>

* fix(cli): drop --mgmt-kubeconfig, rely on --site alone

Per review: --site is already the one override mechanism every command uses,
and set-site has required --kubeconfig since it landed, so a second,
command-specific override for the same kind of thing was redundant.

- get kubeconfig now takes a SiteFn (matching the pattern already used by
  "get providers"), reads Kubeconfig off the resolved SiteConfig directly,
  and drops --mgmt-kubeconfig and the resolveMgmtKubeconfig indirection.
- mgmtcluster.New's empty-path error now names the remediation directly
  ("run 'nkectl config set-site' with --kubeconfig..."), matching the
  existing precedent in clients.New for a missing site URL, so the
  actionable message survives even without the dedicated resolver's own
  check in front of it.
- Removed the three tests tied to the deleted resolveMgmtKubeconfig;
  updated kubeconfig_test.go's fakes for the new SiteFn-based signature.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>

* chore(cli): pick up go.sum entries for prometheus/client_golang, x/sync

make work-sync (full network access) picks up explicit go.sum entries for
github.com/prometheus/client_golang, client_model, and golang.org/x/sync --
already-vendored indirect dependencies of controller-runtime that cli/go.mod
hadn't declared. Fixes the "workspace / Check go.work and go.work.sum are
current" CI failure; nothing else in the workspace changed.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>

* refactor(cli): drop the unused site name return from resolveSiteConfig

The name was added for resolveMgmtKubeconfig's error message; that function
is gone now that --mgmt-kubeconfig was dropped, and no caller uses the name
anymore -- both loadClient and loadSite already discarded it. Back to
resolveSiteConfig(cfg) (config.SiteConfig, error), matching what its two
real callers actually need. site == "" also goes back through
cfg.CurrentSiteConfig() directly rather than reimplementing its checks.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>

* chore(cli): regenerate THIRD_PARTY_NOTICES.md after rebase

Rebased onto main's new auth feature (#581, service account token auth for
CWE requests), which added its own dependency. Regenerate to match the
current, merged dependency set (70 entries).

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>

* fix(cli): address get kubeconfig review findings

- Switch mgmtcluster.Client from a controller-runtime client.Client
  to client-go's typed Clientset, dropping the controller-runtime
  dependency entirely. The dynamic RESTMapper controller-runtime
  installed issued its /api+/apis discovery with context.TODO(),
  making an unreachable management cluster hang uncancellably; a
  typed clientset does no discovery and closes that gap. Also sets
  a 30s request timeout, matching providers/inspect.defaultTimeout.
- Split the Secret-read error into NotFound/Forbidden/other branches
  so "cluster may not be provisioned yet" lands on the failure that
  actually produces it, and a Forbidden response names the missing
  RBAC grant instead of a generic wrap.
- Make --output-file atomic and symlink-safe: write to a temp file
  in the destination directory, chmod 0600, then rename over the
  target, instead of os.WriteFile+os.Chmod. A failed write no
  longer leaves a partial or wrongly-permissioned kubeconfig behind,
  and a symlink at --output-file gets replaced rather than written
  through.
- Move the command from internal/cwe/clusters (documented as
  CWE-REST-API-only) to internal/mgmtcluster/command, since it reads
  the management cluster directly and never touches the CWE API.
- Add a covering test for the newMgmtClient adapter and trim doc
  comments down to their API contracts per cli/AGENTS.md.
- Document the nke-system Secret read RBAC requirement in
  cli/README.md's least-privilege kubeconfig section.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>

* fix(cli): trim rationale out of KubeconfigFetcher's doc comment

Drop "Narrow on purpose, so tests can inject a fake without a real
management cluster kubeconfig or a live server" -- rationale, not
contract, per cli/AGENTS.md. Matches the same trim already applied
to the mgmtcluster package doc and New's comment in the prior
review-response commit.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>

* docs: update kubeconfig docs for nkectl get kubeconfig

Stacked on #269, which implements nkectl get kubeconfig. Replace the
manual kubectl/jsonpath Secret workaround in user-flow.md and
first-cluster.md with real command usage, and update the status
table entry from "In Review" to "Available".

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>

* fix(cli): trim doc-comment rationale, rename kubeconfig.go to get_kubeconfig.go

- Package doc, requestTimeout, KubeconfigFetcher, and writeKubeconfigFile
  comments now state contract only; the removed rationale (why
  controller-runtime was dropped, why a timeout is needed, why the
  write is atomic/symlink-safe) is covered in the PR description and
  review-response comment instead.
- Rename cli/internal/mgmtcluster/command/kubeconfig.go (and its test)
  to get_kubeconfig.go, matching NewGetKubeconfigCmd and the cobra
  Use string, the same convention providers/command/get.go follows
  for NewGetCmd.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>

* chore(cli): regenerate THIRD_PARTY_NOTICES.md to match CI's go-licenses output

The committed file had real license source URLs, resolved locally
against a warm module cache with VCS metadata. CI's go-licenses run
can't do that (same "empty go module dir" limitation as main's own
committed copy, which already reports Unknown for all 68 entries),
so notices-check always diffed real URLs against CI's Unknown
output and failed. Regenerate to match what CI actually produces --
entry count and package set are unchanged, only the Source column.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-09-10 14:41:03 -07:00
Anisha Gupta USandClaude Sonnet 4.6 4ed631400c refactor(nkectl): remove describe cluster command (#648)
nkectl get clusters --cluster <name> -o yaml covers the same use case
as describe cluster without the extra GET /api/clusters/{id} round-trip.
Removes NewDescribeCmd, the describe cobra subcommand, PrintFields and
its printMap helper (used only by describe), associated tests, and all
doc references.

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-09-10 12:31:25 -04:00
Lia 4dd8430c2a refactor(nkectl)!: drop the Docker bootstrap provider (#631)
* refactor(nkectl)!: drop the Docker bootstrap provider

bootstrapengine could drive the ephemeral bootstrap Kind cluster through
either the Docker daemon or nerdctl/containerd, selected by a Provider
threaded through Create, Delete, Exists, Kubeconfig and LoadImage. Docker was
never the target: the package doc called nerdctl "the default: it matches the
target platform's runtime and removes the Docker daemon dependency", and kept
Docker only "as the rollback path until the nerdctl provider is proven out in
CI".

It is proven out. The nerdctl leg landed in #291 and runs on every cli/,
agent/ and controller/ change plus twice daily; across recent history it and
the docker leg reach the same conclusion on every run, with the shared
failures tracing to unrelated breakage rather than to the provider. The
rollback has not been needed, and a runtime nobody selects is a runtime
nobody tests.

So the choice goes, rather than the unused half of it. Provider, both
constants, providerEnv and providerEnvMap are gone; KIND_EXPERIMENTAL_PROVIDER
is now set unconditionally on every kind invocation, and the nerdctl binary
name is a single exported constant. Engine's methods lose their provider
parameter, and Config and Cluster lose the field.

Two behavioural consequences worth naming. LoadImage no longer has a Docker
fast path, so every load saves an archive and uses `kind load image-archive`
-- the path that does not shell out to `docker`. And the recovery hint printed
when site-cluster creation fails now always carries the
KIND_EXPERIMENTAL_PROVIDER prefix; the condition producing it was inverted,
so dropping the Docker case makes it unconditional rather than removing it.

ensureImageAvailable gains the diagnostic this makes necessary: a host with
only Docker previously worked, and now fails at the first `nerdctl image
inspect`. That is reported as a missing prerequisite rather than folded into
the existing authentication hint, which assumes nerdctl ran and got a 401.

The CI matrix collapses to a single job. Its header comment made three claims
about gating -- that the nerdctl leg blocks, that it is advisory, and that the
job is "wired into merge-gate.yml's `gate`" -- which contradict each other and
the `on:` block twenty lines above, and are all wrong: the workflow has no
workflow_call and is not in gate's needs, so it gates nothing. Corrected
rather than carried forward.

Removing the flag also closes a small hole: --bootstrap-provider was cast
straight to KIND_EXPERIMENTAL_PROVIDER with no validation, so a typo became a
silently wrong provider.

The e2e harness still uses Docker to build the fixture images and run the
fake-node substrate, which is a dependency of the test scaffolding rather
than of nkectl. Removing it is separate work.

BREAKING CHANGE: `nkectl bootstrap site` no longer accepts
--bootstrap-provider, and NKECTL_BOOTSTRAP_PROVIDER is ignored. The ephemeral
bootstrap cluster is always driven through nerdctl/containerd. A host with
only Docker installed can no longer run `nkectl bootstrap site`; it needs
nerdctl >= 1.7.0 and a containerd for it to talk to.

Co-developed-by: Claude <noreply@anthropic.com>
Signed-off-by: Lia Campbell <liac@nvidia.com>

* fix(nkectl): report a missing container runtime before standing anything up

The missing-nerdctl diagnostic added alongside the Docker provider removal
could not fire. Its comment claimed ensureImageAvailable was "the first
command to reach for the runtime"; it is not. runBootstrapSite calls
engine.Create first, whose Exists runs `kind get clusters`, and kind execs
nerdctl internally. On a Docker-only host the run therefore died several
steps earlier with kind's own "failed to list clusters", the runtime named
only in nested output -- and the message written for exactly that operator
never printed. errors.Is(err, exec.ErrNotFound) could not have matched there
in any case: the lookup failure belongs to kind's process, not to this one.

Checked with exec.LookPath before the cluster is created, so the error says
what is missing while nothing has been built yet. The ensureImageAvailable
branch stays as defence in depth, with the same message and a comment that
no longer claims primacy.

The check takes its lookup through an injectable seam, matching
bootstrapRunner and cweRunner: without it every existing runBootstrapSite
test would require a real nerdctl on the machine running `go test`.

Also in bootstrapengine: kindEnv returns a fresh map per call rather than
being a package-level one. It crosses the CommandRunner interface on every
kind invocation, and a runner that annotated the map it was handed would
corrupt every later call in the process. The map it replaced,
providerEnvMap, was already per-invocation.

Tests: the preflight is exercised through runBootstrapSite rather than by
calling the helper directly, so it proves the real flow reaches it. Delete
gains the KIND_EXPERIMENTAL_PROVIDER assertion the other four kind paths
already had -- it is the one whose regression is silent, since `kind delete
cluster` exits 0 on a cluster it cannot see, so teardown reports success and
the bootstrap cluster leaks every run. The recovery-hint test now asserts the
full `KIND_EXPERIMENTAL_PROVIDER=nerdctl kind delete cluster --name` string
rather than a substring that passed with or without the prefix. And
TestDefaultConfig_IgnoresBootstrapProviderEnv observes a real call instead of
comparing two package-level literals, which no environment variable could
have influenced.

Co-developed-by: Claude <noreply@anthropic.com>
Signed-off-by: Lia Campbell <liac@nvidia.com>

* docs(nkectl): correct what the Docker provider removal left half-true

Four places described a world the code no longer matches.

The failed-bootstrap recovery step in docs/first-cluster.md was a bare `kind
delete cluster --name nkectl-bootstrap` -- the exact command bootstrap.go now
says does not work. kind resolves a cluster through the provider that created
it, so that command looks in Docker, finds nothing, and exits 0. The
paragraph above it warns that a leftover seed cluster makes the next run stop
on a name clash, so following it produces precisely the failure it exists to
prevent. Prefixed, and the reason stated inline. The unprefixed `kind delete
cluster` further up is path A's Tilt cluster, which is Docker-based and
correctly bare.

make/checks.mk still listed `nkectl bootstrap e2e` under "Merge-gate jobs not
run locally". It is not in the gate: merge-gate.yml's `gate.needs` does not
include it, the workflow has no workflow_call for one to reach it by, and
docs/branch-protection-settings.md lists `gate` and `DCO` as the only
blocking checks. Moved to the advisory block next to CAPD backend e2e, which
already had the right idiom, and the "Two merge-gate jobs" count corrected.

run.sh's header contradicted run.sh twice. It said NKECTL_CWE_IMAGE must be
pulled into containerd, while the bridging loop reads it from Docker's store
with `docker save` -- so following the instruction fails five minutes in with
"reference does not exist", after the fixture images have built. And it
described a GHCR login and `nerdctl pull` in CI that do not exist; CI builds
the image locally. Both replaced with what actually happens, and the two
runtimes this suite needs are now stated as such rather than implied.

The same header omitted root. De-branching attach_bootstrap_to_node_network
made `iptables -t raw -I PREROUTING` and `ip address replace` unconditional,
where the previously documented local default was the unprivileged Docker
path. `make -C cli test-e2e-bootstrap` runs without sudo, so a developer
following the header hits "the bootstrap cluster was never attached to the
node network" after building three images. Documented here and in
cli/AGENTS.md.

Also: the `nerdctl >= 1.7.0` floor was asserted in three docs and verified
nowhere -- no code checks a version and CI pins 2.3.5. Attributed to kind's
own stated minimum, with 2.3.5 named as the version actually exercised. And a
comment in run.sh still said kind accepts "docker" here, left over from the
provider matrix; nothing passes it now.

Co-developed-by: Claude <noreply@anthropic.com>
Signed-off-by: Lia Campbell <liac@nvidia.com>

---------

Signed-off-by: Lia Campbell <liac@nvidia.com>
2026-09-10 08:34:22 -07:00
Vignesh Goutham Ganesh f5373f358b docs: explain how nkectl authenticates to the CWE API (#600)
Replace the stale NKECTL_DEV_TOKEN path with TokenRequest minting from the
site kubeconfig, and document the RBAC nkectl needs on a real site.
2026-09-09 21:02:06 -07:00
Michael Shen 9d824ba771 feat(cli): support proxy TLS client certificate authentication (#601)
Allow site configurations to provide optional proxy client certificate and key paths. Validate flag and configuration pairs, preserve the default HTTP transport behavior, and cover the proxy authentication setup with focused tests.

Signed-off-by: Michael Shen <mishen@nvidia.com>
2026-09-09 19:51:08 -04:00
Lia a843f8297e docs(cli): correct the provider step to read-only (#584)
nkectl will not configure infrastructure providers. Installing a provider
and giving it credentials is a deployment step performed with Helm, Argo
CD or kubectl against the site cluster; nkectl reads that state and never
changes it.

Remove the `nkectl configure provider` row added to the commands table in
#551 and rewrite step 5 around `get providers` alone, saying where the
configuration actually comes from and what CONFIGURED does and does not
prove.

Co-developed-by: Claude <noreply@anthropic.com>

Signed-off-by: Lia Campbell <liac@nvidia.com>
2026-09-08 20:06:39 -04:00
Anisha Gupta USandClaude Sonnet 4.6 43001880a5 docs(cli): update tenant cluster command status and add planned commands (#561)
* docs(cli): update tenant cluster command status and add planned commands

- Replace nkectl describe cluster with nkectl get clusters --cluster
- Mark nkectl get kubeconfig as In Review
- Add planned update cluster, create/get/delete/update nodepool commands

* docs(cli): link get kubeconfig PR in command status

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

---------

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-09-08 16:30:38 -07:00
Lia 43b02f60d9 docs(cli): show where provider configuration fits in the user flow (#551)
Add the planned `nkectl configure provider` beside `get providers` in the
commands table and in step 5, so the flow shows where a provider gets
its endpoint and credentials before a tenant cluster is created on it.
Note that on a site whose providers are managed by Argo CD the
configuration lives in git and Argo applies it, while `get providers`
reports the cluster's state regardless of which tool wrote it.

Co-developed-by: Claude <noreply@anthropic.com>

Signed-off-by: Lia Campbell <liac@nvidia.com>
2026-09-08 07:16:21 -04:00