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 | |
|---|---|---|---|---|
|
|
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> |
||
|
|
bc75b98193 |
docs(cli): generate the nvkectl command reference from the command tree (#1773)
The repository has a hand-maintained quick reference and workflow guides, but
no complete reference. An operator cannot browse the whole public CLI without
a built binary, and nothing ties the prose to the commands, so the two drift
apart silently.
Add cli/docs/reference: an index and one page per public command, generated
from the cobra tree nvkectl itself runs. Each page carries the command's
purpose, invocation and positional arguments, aliases, examples, local and
inherited options with types and defaults, the required and mutually exclusive
option groups, and a deprecation notice when it has one.
cobra's doc package writes the body of each page. It does not emit aliases,
deprecation notices, flag-group constraints or an index, and it never removes
the page of a deleted command, so internal/clidocs adds those around it. All
of it is read from the command, so there is no second catalogue to maintain.
Deterministic, so repeated generation from unchanged source produces identical
files:
- cobra's generated-on timestamp is switched off on every command.
- The NVKECTL_ and NKECTL_ variables are cleared before the tree is built.
Two of `bootstrap site`'s flag defaults -- --diagnostics-dir and --timeout
-- are read from the environment by the command constructor, through
internal/envalias, which still honours the old prefix. Without this the
pages would record whatever the generating shell happened to have set.
- HOME and the XDG config directory are pinned, and the build metadata is a
fixed placeholder.
Generation runs no command and contacts nothing: it builds the tree and reads
its metadata, so it needs no credential, kubeconfig, configured site or
cluster. newRootCmd is exported for it, which is what the move to an
importable package was for.
`make -C cli docs` regenerates and `make -C cli docs-check` verifies, failing
on output that is stale, missing, obsolete, or newly generated and never
committed. The check joins the generated-artefact gate, which already covers
the provisioned-provider manifest and the generated API code, and joins
`make gate` and `make preflight` locally.
Two commands lazily added by cobra needed initialising before the traversal,
or the root page would link to pages that were never written: `help` and
`completion`. cobra's doc package also calls InitDefaultHelpCmd on every
command it renders, not just the root, which invented a `help` subcommand
under each group command -- `nvkectl bootstrap help` is not a command -- so
each one is given a hidden help command first to decide what cobra adds.
Hidden commands and help topics are excluded, which is why `render` and
`inspect` do not appear; a deprecated command keeps its page for as long as it
still runs.
Constraints enforced inside RunE are invisible to cobra. Those on `config
set-site` and the two patch commands are now stated in the flag usage strings
and Long text, so --help and the reference agree. No behaviour changes: the
checks still run where they did, with the messages they had.
cobra/doc brings go-md2man and blackfriday into cli/go.mod. Neither is
reachable from ./cmd/nvkectl, so the shipped binary is unaffected and
THIRD_PARTY_NOTICES.md is unchanged.
Signed-off-by: Jonathan Meier <jomeier@nvidia.com>
|
||
|
|
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> |
||
|
|
9b87e9b636 |
chore(nkectl): say controller, not CWE, in output, comments and tests (#1386)
Signed-off-by: Aaron Patten <apatten@nvidia.com> |
||
|
|
6ded04c8ea |
ci(bootstrap-e2e): start containerd and buildkitd without systemd (#1102)
* ci(bootstrap-e2e): start containerd and buildkitd without systemd install_runtime writes two systemd units and starts them with systemctl. A runner pod has no init system, so on ARC the lane dies at System has not been booted with systemd as init system (PID 1). Can't operate. The units are still written either way -- they document the exact flags, and a VM runner uses them. Only the starting differs, and both wait_for_socket assertions are unchanged, so the success condition is the same. Failure diagnostics read the daemon log instead of journalctl. remove_docker is the part that needs a decision, not just review. It proves Docker is gone by asserting its units are masked. In a pod there are no units: Docker is a dind sidecar reached over a mounted socket, so removing the socket makes it unreachable while the daemon still exists. That is a weaker guarantee than masking, and the two masking assertions are skipped without systemd to match. The shim assertions, which are the substantive ones, still run on both paths. Verified on arc-arm64-vtpm: the lane cleared Install nerdctl, Remove Docker and Build CWE image, and now fails three steps later at kubeadm init, where the nested control plane never becomes healthy. That blocker is unrelated to this change and is why the lane stays on the self-hosted fleet in #1042. * ci(bootstrap-e2e): make the no-systemd Docker removal as strong as masking The first version deleted the dind socket and skipped the masking assertions, calling the guarantee weaker and leaving the question open. It was weaker for a concrete reason: the kubelet can restart the dind sidecar, and it recreates the socket on startup, so a job could reach a daemon again halfway through. Close it instead of documenting it. Without systemd the client itself is removed, and DOCKER_HOST is pointed at a path that does not exist via GITHUB_ENV so later steps inherit it -- nothing left to reach a restarted sidecar with. Deleting the binary is safe exactly here and nowhere else: this runner is an ephemeral pod thrown away after one job, where on a reusable VM it would outlive the run and break the next one. Both halves are now asserted rather than assumed, for the reason the masking always was: a removal that did not take reads as a guarantee while providing nothing. * ci(bootstrap-e2e): create /etc/systemd/system before writing the units The unit files are written on every host, including the ones with no systemd to read them, where that directory is incidental rather than guaranteed. It exists on both fleets today -- the ARC run installs the runtime fine -- so this is not a live failure. But a suite whose purpose is working without systemd should not rest on a directory systemd owns. Raised by CodeRabbit on #1102. * ci(bootstrap-e2e): gate the Docker deletion on a disposable host, not on systemd Two review points on the no-systemd path. have_systemd detects an init system, not a host that gets discarded, and the binary deletion was keyed off it. On a reusable non-systemd host that deletes every docker on PATH permanently, outliving the run and taking the next one with it -- and the shim does not put them back. It now waits on NKE_E2E_DISPOSABLE_HOST, which only a caller that knows its runners are single-use can set; this workflow does, and anything that has not said so keeps its binaries and gets the shim and DOCKER_HOST alone. That is weaker only against a caller invoking a real binary by absolute path with its own -H, and the assertion that the binaries are gone now runs only where the deletion was the path taken. The unmanaged daemons' logs move out of /tmp/<name>.log into a root-owned 0700 directory. They are written by a root redirect, so on a host where another local user can pre-create that path as a symlink the redirect follows it. * ci(bootstrap-e2e): pass start_unmanaged's argv as positional parameters It joined argv with "$*" into a `sudo sh -c` string, so the root shell re-split the result on whitespace and acted on metacharacters, and the caller's quoting did not survive. The daemon flags come from the environment, CONTAINERD_ADDRESS and BUILDKIT_HOST among them. Demonstrated with three arguments -- "two words", "semi;colon", "a*b" -- which the old form turned into [two] [words] [semi] and then ran `colon` as a command. The new form keeps all three intact. CI sets fixed values, so this was the general case rather than a live hole. Predates this branch; it is in scope because the redirect on this line moved here. |
||
|
|
6947a934ab |
fix(bootstrap-e2e): keep nerdctl's data root off overlayfs (#1136)
This is why nkectl-bootstrap-e2e fails on a container runner and passes on a VM. The kind node image declares VOLUME /var/lib/containerd, so the node's own containerd keeps its snapshots in an anonymous volume, and anonymous volumes live under nerdctl's data root. That default is /var/lib/nerdctl -- real disk on a VM, the pod's overlayfs root in a container. Overlay cannot be mounted with its upperdir on overlayfs, so every control-plane sandbox failed to start: failed to start sandbox: failed to create containerd task: failed to create shim task: failed to mount rootfs component: mount source: "overlay", ... upperdir=/var/lib/containerd/io.containerd.snapshotter .v1.overlayfs/snapshots/3/fs, ... err: invalid argument The kubelet wrote all four static pod manifests and then created nothing, which is why the only visible symptom was kubeadm retrying against 10.4.1.2:6443 and getting connection refused. crictl ps -a and crictl pods were both empty. Point the data root under containerd's own root instead. That path already has to be non-overlay for the CWE image build, so this inherits an existing requirement rather than adding a new one, and it is asserted at install time -- on overlayfs the lane fails here with the reason instead of twelve minutes later with none. |
||
|
|
e7cd1d7a48 |
fix(cli): retry the nerdctl download in the e2e host bootstrap (#981)
A 500 from the GitHub releases CDN failed nkectl bootstrap e2e on arm64 in 67 seconds. Same flags the workflow already uses for its own downloads. Signed-off-by: Davanum Srinivas <dsrinivas@nvidia.com> |
||
|
|
4ce6c34a4d |
ci: add arm64 legs to the remaining e2e lanes and name artifacts by arch (#875)
* ci: add arm64 lanes to the four amd64-only e2e workflows Four e2e workflows ran one architecture. capd-e2e and nico-e2e already run both, and kubeadm-bringup-e2e and nico-vms-e2e run both on the self-hosted KVM fleet. gofail-e2e ubuntu-latest + ubuntu-24.04-arm capd-dsx-identity-exchange-e2e linux-amd64-cpu16 + linux-arm64-cpu16 nkectl-bootstrap-e2e linux-amd64-cpu16 + linux-arm64-cpu16 local-entrypoint-e2e linux-amd64-cpu16 + linux-arm64-cpu16 None of the four needs /dev/kvm, so none goes on the self-hosted fleet. gofail is hosted on both sides because it reads its CAPNICo CRDs from a committed fixture and needs no token, so a fork can run it. The other three set NKE_E2E_DOCKERHUB_MIRROR, which only resolves inside the NVIDIA fleet, so both their legs stay there. Three downloads hard-coded the architecture and now read it: nkectl-bootstrap clusterctl-linux-amd64 -> dpkg --print-architecture nkectl-bootstrap nerdctl --platform linux/amd64 -> matrix.arch local-entrypoint tilt linux.x86_64 -> the case nico-vms-e2e.yml uses local-entrypoint crosses architecture with its existing post-init CNI matrix, so it goes from two jobs to four. Signed-off-by: Davanum Srinivas <dsrinivas@nvidia.com> * ci: fix the arm64 legs found by verification - bootstrap-e2e-host.sh downloaded nerdctl-full for linux-amd64 on any host, and one pinned checksum passed it, so arm64 died at the first exec. Now per-arch, both sums from the release SHA256SUMS. - gofail keyed its caches on runner.os, Linux on both legs. Added runner.arch. - Artifact names carried no arch in kubeadm-bringup, nkectl-bootstrap and local-entrypoint. Run 35451757091 produced two artifacts both named kubeadm-bringup-35451757091-1. - Two comments said what the code refutes: gofail does not run on a fork, and the mirror is not what holds nkectl-bootstrap on the fleet. Signed-off-by: Davanum Srinivas <dsrinivas@nvidia.com> * ci: gate the CRD drift check to amd64, drop a one-sample claim - The CAPNICo fixture is arch-independent, so the arm64 leg only doubled the gh api calls and the flake surface. - Two runs disagree on which gofail leg is slower (arm64 10m14s/9m41s, amd64 7m09s/11m45s), so the header no longer names one. - cwedeploy.go:426-429 named by function instead of line. Signed-off-by: Davanum Srinivas <dsrinivas@nvidia.com> * ci: run local-entrypoint arm64 on the default CNI path only Three legs, not four. The post-init CNI path is this lane's unique coverage and stays on amd64; arm64 covers the default path. The pool constraint here is queue time, not the 11 minutes a leg takes. Signed-off-by: Davanum Srinivas <dsrinivas@nvidia.com> --------- Signed-off-by: Davanum Srinivas <dsrinivas@nvidia.com> |
||
|
|
965e7b9125 |
ci(nkectl): move the e2e job's host preparation out of the workflow (#670)
Two steps -- installing the standalone containerd and buildkitd, and removing Docker -- were over two hundred lines of bash inside YAML, where shellcheck saw them only through actionlint and nothing could exercise them off a runner. They are now cli/hack/bootstrap-e2e-host.sh with one subcommand each, next to the cli e2e suite they serve. The bodies moved verbatim, less their duplication: the two socket polling loops are one helper. The shim directory lives in RUNNER_TEMP on a runner and TMPDIR otherwise, and the GITHUB_PATH prepend is skipped with a message when there is no runner, so the script also serves a developer reproducing CI. Comments went with the code they explain and were cut back on the way: the workflow's prose is roughly halved, and what is left says what the job does rather than recounting the incidents behind each setting. The workflow keeps what is about the job -- the pinned environment, and that the runners are single-use so nothing needs undoing. hack/shell-scripts.sh enumerates tracked scripts by extension, so the merge gate lints the new file at the same severity as every other. Co-developed-by: Claude <noreply@anthropic.com> Signed-off-by: Lia Campbell <liac@nvidia.com> |
||
|
|
a3c868615c |
fix(license): normalise SPDX headers to Apache-2.0, and assert it (#197)
* chore(license): normalise SPDX headers to Apache-2.0 [machine generated] MACHINE GENERATED. Every added line in this commit is `SPDX-License-Identifier: Apache-2.0` and nothing else; every removed line is the identifier it replaces, or the notice paragraph that followed it. Verified: 0 added lines are anything other than that SPDX line. 829 files. The repository ships Apache-2.0 -- LICENSE says so and GitHub reports it -- while 676 Go files and 153 others declared a different identifier, followed by a notice that contradicted it. The copyright line, the comment style and the indentation are left alone. Files carrying the short form, two SPDX lines with no notice paragraph, have the identifier swapped and nothing else. Markdown is excluded: there the identifier appears in prose describing the mismatch rather than in a header, so rewriting it would turn the sentence into a tautology. That file is handled in the next commit. Three shapes needed care, and each is worth knowing about if this is ever repeated. controller/api/prepend-license.go carries the block inside a Go raw string, so the paragraph's last line ends with a backtick; the closing delimiter is carried back onto the SPDX line rather than dropped, or the string would be left unterminated. Two shell scripts under controller/hack/ word the final sentence differently, so matching on the common ending alone misses them. And controller/.golangci.yml prefixes each line with "# //", which has to be stripped before the paragraph text can be recognised. The templates that produce these headers are rewritten here too, so this commit is self-consistent: the five addlicense boilerplates, the five goheader templates in .golangci.yml, and the block in prepend-license.go. Every header in the tree now names the same identifier. Review the next commit. This one is a substitution. Signed-off-by: Davanum Srinivas <dsrinivas@nvidia.com> * fix(license): one header template, and a check that reads it The previous commit fixed the headers. This one stops them drifting again, and is the part worth reviewing. Nothing here could catch a header that named the wrong licence. addlicense only ADDS a header to a file that has none; it never rewrites one already present. So `make file-license-check` runs addlicense, finds every file already stamped, produces no diff, and passes -- whatever the header says. agent/ is the proof: its template and its check have both been correct all along, and six of its files disagreed with them. Three mechanisms defined the header and could disagree with each other: an addlicense boilerplate per module, a goheader template in five .golangci.yml files, and a hardcoded block in controller/api/prepend-license.go that stamps generated API code. They are now one file, hack/license-header.tmpl, and every module reads it. make license-header-check replaces the per-module matrix and asserts two things rather than one: that a header exists, and that it names Apache-2.0. The second assertion is what this repository never had. Verified by planting a different identifier in a file and confirming the check fails and names it. Modules resolve the template through `git rev-parse --show-toplevel`, not a relative path. A relative ../hack path silently changes meaning when a module moves, which is how cli/ broke when it moved out of controller/. The file set is the union of what the per-module targets already ignored, so this covers exactly the files stamped today. 120 files carry no header at all -- generated output, testdata, fixtures, build tooling, three .github files -- and widening the set to reach them is a separate change. Mixing headers that are WRONG with headers that are MISSING would hide both. Dockerfiles stay out: addlicense keys off the file extension and gives Dockerfile.proto C-style // comments, which Docker cannot parse. AGENTS.md's licence-header rule now describes the current state: one identifier, added by `make license` rather than copied from a neighbouring file. The ban on relicensing as a side effect of unrelated work stays. The header-check job is renamed from "License headers (<module>)" to "License headers". The merge gate calls this workflow whole rather than naming its jobs, and the branch ruleset requires only `gate` and `DCO`, so no required check changes name. Verified: GOPROXY=off make build links all five binaries with no credentials; golangci-lint goheader reports 0 issues on cli and controller; `make license` is a no-op in all five modules; make license-header-check passes over 828 files and fails on a planted mismatched header. Signed-off-by: Davanum Srinivas <dsrinivas@nvidia.com> stderr is not captured when reading addlicense's output. addlicense prints the offending paths to stdout, while `go run` writes "go: downloading ..." on a cold module cache and "exit status 1" on failure -- both to stderr. Folding the two together reports a module download as a file with no header, which is how the first CI run of this check failed while passing on a machine whose cache was already warm. Reproduced locally against an empty GOMODCACHE. Signed-off-by: Davanum Srinivas <dsrinivas@nvidia.com> --------- Signed-off-by: Davanum Srinivas <dsrinivas@nvidia.com> |
||
|
|
144cc6c612 |
refactor: move nkectl to cli/, and ship it from per-component tags (#168)
* refactor: move nkectl from controller/nkectl to cli Signed-off-by: Davanum Srinivas <dsrinivas@nvidia.com> * build: release per-component tags, and ship nkectl binaries Both existing tags, agent/v0.2.0 and controller/v0.1.0, ran this workflow green on 2026-08-14 and produced nothing: the release job skipped itself on `!contains(ref_name, '/')` and the publish job is an echo. So the repository has two tags and no releases, and nkectl -- a cobra CLI whose own Makefile calls it "a redistributed binary" -- reaches nobody. A tag here is <module-directory>/vX.Y.Z because Go requires it: the module github.com/NVIDIA/nke/controller/nkectl can only be resolved by a tag named controller/nkectl/vX.Y.Z. That makes the tag self-describing, so the component is read back off it and no step names nkectl. Move the module and its tag prefix moves with it, since Go keeps them the same string; go.work is then the check that the directory exists, and an unknown one fails loudly rather than releasing an empty tag. Splitting on the last "/v" handles the two-level prefix, which a single-slash assumption would have broken on the first controller/nkectl tag. nkectl ships as four static binaries -- darwin and linux, amd64 and arm64 -- with checksums.txt and its own THIRD_PARTY_NOTICES.md, which exists precisely because the binary is redistributed. Roughly 8 MB each. Other components release notes only until they declare artifacts; the case statement is explicit because components genuinely differ and guessing would be worse. Two bugs found while doing it. The version match in controller/nkectl/Makefile was 'nkectl/v[0-9]*', a prefix no correctly-formed tag can carry, so it could never fire and every build fell through to the commit SHA. The changelog step stripped only a leading "v", so a prefixed tag looked for a heading that cannot exist and silently shipped a one-line body. Cross-built binaries cannot be executed to prove their -X symbols, so the host-matching output is run instead: all platforms share one ldflags string, so one stamped binary proves the rest. Signed-off-by: Davanum Srinivas <dsrinivas@nvidia.com> * build: point the release tooling at cli/ after the move Signed-off-by: Davanum Srinivas <dsrinivas@nvidia.com> * docs: reorder the module table for cli/ Signed-off-by: Davanum Srinivas <dsrinivas@nvidia.com> * ci: rename the nkectl lint job for cli/ Signed-off-by: Davanum Srinivas <dsrinivas@nvidia.com> * fix(cli): repoint the notices paths at controller/ after the move The module was a child of controller/, so '..' reached the controller Makefile and hack/ directory. From cli/ it reaches the repository root, which has neither. Same class of break as the relative replace in go.mod. Also reorder two import blocks: cli/ sorts before controller/, so gci wants the local import first. Signed-off-by: Davanum Srinivas <dsrinivas@nvidia.com> * fix(notices): ignore controller/api, a first-party module with no LICENSE nkectl began importing it in the CWE sync, so go-licenses classified it as unknown and the check failed. It is our own code, which is what the ignore list is for. Signed-off-by: Davanum Srinivas <dsrinivas@nvidia.com> * Update .github/workflows/release.yml Co-authored-by: Terry Howe <terrylhowe@gmail.com> --------- Signed-off-by: Davanum Srinivas <dsrinivas@nvidia.com> Co-authored-by: Terry Howe <terrylhowe@gmail.com> |