mirror of
https://github.com/dsx-ai-factory/nvke.git
synced 2026-12-07 04:35:58 +08:00
pull-request/2414
11
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
82c8b7e8a3 |
feat(cli): time each bootstrap phase with spans and log lines (#1979)
* feat(cli): time each bootstrap phase with spans and log lines bootstrap site runs in five phases: preflight, bootstrap_cluster, engine_deploy, site_cluster and finish. Each phase now has a child span of the run's root span and logs one "phase finished" line with its outcome and duration_ms, so phase durations are available without a trace backend. Every log line carries operation and, once the site spec is loaded, cluster. While a phase runs, a line also carries phase, and its span_id is the phase span's. The run tracks the current phase, because the component loggers are built before a phase starts and are given no context. With --json-logs the time is in UTC. The Kind cluster's log attribute is now bootstrap_kind_cluster, so cluster means the site cluster on every line. Signed-off-by: Anisha Gupta <anisgupta@nvidia.com> * fix(cli): keep the site cluster name on the lines that already carried it The handler adds cluster to every line, and a record that names cluster keeps its own value, so these lines carry it once. Signed-off-by: Anisha Gupta <anisgupta@nvidia.com> * docs(cli): show the new log fields in the existing troubleshooting example Signed-off-by: Anisha Gupta <anisgupta@nvidia.com> * test(cli): let the bootstrap e2e allowlist accept the phase fields on its two log lines The allowlist matches each of those lines from time= to its end, so the operation, cluster and phase fields now on every line made gitleaks flag both again. Signed-off-by: Anisha Gupta <anisgupta@nvidia.com> * test(cli): cover an interrupted bootstrap and a masked phase error Signed-off-by: Anisha Gupta <anisgupta@nvidia.com> * fix(cli): give exported log records the phase span and fields With OTLP export on, the tee handler put the root span into a record's context before the log handler ran, so a context-free logger never got its phase span, and the exported record never got phase, operation or cluster. Resolve the span and fields once and use them for both the stderr line and the exported record. Signed-off-by: Anisha Gupta <anisgupta@nvidia.com> * fix(cli): log trace fields before the run fields again The previous commit stamped trace_id and span_id after operation, cluster and phase, which the e2e gitleaks allowlist does not match, so its etcd key line was reported as a leak. Restore the order and pin it in a test. Signed-off-by: Anisha Gupta <anisgupta@nvidia.com> * fix(cli): let a bound logger field win over the run's field A logger made with With("cluster", ...) got the run's cluster field as well, so the line had the key twice. Track the top-level keys a handler has bound and skip those run fields. Signed-off-by: Anisha Gupta <anisgupta@nvidia.com> * refactor(cli): name the phase tracker's error parameter previousErr Signed-off-by: Anisha Gupta <anisgupta@nvidia.com> * fix(cli): track a logger's bound fields per group Attributes bound after WithGroup go in the same group as the record's attributes, so the run's field collided with them and the line had the key twice. Start a new set of bound keys at each group, and make the test assert the group's one value. Signed-off-by: Anisha Gupta <anisgupta@nvidia.com> * Revert "fix(cli): track a logger's bound fields per group" This reverts commit |
||
|
|
d242af22c3 |
fix(cli): load images pinned by digest into the bootstrap kind cluster (#1924)
Signed-off-by: Akshay Kumar <akshaykumar@nvidia.com> |
||
|
|
116232b2a1 |
fix: prevent bootstrap cluster pods getting IPs from kind CIDR (#1835)
* fix: prevent bootstrap cluster pods getting IPs from kind CIDR Signed-off-by: Patrick Christopher <pchristopher@nvidia.com> * fix: resolve coderabbit comments Signed-off-by: Patrick Christopher <pchristopher@nvidia.com> * fix: nerdctl bridge check Signed-off-by: Patrick Christopher <pchristopher@nvidia.com> * fix: prevent nerdctl networking from getting into the site node networking Signed-off-by: Patrick Christopher <pchristopher@nvidia.com> * fix: local agent review Signed-off-by: Patrick Christopher <pchristopher@nvidia.com> * fix: prevent env var being set to cause networking being forced into nerdctl that gets shared to cluster Signed-off-by: Patrick Christopher <pchristopher@nvidia.com> --------- Signed-off-by: Patrick Christopher <pchristopher@nvidia.com> |
||
|
|
0c48b2612e |
feat: bootstrap site can use capnico for initial node creation (#1356)
* fix: rebase Signed-off-by: Patrick Christopher <pchristopher@nvidia.com> * fix: rebase repair Signed-off-by: Patrick Christopher <pchristopher@nvidia.com> * feat: make bootstrap nico follow patterns of tenant nico registry Signed-off-by: Patrick Christopher <pchristopher@nvidia.com> * feat: dry-run catches mTLS mismatches Signed-off-by: Patrick Christopher <pchristopher@nvidia.com> * fix: code review updates Signed-off-by: Patrick Christopher <pchristopher@nvidia.com> * fix: linter fixes Signed-off-by: Patrick Christopher <pchristopher@nvidia.com> * fix: code review comments Signed-off-by: Patrick Christopher <pchristopher@nvidia.com> * fix: refactor, comment update Signed-off-by: Patrick Christopher <pchristopher@nvidia.com> * fix: review changes, use approved schema Signed-off-by: Patrick Christopher <pchristopher@nvidia.com> * fix: nico bootstrap troubleshooting Signed-off-by: Patrick Christopher <pchristopher@nvidia.com> * fix: capnico manifest Signed-off-by: Patrick Christopher <pchristopher@nvidia.com> * fix: review comments Signed-off-by: Patrick Christopher <pchristopher@nvidia.com> * fix: more review comments Signed-off-by: Patrick Christopher <pchristopher@nvidia.com> * fix: review comments Signed-off-by: Patrick Christopher <pchristopher@nvidia.com> * fix: local agent reviews Signed-off-by: Patrick Christopher <pchristopher@nvidia.com> * fix: local agent review Signed-off-by: Patrick Christopher <pchristopher@nvidia.com> * feat: move credentials from sitespec to env vars Signed-off-by: Patrick Christopher <pchristopher@nvidia.com> * fix: more agent fixes Signed-off-by: Patrick Christopher <pchristopher@nvidia.com> * fix: more agent review Signed-off-by: Patrick Christopher <pchristopher@nvidia.com> * fix: more agent reviews Signed-off-by: Patrick Christopher <pchristopher@nvidia.com> * fix: more agent review Signed-off-by: Patrick Christopher <pchristopher@nvidia.com> --------- Signed-off-by: Patrick Christopher <pchristopher@nvidia.com> |
||
|
|
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> |
||
|
|
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> |
||
|
|
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> |
||
|
|
9b87e9b636 |
chore(nkectl): say controller, not CWE, in output, comments and tests (#1386)
Signed-off-by: Aaron Patten <apatten@nvidia.com> |
||
|
|
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> |
||
|
|
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.
|
||
|
|
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> |