Commit Graph
81 Commits
Author SHA1 Message Date
Davanum Srinivas 3eaa4c30c1 test(cli): poll the FIFO open so the signal test cannot hang the package (#1691)
A blocking open for writing waited forever when nvkectl exited before its spec read; two macOS legs ran into the 10 min package timeout (10-12, 10-13). A non-blocking open fails with ENXIO until nvkectl opens the FIFO, so the test can watch for an early exit and report its stderr.

Signed-off-by: Davanum Srinivas <dsrinivas@nvidia.com>
2026-10-16 08:54:52 -04:00
Jonathan MeierandClaude Opus 5 9b96cb09fc refactor(cli): move the nvkectl command tree into an importable package (#1407)
The command tree lives in package main, where it can be executed but never
imported. A second program therefore has no way to reach it, which is what a
generated CLI reference needs: the reference has to be built from the same
tree the binary runs, or the two drift.

Move the tree to internal/nvkectl and leave cmd/nvkectl as a shim. The split
follows what kubectl, clusterctl, gh and argocd each do for the same reason.

The build-time version strings stay in package main. The linker matches -X on
the package NAME, and for a command that name is "main", so a symbol moved
into internal/nvkectl would be silently left at its default -- no error, no
warning, just a binary reporting "dev". `make -C cli build` runs the binary and
fails on that, and it still passes.

Terminating the process stays in cmd/nvkectl. The internal package exposes
Run, which returns the status to exit with rather than calling os.Exit itself:
an os.Exit inside an importable package takes down whatever imported it,
skipping every deferred close, flush and cleanup still outstanding. Run also
hands the signals back and releases its watcher goroutine before returning, so
it leaves a caller's signal handling as it found it. Two tests cover this, and
both fail loudly if it regresses -- an os.Exit would take the test binary with
it.

contract_test.go stays in cmd/nvkectl too. It builds the binary from its own
directory and runs it as a process, referencing no symbol from the package, so
it keeps testing the same boundary from the same place.

The CI path filters move with the files. Three workflows selected the old
location:

  - capd-e2e.yml and the cwe_facing regex in e2e-pr-path-filter.yml both
    matched cli/cmd/**. controller/hack/ci/nvkectl-smoke.sh drives config
    set-site, config view, create cluster and delete nodepool against a live
    controller, and all four now sit in internal/nvkectl, so without this a
    later change to any of them would skip that lane.
  - kind-stack-from-release.yml named cli/cmd/nvkectl/validate.go and
    cli/cmd/nvkectl/render.go by exact path; both are repointed.

cmd/ stays in the first two lists: it still holds main and the contract test.

No behaviour change: the help output of all 46 commands is byte-identical to a
binary built from main.

Signed-off-by: Jonathan Meier <jomeier@nvidia.com>
Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-10-15 14:12:26 -04:00
Aaron Patten f4263e1fe2 fix(nvkectl): stop bootstrap site when an unread NKECTL_CWE_* setting is set (#1651)
nvkectl does not read the NKECTL_CWE_* names that nkectl cli/v0.1.x used for the controller deploy settings. bootstrap site now stops before doing any work when one is set without its replacement, naming the replacement, and warns when the replacement is set. The e2e harness passes only the NVKECTL_* image variables.

Signed-off-by: Aaron Patten <apatten@nvidia.com>
2026-10-15 14:34:30 +00:00
Lia 5038f6faaf feat(deploy): check-site.sh, and the site controller install as a list of commands (#1586)
* feat(cli): inspect sitespec prints the site values the shell reads

A hidden command: the site name, the management VIP, the trust domain
and the node architecture of a site spec, as shell assignments.
deploy/check-site.sh reads the architecture through it.

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

* feat(deploy): the stack install needs no registry pull secret

CAPNICo's GHCR package is public, and with a release its image comes by
digest from the release's registry or the local layouts. The site spec
loses controllerStack.pullSecret, the deploy path renders no
ghcr-imagepull Secret, CAPNICo's manifest names none, and the e2e suite
and the kind lane take no GHCR credential. A site spec that still
carries the block no longer loads.

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

* feat(deploy): check-site.sh reports what the site needs before the stack installs

One line per finding and the fix with it: the tools and the helm pin,
the checkout, the site spec, the release description and its declared
qualification, the run directory, the cluster API, an odd node count,
the node architecture against controllerStack.arch, the control-plane
taint the bootstrap removes, exactly one default StorageClass, the
Cluster API version, egress and disk. It changes nothing and exits
non-zero on a FAIL; when ready it prints the executor command.
--diagnostics writes nodes, pods, events, helm releases and the
controller logs under the state directory after a failed step.

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

* ci: the kind lane runs the site runbook in order

check-site.sh, clusterctl init, the executor, then the SPIRE exec-auth
patch, the order the install guide gives. apply-capi-spiffe-exec-auth.sh
takes --kubeconfig so every kubectl call is pinned to the site cluster.

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

* fix(deploy): check-site.sh treats a failed cluster read as a finding; the e2e suite expects the executor's subcommand

A denied, timed-out or flaky kubectl read used to come back empty and
pass, so a Cluster API that could not be read was reported as not
installed yet. Reads now fail the finding with kubectl's error, and
only NotFound means Cluster API is absent. The wrong-version finding
names the clusterctl upgrade command instead of a page that has none.
The ready line prints the init command only when one was emitted and
the executor by its resolved path. The suite covers denied reads, an
installed Cluster API and the NotFound case. The e2e dry-run test
expects nvke-deploy.sh install, which is what the stack driver builds.

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

* fix(deploy): check-site.sh findings hold under more clusters; the executor refuses an unknown item type

The taint finding matches NoSchedule only, not PreferNoSchedule. The
Cluster API finding compares the image tag with a digest suffix stripped,
and a core at the pin without the kubeadm providers is a finding. A
missing nvkectl is a finding that skips the site spec and release
checks rather than an exit. Printed commands are shell-quoted. The
verdict and the diagnostics line carry the script's own name. inspect
prints no trace ID, so every line of the check is a finding. The
executor's item parser accepts only the item types the deploy path
format defines, so an unrendered path with an unknown type is refused
before anything is applied. The e2e driver writes placeholder registry
values for controller releases whose base-config template still reads
them. The exec-auth script refuses an empty --kubeconfig. The kind lane
workflow runs on changes to the files the lane now executes. The suite
covers an even node count, an architecture mismatch, two default
classes, an unreachable API, a core-only Cluster API, a missing
nvkectl, the unknown item type, and asserts the check makes no mutating
kubectl call. lib/common.sh holds only what the check uses.

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

* test(deploy): fix a quoting slip in the suite

An apostrophe escape meant for a single-quoted string sat inside a
double-quoted one and turned the rest of the file into a string.

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

* chore(deploy): the check and the lane name the operator guide that lists the install steps

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

* fix(deploy): the check reports what it cannot read; the e2e placeholder registry is one no image uses

A denied read of a kubeadm provider is a finding and no longer followed
by an 'already installed' pass. A Cluster API image pinned by digest
alone is reported as such rather than by its repository name. The
commands inside findings quote their paths. A site spec that nvkectl
cannot read is a finding, not an exit. The e2e driver's placeholder
pull-secret names a server no image uses, so older controller releases
that render it pull the public CAPNICo image anonymously.

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:48:12 -07:00
Vignesh Goutham Ganesh 80e34a26bc feat(cli): deploy OIDC providers during site bootstrap (#1601)
* feat(cli): pin fleet OIDC providers during site bootstrap

Put optional cluster.oidcProviders on the site spec and merge them into the controller Helm values before the single install, so the site API server receives those issuers. Leave the list unset for today's behavior, and reject a list when Kubernetes is older than 1.34.

Signed-off-by: Vignesh Goutham Ganesh <viganesh@nvidia.com>

* refactor(cli): pass site OIDC providers in a second Helm values file

Leave the embedded controller values untouched. When the site spec sets providers, append a values file that only contains oidc.providers so the PEM stays out of --set.

Reject an issuer that is not https, and a caBundle that is not a PEM certificate, before bootstrap continues.

Signed-off-by: Vignesh Goutham Ganesh <viganesh@nvidia.com>

---------

Signed-off-by: Vignesh Goutham Ganesh <viganesh@nvidia.com>
2026-10-14 11:21:26 -04:00
Alexander Greene 3038cf917c feat(controller): gate new Calico clusters (#1599) 2026-10-14 07:19:24 -07:00
Lia eac79fa4c1 ci: bring the controller stack up on kind from a release, rendering inside the executor (#1583)
* ci: bring the controller stack up on kind from a release description

The lane builds the controller and the profiles fixture into OCI layouts,
copies the CAPNICo image, fills a nvkr.dev/release/v4 file from their
digests, renders deploy/nico against it with --nvkr-run-dir, installs the
result on a kind node and checks the pods run the release's digests.
Advisory; not a merge-gate member.

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

* fix(cli): close the deferred findings of the site render

spire.trustDomain is required and never derived. The controller reads its
connection string from the chart's Secret, URL-escaped. A deploy path
missing a site-values item is refused. A malformed release.yaml is
reported once. Notes reach the log only when the render succeeds.

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

* chore(deploy): build the test nvkectl with the cli target and resolve Makefile paths from the file

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

* docs(deploy): say which per-site values the render supplies and from where

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

* ci: give the kind lane the nktp values the other kind lanes use

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

* feat(deploy): render for the site and the release inside nvke-deploy.sh

install --sitespec … --release … [--nvkr-run-dir …] renders the deploy
path through nvkectl into a private scratch directory, installs it and
removes it, so no rendered credential is left behind. nvkectl render
deploy-path is hidden: the script is its caller.

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

* ci: the kind lane renders and installs through nvke-deploy.sh

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

* ci: free the runner's disk before the kind lane and record disk usage on failure

The stack's images filled the root volume; the postgres layer could not
be extracted.

Co-developed-by: Claude <noreply@anthropic.com>
Signed-off-by: Lia Campbell <liac@nvidia.com>
(cherry picked from commit 2dda40b10fc3cac98edcb136c97f70a9ac748f72)

* ci: the kind lane checks the stack's own workloads, not every pod

An nktp gateway autoscaler may add a replica the runner cannot schedule;
kubectl wait --all then reports every later pod as timed out unchecked.

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

* ci: the kind lane caps nktp's autoscaled collectors at one replica and asserts every stack pod

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

* ci: the kind lane takes the nktp kind values as they are once they carry a ceiling

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

* ci: the kind lane checks the clusterctl digest, names pod-list errors and asserts the spire namespaces

The pod sweep covers nke-system and spire-system, where the agent and
the CSI driver run, instead of a namespace no deploy path creates. A
failed pod list stops the lane with its namespace. The nktp guards match
a whole maxReplicas: 1 line. clusterctl is checked against the pinned
sha256, and the lane runs on every input it reads.

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

* fix(cli): validate sitespec requires the trust domain the render requires

validate sitespec reports a missing spire.trustDomain, so its exit code
means the file is ready for the controller stack install. The render
checks the trust domain and the TPM checksum before it generates the
database password, so a refused spec leaves no file behind. The template
and the docs say the field is required for the stack install.

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

* fix(deploy): --release needs --sitespec, which names the architecture

Without the site spec the render would pick artifacts for the host
architecture. The usage says --dry-run still renders and may create the
database password file. The docs describe the rendered tree as the
scratch tree the install removes.

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

* chore: drop an orphan comment from .gitignore

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

* ci: the kind lane's release carries the release-description/v1 schema

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

* feat(cli): the bootstrap and the stack install share a default trust domain

Both default to nvkectl-bootstrap.nke.local, the domain of a bootstrap with
the default cluster name, so a site spec that sets spire.trustDomain to
nothing joins them to one domain. The render warns when it uses the
default; the bootstrap tells the operator to set the field when it ran
under another cluster name. validate sitespec no longer requires the
field, and says the bootstrap can run with the file while the
controllerStack section is still to fill in.

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

* feat(deploy): the render scratch lives under a private state directory and the kind lane proves it is removed

The render goes under NVKE_STATE_DIR (default $XDG_STATE_HOME/nvke),
created 0700, and is removed however the script ends. The suite checks
the directory mode and that a failed render leaves nothing. The kind lane
runs an install whose render fails and the real install under its own
state directory, and dies if either leaves a scratch tree or any rendered
file behind.

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

* docs(cli): spire.trustDomain is set once before the bootstrap, or never

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

* ci: the kind lane works in a per-run directory it never empties, and runs on site-spec changes

The telemetry docs name the site spec's clusterName and nktpValuesFile as
the inputs of a site install, and --config and --values-for for an
install without one.

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

* fix(cli): the bootstrap says when it defaults the trust domain; the kind lane owns its cluster and waits for Ready

The bootstrap logs the defaulted trust domain as soon as it takes it, and
warns when a custom bootstrap cluster name makes it differ from the
install's default; validate sitespec qualifies the shared default the
same way. The kind lane refuses a kind cluster of its name that was there
first and deletes only one it created, and a pod counts as ready only
when its Ready condition is True.

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

* docs(deploy): the usage says where the render lives once, and what --nvkr-run-dir is for

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

* fix: the review round on the kind lane and the trust-domain docs

The bootstrap says it defaulted the trust domain before a dry run returns.
The docs qualify the shared default for a renamed bootstrap cluster, and
the troubleshooting entry names an install the script accepts. The
password file note is said at once. The executor renders with --ephemeral,
so the summary does not ask the operator to delete a directory the script
removes. The kind lane runs on the mirror branch only, on every input it
reads, and its cleanup probe has to fail in the render itself.

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-13 14:31:52 -07:00
Lia 44a136a877 feat(cli): the install reads the release description nvkr release export writes (#1598)
* feat(cli): the install reads the release description nvkr release export writes

The release input is the nvkr.dev/release-description/v1 document: every
output with its reference and digest, a native output's os and arch, a
multi-arch image's index children, and a chart's version. The reader takes
only that schema. The render refuses a chart the release carries at another
version than the item pins. inspect nvkr-release prints the reference, the
root digest and the declared qualification.

The export describes a release and verifies nothing; nvkr release verify
decides that for the same reference.

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

* fix(cli): the chart-version check applies to repository charts; the reader refuses filtered and malformed descriptions

A path chart's pin is a placeholder the chart at the path overrides, so
the release's version is noted, not compared. A repository chart's pin
selects what installs: the release has to name that version, and a
missing one is refused too. The reader refuses a filtered description,
an image index without children or missing a required platform, an os
without an arch, an output carrying both arch and an index, and a
platform that is not os/arch; a platform outside the supported set is
reported by Select for the output asked for, not at parse. Select takes
a suffixed name's own suffix as its architecture and prefers the suffixed
output named for the architecture. The package doc and the help say the
export is unverified and verify runs first.

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

* fix(cli): the release decides the version of every chart it carries

A chart the release carries is installed from the release's archive by
digest, so its version is the release's: the rendered release.yaml records
it. A pin that names another version is a warning that points at the
item's values, not a refusal; the pin decides only for a chart the
release lacks. The 0.0.0 placeholder of a chart in this tree is no
difference.

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

* feat(deploy): a path chart names no version

A repository chart is selected by its version, so release.yaml pins one.
A path chart carries its own in its Chart.yaml, and a release that
carries the chart decides, so the pin is gone from the controller and
nktp items in deploy/nico and the e2e deploy paths. Both readers accept
the absence; the rendered copy records the release's version.

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

* fix(cli): a platform variant is its architecture; path charts in the e2e paths name no version

Select and the required-platform check compare on os/arch, so a child
published as linux/arm64/v8 serves linux/arm64. The item parser refuses
an empty version on a repository chart like the Go reader does. The e2e
postgresql items lose their version like the controller items did, and
the stack script's words about pins match. gofmt on the test file.

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-13 13:07:50 -07:00
Anisha Gupta USandClaude Sonnet 5.5 6005cc19b0 fix(cli): print no trace ID for help or a successful render (#1603)
* fix(cli): print no trace ID for help or a successful render

A bare group command such as `nvkectl create`, and `nvkectl deprecate` with
no arguments, print help and do nothing, but still reported a trace ID. They
now report none, like -h and --help.

render writes files and contacts no controller, like generate, so it joins
the query commands: a successful run writes only its result, and -v logs the
trace ID. A failing render still ends its error with the trace ID.

compatibility.md no longer says a successful query command writes nothing to
stderr without naming the trace ID mismatch warning, and says only a
subcommand rejected for a bad flag reports a trace ID.

The CAPD e2e lane and its pull request filter now include
cli/internal/telemetry, which nvkectl-smoke.sh depends on.

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

* docs(cli): describe the trace ID by kind of command

The output channels row listed every command that prints or omits the trace
ID, so each change to the set meant editing it in several places. A Trace ID
section now describes the three behaviours, query commands, help, and
everything else, and the row points to it.

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 Sonnet 5.5 <noreply@anthropic.com>
2026-10-13 15:38:53 -04:00
Vignesh Goutham Ganesh f3987a7dae feat(cli): mint a breakglass kubeconfig at site bootstrap (#1434)
Stop writing kubeadm admin.conf to disk. Bind nvke:breakglass to
cluster-admin and issue a CSR-backed client cert for the operator file.
Delete the CSR even if the wait for the signed cert fails.

Signed-off-by: Vignesh Goutham Ganesh <viganesh@nvidia.com>
2026-10-13 09:56:21 -07:00
Anisha Gupta USandClaude Sonnet 5.5 2e6c4f35a5 feat(cli): give every nvkectl command one trace ID (#1354)
* feat(cli): give every nvkectl command one trace ID

nvkectl starts a root span for every command except help and completion.
The controller client sends the span's W3C traceparent and
"User-Agent: nvkectl/<version>" on every request, and nvkectl's log
records carry trace_id and span_id. Nothing is exported.

A failing command ends its error report with the trace ID, including one
whose request never reached the controller. A successful command prints
it as the last stdout line, except get, version, config and generate,
which write only their result and log the ID at debug level. bootstrap
site also reports the ID on stderr before it starts, so a run that fails
validation writes nothing to stdout.

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

* fix(cli): keep the trace ID off structured output and on every failure

The success-time "Trace ID:" line now goes to stderr. On stdout it
followed the JSON document of "create ... -o json" and added a key to the
YAML one, which breaks any caller that parses stdout.

A command cancelled by SIGINT or SIGTERM keeps its trace ID in the
cancellation report, because the request may already have been accepted.
A command that cobra rejects before any hook runs, such as an unknown
flag or an extra argument, now gets an ID too.

The trace run no longer sets process-wide state. The tracer provider and
the User-Agent belong to the Run, which the transport finds in the
request's context. Cobra's traverse-run-hooks setting keeps a subcommand
that declares its own PersistentPreRunE from replacing the root's hook.

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

* refactor(cli): start the trace in execute instead of a cobra hook

The root's PersistentPreRunE started the span, so a flag or argument error
that cobra reports before any hook ran needed a second, late start, and a
subcommand with its own PersistentPreRunE could have disabled tracing.

execute now starts the run before cobra parses anything and renames the
root span to the command path afterwards. The trace ID always exists, one
call site owns it, and cobra's traverse-run-hooks setting is no longer
needed. help and completion still report no ID.

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

* fix(cli): keep a malformed build version out of the User-Agent

A build can stamp any string into the version. A control character in it
made Go refuse every request to the controller over its User-Agent.
NewRun now reduces the version to RFC 9110 token characters, and falls
back to "dev" when none are left.

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

* chore(cli): trim comments and tests to what the change needs

Doc comments in the telemetry package and root.go now state the contract
only, with the one-line reasons next to the code they explain. Two
overlapping tests are removed and two merged into one.

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

* chore(cli): name the test helper runNvkectl

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

* docs(cli): explain how to use the trace ID to diagnose a bootstrap

The troubleshooting guide now shows the trace ID in the terminal output
and in the error example, and says how to pick one run out of a log by
its ID, in text and JSON logs. It also says the controller installed by
bootstrap does not record the ID in its own logs, so those are still
matched by cluster or node name.

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

* feat(cli): warn when the controller reports a different trace ID

The controller returns the trace ID its logs and spans use in X-Trace-ID.
When that differs from the ID nvkectl sent, something between them, such
as an ingress or a proxy, dropped the traceparent header, and the ID
nvkectl prints matches nothing in the controller. nvkectl now writes one
warning to stderr per run that names both IDs. A response without the
header is not a mismatch and warns about nothing.

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

* fix(cli): no trace ID for --help, and clearer trace ID wording

A mutating command given -h or --help printed a trace ID, because cobra
answers the flag without running the command and returns success. The
help flag is now checked before the ID is reported.

The mismatch warning no longer says an intermediary dropped traceparent:
a different X-Trace-ID only shows that the controller reported another
ID, so the warning names both IDs and says what to check. The bootstrap
guide now says a command cobra rejects for a bad flag or argument prints
only the ID that ends its error, with no starting line.

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 Sonnet 5.5 <noreply@anthropic.com>
2026-10-13 10:57:19 -04:00
Lia 97ca3ab273 feat: install the controller stack from an NVKR release (#1428)
* feat: install the controller stack from an NVKR release

nvkectl render deploy-path takes the release description nvkr release
verify prints (nvkr.dev/release/v4) beside the site spec: charts the
release carries are pulled by digest into charts/<item>/ and verified,
image artifacts become a release-images.yaml values file or a
kustomization, images.txt lists the images the result runs, and with
--nvkr-run-dir everything comes out of a local Run's OCI layouts. Each
item's release.yaml binds the NVKR artifacts it uses by name. The
executor applies the result: an archive chart.path skips the dependency
build, a kustomization.yaml is applied through kubectl kustomize, and
images.txt layouts are imported into the node's containerd first.
--chart-override is gone; the release is the single chart source.

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

* refactor(cli): pull release charts with oras-go instead of the oras binary

The render resolves and fetches chart manifests and archives through
oras-go v2: a registry and an OCI layout are the same read-only target,
digests are verified by the store, and the --oras flag goes away. The
operator no longer needs oras to render.

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

* chore(cli): regenerate third-party notices for the OCI dependencies

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

* fix(cli): name release images repository@digest in images.txt

A release may reference an image as repository:tag@digest. The inventory
drops the tag, so the imported name matches the one the values and the
kustomization ask containerd for.

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

* fix(deploy): import images with containerd's local path and check the digest alias

ctr images import --local names every manifest of the layout
<repository>@<digest>; the transfer import keeps an annotated name and
skips that alias. The executor checks the alias exists after the import.

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

* fix(cli): cancel registry requests with the command context

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

* fix(deploy): read images.txt before importing, so docker exec cannot eat the list

CTR may be `docker exec -i`; inside a while-read loop its stdin is the
list, and the post-import check consumed every line after the first.

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

* test(cli): rename the node image fixture artifact to nvke-node-image

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-12 17:20:35 -07:00
Lia ac96cd13f0 feat(cli): render a deploy path for the site the site spec describes (#1567)
* feat(cli): render a deploy path for the site the site spec describes

nvkectl render deploy-path copies a deploy path and resolves it for the
site: the controller, SPIRE, PostgreSQL and Temporal items get a
site-values.yaml built from the site spec's controllerStack section (the
database password, the OIDC discovery URL, the SPIRE server address and
identity, the controller's admin ID, the TPM attestor checksum, the
bootstrap CA, a registry mirror), template items are rendered with Go
text/template and become manifest items, and site.env names the site.
Secrets are read from the files the spec names and written into the
result, so it is created 0700 and is for one install. The executor
installs the result with no --config. deploy-test joins the merge gate
with the executor's dry-run suite; the executor stops on a parser
failure instead of installing nothing.

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

* docs(cli): name the item list file by its current name

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

* fix(cli): review fixes for the site render

A rendered tree installs from anywhere: a committed chart.path is written
absolute, and the executor takes an absolute chart.path as is. Secrets
holding a quote, a backslash or a control character are refused by
field, since the templates carry no escaping. spire.ca*File resolve from
the working directory, as bootstrap site reads them. The OIDC domains are
read from the overlay as YAML, so a comment inside the list no longer
truncates it. --out is created first with Mkdir, so an existing directory
is left alone, and --out inside the deploy path is refused. A manifest
item's image: rejects a digest. nktpValuesFile without an nktp item is a
problem. The bootstrap's TPM checksum lookup calls the exported one. The
test suite's mode check is portable and its order check can fail.

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

* fix(cli): refuse a checkout path with whitespace in the render

The rendered chart.path is one unquoted token for the deploy path reader,
so a checkout under a directory with a space rendered and then failed at
install time. The render now reports it. The --out guard resolves symlinks
before comparing with the deploy path.

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

* refactor(cli): export the TPM attestor checksum lookup as is

Rename tpmPluginChecksum instead of wrapping it; the render tests for an
empty checksum like the bootstrap does.

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

* fix(cli): refuse unknown item types and whitespace in absolute chart paths

Items accepts only the four types the executor dispatches. The whitespace
check covers an absolute committed chart.path too. The nested --out test
runs on a copy of the deploy path.

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

* feat(cli): keep the database password in the operator's file only

controllerStack.database.passwordFile is required. A missing file is
created with a generated password, 0600. The rendered tree holds no
db-password copy.

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

* feat(deploy): reference the SPIRE CA with chart.setFile instead of copying it

A helm item's release.yaml takes chart.setFile: <helm key>=<absolute path>
entries the executor passes as --set-file. The render points the spire
item at the operator's CA files; spire/site-values.yaml holds no PEM.

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

* feat(cli): name the credential files of a rendered deploy path

The render lists the files under --out that hold a credential and writes
a .gitignore that ignores the tree, so the operator knows what to delete
and a repository does not pick it up by accident.

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

* feat(cli): refuse a rendered deploy path under a shared temp directory

--out under /tmp, /var/tmp, their /private forms or the process temp
directory is refused before anything is written. Tests opt out through
RenderOptions.AllowTempOut; the deploy suite through
NVKECTL_RENDER_ALLOW_TEMP_OUT=1.

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

* fix(cli): keep temporal's passwords under a mirror and refuse incomplete site values

A mirror merges into temporal's server values instead of replacing them.
The render refuses a missing profiles image when the deploy path enables
profiles.image, an empty secret file, a template value the templates
cannot carry, an image override with no tag or digest, a template item
with no template, and an item named . or ... A symlinked deploy path is
resolved; copied files keep their owner exec bit.

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-12 16:41:34 -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 Srinivas 0b4ff4ef30 chore: publish to the nvke-* NVCR repositories (#1520)
The publish workflows push nvke-controller, nvke-agent, nvke-agent-deb,
nvkectl, nvke-controller-chart and nvke-os-image-* ; the controller
Makefile default, the docs, the CLI help and the tests follow. The NICo
overlay keeps its pinned nke-controller tag until a release tag exists
under the new name, and the allowlist entry narrows to that pin and the
pull secret.

Closes #1519

Signed-off-by: Davanum Srinivas <dsrinivas@nvidia.com>
2026-10-11 09:47:07 -04:00
Davanum SrinivasandClaude Fable 5.1 3baba6d1b4 ci: give the name check its launch allowlist, and move the stragglers to the new name (#1484)
* chore: move test doubles, examples and stale references to the new name

What the name check still reported outside the Tier 2 identifiers:
synthetic names in tests (nke-site, nke-old, nke-injected, nke-role,
nke-key-1 and friends), registry and path examples in documents and
flag help (registry.example.com/nke, ghcr.io/my-org/nke, ~/dev/nke),
development defaults (DEV_NAME, kind contexts, the promtail job, the
mutagen example), stale references to packages renamed earlier
(internal/nke, nke.NewClient, nkecli, nkeutils), the `nke#1399` issue
shorthand, the CI image tag nke/capd-reboot-controller, the prune
script's package names, and a few comments and messages. The
UpdateNKERBAC rpc's errors now start with the rpc name, which no caller
parses.

Kept: the two synthetic fixture profiles' image URLs, because
osprofiles-to-crs refuses to change a published MachineImage spec; the
salt of the bring-up VMs' default password hash; the legacy installer
path the kubeadm-distro test asserts is absent; the fleet names existing
sites carry. The postgresql chart's description changes with a patch
bump.

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

* ci: give the name check its launch allowlist

hack/name-check-allowlist.txt grows from two entries to 48, each with
its reason: the Tier 2 identifiers that stay until the post-launch
release (PR4 Kubernetes, PR5 node, PR6 OS image and packages), the
permanent keeps (migration names and texts, the NKEAuth magic and its
package, fleet release and profile names, the identity of existing
sites), the settings-coupled names (the old NGC token secret, the
CODEOWNERS team slugs, the S3 and apt names, the old CLI name), and the
files that keep the bare word (the agent version line the updater
parses, the OIDC upstream CA subject, the Keycloak lab, the two NVCR
workflows whose NGC organisation is named NKE).

With it, NAME_CHECK_MODE=fail make name-check passes on this tree:
5,908 hits, all allowed, every entry in use. The make target keeps
report mode until the launch flips it (W4).

Closes #1483

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 19:24:52 -04: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 Patten 9b87e9b636 chore(nkectl): say controller, not CWE, in output, comments and tests (#1386)
Signed-off-by: Aaron Patten <apatten@nvidia.com>
2026-10-09 11:07:29 -04:00
Vignesh Goutham Ganesh 42dc22064d feat(cli): generate an oidc-login kubeconfig (#1235)
Add nkectl generate oidc-kubeconfig to copy cluster connection settings from an input kubeconfig and write a kubectl oidc-login get-token user, without copying the input user.
2026-10-08 12:40:01 -07:00
Aaron Patten 9587323356 feat(nkectl): name the controller settings NKECTL_CONTROLLER_* and deprecate NKECTL_CWE_* (#1341)
* feat(nkectl): read NKECTL_CONTROLLER_* settings, keep NKECTL_CWE_* as deprecated names

nkectl reads the seven controller settings (image, port, helm and ready
timeouts, Temporal/SPIRE/SPIRE CRDs chart locations) as NKECTL_CONTROLLER_*.
The NKECTL_CWE_* names still work for one release: when only the old name is
set, nkectl uses it and logs a warning naming the replacement. Order: flag,
new name, old name, default.

`make -C cli images` reads CONTROLLER_IMAGE and still reads CWE_IMAGE with a
warning. The forge e2e harness sets both image names so a staged published
nkectl, which reads only the old name, still gets the image.

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

* docs(nkectl): spell out how cli/Makefile resolves CONTROLLER_IMAGE and CWE_IMAGE

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

---------

Signed-off-by: Aaron Patten <apatten@nvidia.com>
2026-10-08 15:29:36 -04:00
Terry Howe ab3bf12286 feat(cli): state nkectl's compatibility surface and test it at the boundary (#1258)
* feat(cli): state nkectl's compatibility surface and test it at the boundary

Anything scripted against nkectl is a contract whether or not it was declared
one, and nothing enforced it. Exit codes and the stdout/stderr split are the
parts that get depended on silently: a refactor could move a diagnostic onto
stdout, or turn a failure into exit 0, with every test still green, because
every test in this package calls Go functions rather than running the binary.

Add cmd/nkectl/contract_test.go, which builds the real binary and runs it as a
process. It covers the exit code and the output channel for the critical
journeys — help, version, config, get clusters against a stub CWE, and the
invalid-input paths — plus regression coverage for the machine-readable
formats, so a renamed JSON field fails rather than silently breaking a caller's
jq. Every invocation runs with stdin closed, so a command that waits for a
human hangs there rather than passing.

Add cli/docs/compatibility.md, stating what is contract (command and flag
names, exit codes, output channels, -o json/yaml field names, the config file,
the NKECTL_* variables) and what is not (table columns, error wording, help
text, log output), and the deprecation sequence tied to RELEASE.md.

Two behaviour changes make the documented contract true:

- nkectl now runs under a signal-aware root context, so SIGINT and SIGTERM
  cancel the command in flight and report 130 rather than killing it mid-step.
  bootstrap site threads cmd.Context() instead of context.Background(), so an
  interrupted bootstrap unwinds. Installing a handler takes SIGINT away from
  the kernel's default disposition, so main restores it as soon as the first
  signal lands and the second kills outright — a command blocked on a read
  still answers to a repeated Ctrl-C, and a test holds that line.

- Errors print from main rather than from cobra, which now returns them
  silently. The format and the stream are unchanged; main needs the error to
  pick an exit code, and printing in both places would double every message.

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

* fix(cli): detach bootstrap cleanup from the cancelable command context

Both runners exec through exec.CommandContext, so a SIGINT during the
deploy cancels ctx and the cleanup defer would skip diagnostics and the
kind delete, leaving a cluster that blocks the next bootstrap. Give each
step its own bounded context detached from ctx.

Also correct the output-channel contract: the blanket "a successful
command writes nothing to stderr" contradicts bootstrap's progress
logging and the required deprecation warning.

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

* style(cli): gofumpt the detached cleanup contexts

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

* test(cli): pass context to runBootstrapSite in image-flag test

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

* fix: address review feedback

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

* fix(cli): exit 143 when SIGTERM cancels a command

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

* fix: address review feedback

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

---------

Signed-off-by: Terry Howe <thowe@nvidia.com>
2026-10-08 16:10:39 +00:00
Aaron Patten 7899f40eb4 refactor(nkectl): name the bootstrap deploy package and API client after the controller (#1327)
Rename cli/internal/bootstrap/cwedeploy to controllerdeploy, cli/internal/cwe
to cli/internal/controller, clients.CWEClient and CWEClientFn to
ControllerClient and ControllerClientFn, and the bundled cwe-values.yaml and
cwe-nodeport.yaml to controller-values.yaml and controller-nodeport.yaml.

Update every path-bound reference: the cli/Makefile ldflag that stamps
capiVersion, the CAPD e2e path filters, the root Makefile's provider manifest
change detection, the regenerated provider manifest header, README links and
path comments. No behaviour change.

Signed-off-by: Aaron Patten <apatten@nvidia.com>
2026-10-08 09:14:02 -06:00
Miancheng Lin b61f3fe75e feat(cli): manage machine images and releases with nkectl (#1305)
Add nkectl create, get, delete and deprecate for machine images, cluster releases and node pool releases on a site's management cluster.

Signed-off-by: Miancheng Lin <mianchengl@nvidia.com>
2026-10-07 15:40:35 -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
Lia 51ecc5b918 fix(nkectl): refuse a site spec whose podCidr overlaps serviceCidr (#1170)
* fix(nkectl): refuse a site spec whose podCidr overlaps serviceCidr

The validator accepted a podCidr inside serviceCidr, which cannot
route: pods and ClusterIP Services would share addresses. It now
reports each podCidr entry that overlaps serviceCidr, so `generate
sitespec` and `bootstrap site --dry-run` catch it first. A generate
test that used such a pair now uses a disjoint one.

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

* fix(nkectl): parse CIDRs the same way in every site spec check

checkCIDR accepts a prefix length with a leading zero through
net.ParseCIDR; netip.ParsePrefix rejects it, so the overlap check and
the VIP check skipped such a CIDR after checkCIDR had accepted it. One
parsePrefix helper now parses with net.ParseCIDR and converts the
result, so every check sees the same set of valid CIDRs.

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 10:34:45 -07:00
Jun Shun Zhang 582740ef7e feat(controller): require kube-vip for control-plane changes (#1149)
* feat(controller): require kube-vip for control-plane changes

Signed-off-by: Steven Zhang <stevenzhang@nvidia.com>

* fix(controller): block control-plane NodeSet replacement without VIP

Allow CLI control-plane VIPs to match declared node IPs. Keep IPv4,
routable-unicast, pod CIDR, and service CIDR validation. Cover the first
and another declared node IP in validation, generated site specs, and
controller request forwarding tests.

Update documentation with the remaining kube-vip address cleanup and
bootstrap routing constraints. Configuration acceptance does not prove
bootstrap or networking works.

Validation: CLI fmt, lint, and test; CLI preflight with race tests and
license header checks.

Signed-off-by: Steven Zhang <stevenzhang@nvidia.com>

---------

Signed-off-by: Steven Zhang <stevenzhang@nvidia.com>
2026-10-07 15:18:31 +00: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
Lia b0416bb452 feat(nkectl): make control-plane nodes schedulable after bootstrap site (#1153)
* feat(nkectl): make control-plane nodes schedulable after bootstrap site

Every site spec node is a control-plane node, and kubeadm taints each one
node-role.kubernetes.io/control-plane:NoSchedule. Nothing in the NKE stack
tolerates that taint, so a cluster handed over with it cannot run workloads
and every Helm --wait or clusterctl init on it hangs until it times out.

Once all nodes have joined, bootstrap site now removes that taint from each
node, through a Kubernetes client built from the kubeconfig it just wrote.
Other taints are left alone and a node without the taint is not touched, so
the step is idempotent. It runs last, after the kubeconfig and the etcd
encryption key are on disk; a failure names the kubectl command that
finishes the job by hand.

A new site spec field, cluster.schedulableControlPlane, defaults to true and
is the opt-out for a site that adds dedicated worker nodes before it runs
workloads. It is settable with --set and CLUSTER_SCHEDULABLE_CP, rendered
only when false, and an empty value is refused like etcdEncryption's.

The bootstrap e2e drops its per-workload tolerations and checks that no node
still carries the taint, so the default is exercised end to end.

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

* docs: untainting the control plane is a check, not a step, after bootstrap site

bootstrap site removes the control-plane taint by default. The first-cluster
guide, the FAQ, the infrastructure-providers page and the nke-sbom deploy
notes now tell operators to confirm the nodes are schedulable, and keep the
manual kubectl taint command for a site spec that set
cluster.schedulableControlPlane to false or a bootstrap that reported the
removal failed.

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

* fix(nkectl): untaint after the SPIRE export, bound its I/O, spell out the env var

The untaint now runs in runBootstrapSite after the SPIRE ClusterStaticEntry
export, so a failure there no longer skips the export while the error tells
the operator to delete the bootstrap cluster that holds its only source.
The failure test asserts the export ran.

Each untaint API request carries a 30 s timeout and the whole step a 2 min
one, so an API server that accepts connections and never answers cannot
hang the command.

The environment override is CLUSTER_SCHEDULABLE_CONTROL_PLANE, spelled out
like its siblings. The site spec doc says the command logs when the taint
is kept. The e2e taint check is Stage 4c, after the etcd check, and matches
the taint key exactly.

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

* fix(nkectl): tear down the bootstrap cluster on an untaint failure, print "ready" last

By the time the untaint runs, the kubeconfig, the etcd key and the SPIRE
resources are on disk, so the bootstrap kind cluster holds nothing recovery
needs. It is now torn down whether the untaint succeeds or fails, instead
of being kept with a "retained for recovery" warning and no cleanup hint.

The "Cluster is ready" and key-location lines are printed after the
untaint, so an operator never reads "ready" followed by an error.

The e2e taint check takes the node list and each node's taint keys as plain
assignments, so a kubectl failure aborts under set -e instead of passing as
"no nodes" or "not tainted".

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

* refactor(nkectl): tighten the untaint comments

Comments now state only what a reader could not infer from the code: the
test seam, the teardown on an untaint failure, the "" refusal, and the
re-read on conflict.

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

* refactor(nkectl): derive the untaint from the topology instead of a site spec field

The control-plane taint comes off because the site spec declares no worker
nodes, so the control-plane nodes are the only place workloads can run.
That is a property of the topology, not a choice, so the
cluster.schedulableControlPlane field, its environment override and its
render plumbing are gone. A spec that kept the taint would describe a
cluster nothing can be installed on.

Cluster.ControlPlaneSchedulable carries the rule. The site spec cannot
declare worker nodes yet, so it is always true; its comment says to derive
it from that list once it exists rather than add a field back.

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

* fix(nkectl): report the key before the untaint, skip the bootstrap dump after hand-over

The etcd key location is printed before the untaint runs, so an untaint
failure no longer loses it. The bootstrap cluster's diagnostics are collected
only for a failure before hand-over; an untaint failure is about the site
cluster, which that dump cannot explain.

The untaint matches the control-plane taint by key and NoSchedule effect, so
a same-key taint with another effect is kept, and the manual command in the
error is effect-specific to match. The ControlPlaneSchedulable doc comment
states the contract only.

The first-cluster guide passes the site kubeconfig to both kubectl commands,
and the e2e taint check fails explicitly when a kubectl call does.

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

* docs(nkectl): use the effect-specific untaint command the CLI prints

The manual fallback in the site spec, first-cluster, FAQ and
infrastructure-providers pages matches the command in the bootstrap error.

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-02 12:00:29 -07:00
Lia 0796c79b35 chore(hack): rewrite the standalone mirror-bootstrap-images.sh to read the bootstrap manifest (#1113)
* chore(hack): mirror the bootstrap images the manifest lists

hack/mirror-bootstrap-images.sh carried its own image list. It named a
Bitnami Postgres image the bootstrap no longer runs, and a
registry.imageRegistry setting that does not exist. The script now reads
`nkectl get bootstrap-manifest`, copies each image by digest, and skips
the two images this repository builds. DRY_RUN=1 prints the copies.

The header says what the mirror serves today: the Docker Hub images,
through NKECTL_BOOTSTRAP_DOCKERHUB_MIRROR. The bootstrap has no redirect
for the other registries yet.

Also: the cwedeploy package doc no longer names the Bitnami chart, and
the pointers in docs/first-cluster.md and os-image/packages/spire-agent
follow the manifest.

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

* chore(hack): read the manifest before parsing it; drop mapfile

A failing `nkectl get bootstrap-manifest` now stops the run with its
own error. mapfile hid the producer's exit status behind a process
substitution, and it does not exist on macOS bash 3.2; the script now
reads the manifest into a variable and builds the list with `while
read`, the idiom the other hack scripts use. The crane flag array is
expanded safely when empty.

The header says what NKECTL_BOOTSTRAP_DOCKERHUB_MIRROR can name: a TLS
host with no path. DRY_RUN accepts true and yes, and the dry-run summary
says "planned". has_host treats an upper-case first component as a
registry host, as nkectl does. The TPM pointer lists name the tpm-direct
checksums in cwedeploy.go.

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

* docs(nkectl): name the image variables in bootstrap site --help

The two side-loaded images, their default tags, the make target that
builds them, and the two variables that replace them were documented
only in cli/README.md. The command's help names them too.

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 21:14:56 -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
rorajani be3dcec45e fix(bootstrap): collect diagnostics when the kind cluster fails to create (#1127)
* fix(bootstrap): collect diagnostics when the kind cluster fails to create

nkectl-bootstrap-e2e currently fails with nothing to diagnose. `kubeadm
init` never brings the control plane up, so the only evidence in the run
log is kubeadm retrying against 10.4.1.2:6443 and getting "connection
refused" for eight seconds before giving up. The diagnostics artifact
holds the three fake nodes and the host network, all healthy, and
nothing at all from the bootstrap cluster that actually failed.

Two reasons it is empty. The cluster-diagnostics defer in `bootstrap
site` is registered after engine.Create returns, so a create failure
skips it — and it dumps through kubectl, which cannot work when the API
server is what is missing. Meanwhile kind deletes the node container as
part of its own cleanup ("Deleted nodes: [nkectl-bootstrap-control-
plane]" in the failing run), taking the kubelet journal and the static
pod logs with it.

So pass --retain and collect from the node container through the runtime
instead: kubelet journal, crictl container and pod state, the static pod
manifests, and kube-apiserver and etcd logs. The failure path then
deletes the cluster itself, so a caller ends up where it did before,
minus the missing evidence; --keep-bootstrap-cluster now also keeps a
cluster that failed to create, which is what the flag reads like it
should do.

Every probe is best-effort and records its own failure. A create can
fail before the container exists, and the real error must not be lost to
a diagnostics problem.

The file lands in NKECTL_BOOTSTRAP_DIAGNOSTICS_DIR, so the e2e workflow
uploads it with the rest of the bundle and needs no change.

* chore: satisfy gofumpt in the create-failure probes

* fix(bootstrap): report what /var/lib/containerd is backed by

The node image declares VOLUME /var/lib/containerd, so the node's
containerd stores its snapshots in an anonymous volume. Overlay cannot
be mounted with its upperdir on overlayfs, so if that volume lands on a
runner's own overlayfs root every sandbox fails to start -- and the only
visible symptom is `kubeadm init` getting connection refused on 6443,
which points nowhere near the cause.

These two probes name it: the volume list, and the backing filesystem of
that path inside the node. The fix itself is in #1136; this is so the
next instance of the same shape does not need a second investigation.
2026-10-01 18:05:05 +05:30
Lia 1ba7278df0 feat(nkectl): default the two built images to the local build (#1124)
* feat(nkectl): default the two built images to the local build

NKECTL_CWE_IMAGE and NKECTL_CAPI_PROVISIONED_IMAGE were required. They
now default to nke-controller:latest and
cluster-api-provider-provisioned:latest, the refs the bootstrap manifest
carries for the two images this repository builds. `make -C cli images`
builds both with nerdctl under those tags, always, so a `git pull` does
not leave a stale image behind; the controller image records its commit.
A reference without a registry is side-loaded from the local image
store, as before.

An image with no registry that is not in the store fails with the
inspect error, the build command and the two variables, instead of a
pull from a registry the reference does not name. Docker Hub images are
written as docker.io/<org>/<name>.

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

* fix(nkectl): check local images before the bootstrap cluster exists

With the defaults, a local build that was never made was caught only
after the Kind cluster was up. requireLocalImages now inspects every
image without a registry host before the cluster is created, with the
same message ensureImageAvailable gives later.

Also: a first path component with an upper-case letter counts as a
registry host, as the reference parser reads it; a test pins the
Makefile's image tags to the manifest; the unreferenced ensure-cwe-image
target is gone; the manifest header names its two kinds of image
entries; two comments and one doc example are current.

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-30 13:06:39 -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
Lia b433b4ea23 refactor(cli): move the bootstrap-only packages under internal/bootstrap (#1017)
Six packages exist only for `bootstrap site`: bootstrapengine, cwedeploy,
sitespec, sitecluster, etcdkey and spireentrydump. They move under
cli/internal/bootstrap/, so cli/internal separates what serves the
bootstrap from what serves the site-controller client. bootstrapengine
becomes bootstrap/engine and is imported under its former name; the
others keep theirs.

A pure move: import paths, the paths in cli/Makefile, the root Makefile,
controller/Makefile.dev, hack/mirror-bootstrap-images.sh, the capd-e2e
push glob and the e2e-pr-path-filter regex that must stay in step with
it, docs and comments, and one relative path in a test. No code changes.

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

Signed-off-by: Lia Campbell <liac@nvidia.com>
2026-09-29 09:44:37 -07:00
Cullen McDermottandClaude Opus 5.5 417f23abbd build: bump Go to 1.27.1 and warn when Flox lacks the go.work version (#987)
* build: bump Go to 1.27.1 and warn when Flox lacks the go.work version

go.work, the Flox manifest and every golang: Dockerfile image move to
1.27.1. Flox's plain `go` package tops out at 1.26.7, so the manifest now
uses go_1_27 and leaves the patch version to the lock. The old lock was
still on 1.26.5 because 1.26.8 was never in the catalog.

Go 1.27 moves the standard library to Unicode 17, so:
- charlievieth/strcase goes to v0.0.6, which carries Unicode 17 tables;
  v0.0.5 panics at init. Re-vendored and notices regenerated.
- golangci-lint goes to v2.13.2, built with Go 1.27; v2.12.2 panics.
  Its new gofumpt, nolintlint and staticcheck findings are fixed.

flox-go-version.yml runs in the ghcr.io/flox/flox image when go.work
changes and warns if `flox show go_1_NN` does not list the version.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Cullen McDermott <9535761+cullenmcdermott@users.noreply.github.com>

* fix(provisioned): replace deprecated Requeue with RequeueAfter

golangci-lint v2.13.2 reports ctrl.Result.Requeue as deprecated. The three
immediate retries now use a one-second retryNow.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Cullen McDermott <9535761+cullenmcdermott@users.noreply.github.com>

---------

Signed-off-by: Cullen McDermott <9535761+cullenmcdermott@users.noreply.github.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-23 10:41:44 -04:00
Lia c179b70a61 feat(nkectl): install the provisioned provider from a manifest in the binary (#952)
* feat(nkectl): install the provisioned provider from a manifest in the binary

installProvisionedProvider rendered the kustomize base it found by walking up
to go.work, so a released binary could only install the provider from inside
a checkout of this monorepo -- and the config tree is published nowhere else.
The render is now a generated artifact embedded beside the values files this
package already carries, so the provider installed is the one the binary was
built with and no path has to be supplied.

kubectl kustomize moves from the bootstrap to ,
checked for drift in the same job that verifies the CRDs and RBAC it renders.
Config.ProvisionedProviderPath, NKECTL_CAPI_PROVISIONED_PATH and repoRoot are
gone; nothing in nkectl looks for a checkout now.

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

* build: check the embedded provider manifest in preflight and gate

CI verifies the render, but a developer changing the provider's CRDs or RBAC
learned it was stale only after pushing. preflight now runs the check when
either side moved -- the kustomize base or the rendered copy -- so the kubectl
it needs is only paid for by the change that requires it, and gate runs it
beside the other generated-artifact checks.

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-21 15:15:21 -07:00
Lia ba42d8bf43 feat(nkectl): install the controller chart embedded in the binary (#851)
* feat(nkectl): install the controller chart embedded in the binary

Deploy wrote out the chart it found by walking up from the working directory
to go.work, which only works inside a checkout of this monorepo -- the gap
Config.ChartPath's comment described. It now extracts the copy embedded in
the binary into a temporary directory for the length of the deploy, so a
binary run from anywhere installs the chart of the commit it was built from.

There is no way to point it elsewhere: Config.ChartPath and
NKECTL_CWE_CHART_PATH are gone, so the chart installed is always the chart
the binary was built with. repoRoot stays, because the provisioned provider's
kustomize base is still found that way.

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

* fix(notices): treat the charts module as first party

generate-notices names the first-party sibling modules explicitly, and the
one this change makes nkectl import was not among them, so go-licenses read
it as a dependency with an unknown licence and refused to write the file.
The committed notices are unchanged: the module carries no third-party code.

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

* refactor(charts): name the constant NKEController

The directory is controller/ and the chart in it is named nke-controller,
because a chart is named for the OCI repository it publishes to. At a call
site in cli, charts.Controller read as any of several things.

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-21 14:43:02 -07:00
Davanum Srinivas 2ab60c7f6b refactor: move the module path to github.com/dsx-ai-factory/nke (#896)
* refactor: move the module path to github.com/dsx-ai-factory/nke

All nine modules still declared github.com/NVIDIA/nke after the org
move, so the two documented consumer go get lines resolved only through
GitHub's org-rename redirect.

1391 occurrences across 593 files, plus two lines in vendor/modules.txt.
Replaced by exact string, never by pattern: github.com/NVIDIA/nke is
never a prefix of anything else here, and the three other NVIDIA modules
this repository depends on -- ncx-infra-controller-rest,
infra-controller, and a bare github.com/NVIDIA/ in a GOPRIVATE pattern
-- are untouched.

The generated proto could not be renamed by substitution and was
regenerated. node_agent.pb.go embeds go_package in a length-prefixed
descriptor, so the length byte changes with the string: 0x2d to 0x35.
check-protos caught it. THIRD_PARTY_NOTICES.md for the root and agent
were regenerated too.

Verified: GOPROXY=off make build links all six binaries,
work-check-offline reports vendor consistent with every module, and
agent, cli, controller, controller/api, controller/nico-sim,
controller/hack/capd-reboot-controller, os-image and
cluster-api-provider-provisioned all pass through make.

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

* fix: catch up two things the module-path rename missed

workspace: controller/go.mod's require block and vendor/modules.txt
still had the two local requires (agent, controller/api) at their old
sort position. Ran make work-sync to re-sort both under their new
github.com/dsx-ai-factory/nke path.

lint: cli/.golangci.yml and os-image/.golangci.yml pin gci's local
group to prefix(github.com/NVIDIA/), which no longer matches the
renamed local imports -- gci moved them into the third-party group
and flagged every file that imports across modules. Repointed both at
prefix(github.com/dsx-ai-factory/nke), the same scope goimports uses
in controller/.golangci.yml. No source file needed reformatting: the
import order was already correct for a config that recognized the new
path.

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

---------

Signed-off-by: Davanum Srinivas <dsrinivas@nvidia.com>
2026-09-20 16:52:23 -04:00
Aaron PattenandClaude Opus 5 e04873a7a9 chore(image): publish the container image as nke-controller (#827)
* chore(image): publish the container image as nke-controller

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

* docs(composition): note the overlay's image repository/version coupling

The site-controller overlay pins the image repository but inherits the tag
from the chart's appVersion, so a pre-rename appVersion now resolves to a
tag that was never pushed under the new path. Record the constraint where
someone changing either half will see it.

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

---------

Signed-off-by: Aaron Patten <apatten@nvidia.com>
Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-18 13:23:55 -04:00
Davanum Srinivas 78c83e5e28 test(cli): stop racing the first CWE read in the bootstrap wait test (#816)
TestRunBootstrapSiteWaitsForEveryControlPlaneNode asserts the error names
how many control plane nodes joined. It gave WaitProvisioned a 5ms
deadline, which the first read of the fake API has to beat. On the macOS
runner it did not, so the error said 0 of 3 and the assertion failed. On
Linux the same test passes.

500ms clears the read by a wide margin. The deadline still ends the test,
so it stays fast. The two timeout-only tests above keep 5ms; they assert
a generic error and do not care what the read returned.

Signed-off-by: Davanum Srinivas <dsrinivas@nvidia.com>
2026-09-18 09:06:55 -04:00
Lia 304166098b feat(nkectl): refuse to bootstrap over a host already serving a control plane (#757)
* feat(nkectl): refuse to bootstrap over a host already serving a control plane

Before the bootstrap Kind cluster is built, dial the Kubernetes API port on
every site spec host. One that accepts the connection already runs a control
plane: a retry over a half-built site, or a site spec pointed at a live
cluster. Neither can be provisioned over, and encryption makes the retry case
unrecoverable in place, because a second kubeadm init cannot pick up the key
the host already holds.

The command stops with the hosts named and the remedy stated, before anything
exists to tear down.

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

* feat(nkectl): explain a leftover bootstrap cluster before refusing to start

A bootstrap cluster still running is kept on purpose: by
--keep-bootstrap-cluster, or by a run that failed after building its site
cluster and may hold that cluster's etcd encryption key. The refusal used to
say only that the cluster exists, which invites the delete that loses the
key. It now says how to save the key first, then how to delete and re-run.

The check neither deletes nor reuses the cluster, and sits with the other
pre-create checks so a later resume mode can substitute its own.

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

* fix(nkectl): describe the API-port probe's result as what it is

The check is a TCP connect. Its message now says that port 6443 is accepting
connections and that a control plane is the likely reason, and asks the
operator to confirm kubeadm state before resetting, rather than asserting an
API server is there. The recovery snippet for a leftover bootstrap cluster
sets umask before the first credential it writes, not only before the second.

The probe still treats every dial error as nothing listening: a
pre-provisioned host commonly filters every port but the agent's, and kubeadm's
preflight remains the guard against an initialised node.

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 13:29:50 -07: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
Jonathan MeierandOpenAI Codex d1e00b257b feat(cli): spire trust domain main (#783)
* Configure SPIRE trust domain

Add the SPIFFE trust domain to the site inventory and pass it to the bootstrap SPIRE deployment.

Signed-off-by: Jonathan Meier <jomeier@nvidia.com>

Co-Authored-By: OpenAI Codex <noreply@openai.com>

* Exercise inventory SPIRE trust domain in E2E

Configure the fake host agents and generated site inventory with the same explicit non-default trust domain.

Signed-off-by: Jonathan Meier <jomeier@nvidia.com>

Co-Authored-By: OpenAI Codex <noreply@openai.com>

* Document site SPIFFE trust domain

Require the site specification to match the trust domain provisioned on host agents and used by the permanent SPIRE server.

Signed-off-by: Jonathan Meier <jomeier@nvidia.com>

Co-Authored-By: OpenAI Codex <noreply@openai.com>

* Clarify conditional SPIFFE requirement

State that an explicit trust domain is required only when the site bootstrap enables SPIRE and SPIFFE.

Signed-off-by: Jonathan Meier <jomeier@nvidia.com>

Co-Authored-By: OpenAI Codex <noreply@openai.com>

---------

Co-authored-by: OpenAI Codex <noreply@openai.com>
2026-09-16 13:41:46 -04:00
Jonathan MeierandOpenAI Codex e4a62bb0a6 feat(cli): persist SPIRE workload identity entries to disk (#768)
* copy SPIRE entries during site bootstrap

Copy the live ClusterStaticEntry CRD and workload registrations into the site cluster before the ephemeral bootstrap cluster is removed.

Signed-off-by: Jonathan Meier <jomeier@nvidia.com>
Co-Authored-By: OpenAI Codex <noreply@openai.com>

* NKX-15538: export SPIRE entries during site bootstrap

Implements NKX-15538. Write the live ClusterStaticEntry CRD and sanitized workload registrations beside the site kubeconfig for later use.

Signed-off-by: Jonathan Meier <jomeier@nvidia.com>

Co-Authored-By: OpenAI Codex <noreply@openai.com>

* NKX-15538: fix SPIRE entry export CI

Implements NKX-15538. Isolate the successful bootstrap test from the live SPIRE export and record the YAML package as a direct CLI dependency.

Signed-off-by: Jonathan Meier <jomeier@nvidia.com>

Co-Authored-By: OpenAI Codex <noreply@openai.com>

* NKX-15538: preserve SPIRE trust configuration

Implements NKX-15538. Add the SPIFFE trust domain to the site spec and document a DSX Identity cutover that requires the original trust domain and CA bundle.

Signed-off-by: Jonathan Meier <jomeier@nvidia.com>

Co-Authored-By: OpenAI Codex <noreply@openai.com>

* NKX-15538: document SPIRE VIP cutover

Implements NKX-15538. Make DSX Identity responsible for its CRD, preserve host agent configuration through a shared VIP, and retain the bootstrap Kind cluster for initial cutover rollback.

Signed-off-by: Jonathan Meier <jomeier@nvidia.com>

Co-Authored-By: OpenAI Codex <noreply@openai.com>

* Revert "NKX-15538: document SPIRE VIP cutover"

This reverts commit ca138ed49b.

* Revert "NKX-15538: preserve SPIRE trust configuration"

This reverts commit fd36c47b19.

---------

Signed-off-by: Jonathan Meier <jomeier@nvidia.com>
Co-authored-by: OpenAI Codex <noreply@openai.com>
2026-09-16 12:43:03 -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