Commit Graph
9 Commits
Author SHA1 Message Date
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
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
Davanum Srinivas 237807228f ci(nico-vms): cut the lane's clock: one upgrade hop, Calico, no pre-join reboot, and two CWE fixes (#516)
* test(e2e): let a lane cap the Kubernetes upgrade chain

The upgrade specs walk 1.34.2 -> 1.35.3 -> 1.36.0 on one cluster. Each
hop recycles every control-plane node, about 45 minutes on the nico-vms
lane, so the two hops are the largest block of its 150-190 minute runs.

NKE_E2E_UPGRADE_HOPS caps how many hops a run walks; unset, zero or
invalid keeps the whole chain, so nothing changes by default. The
nico-vms workflow sets 1.

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

* test(e2e): let a lane pick the nico-vms CNI

NKE_E2E_NICO_VMS_CNI sets the CNI for nico-vms entries that do not pin
one; unset keeps ovn-kubernetes. The nico-vms workflow sets calico: its
image package is 523 MB against OVN's 1,579 MB, and the import that
dominates each node's cloud-init drops from 3-4.5 min to about one.
Entries that pin OVN (multi pod CIDRs, node pool lifecycle, cp rotation)
are unchanged.

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

* test(fixtures): skip the pre-join reboot on the nico-vms control planes

The fleet reboots before join so disable-ipv6-grub takes effect; the lane
skips the 1-2 min per node. Kept on the worker so the path still runs.

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

* fix(controller): coalesce DB reconcile events per key

Every DB write fans out to the DB-backed controller sources, so a write
storm on one row reconciles it at transaction speed. Measured on the
nico-vms lane: the control-plane controller reconciled about 10 times a
second for the whole of an upgrade (276,000 log lines in one run), and
the node remediation controller re-issued the reboot workflow start
2,211 times in the 75 seconds a node took to reboot. Both run on the
12 cores the tenant VMs share.

Deliver a key at most once per second: the first event goes out at once,
events inside the window fold into one trailing delivery that runs after
the last of them, so a reconcile always reads the newest state and no
change is lost.

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

* fix(controller): do not call an upgrade complete while nodes run the old version

Right after a pool's version changes nothing is deprecated yet and every
node is healthy, so the old check read that as complete and upgraded the
add-ons against a node still on the previous kubeadm.

Pool-managed only: the controller path never writes the pool version.
Warn when the blocking pool has auto-provision disabled.

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

* ci(bootstrap-e2e): route node pulls through the CI mirror, and log the routing

The lane never set NKE_E2E_DOCKERHUB_MIRROR, so the node image kept the
dev-cache hostnames, which resolve to nothing in CI and sent every pull
to docker.io: traefik's 55 MB took 5m48s against a 5m helm wait.

hosts.toml now comes from a build arg: CI mirror, dev cache, upstream.
containerd walks the list, so a missing host costs a dial. The files,
the probe and the node's routing are logged.

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

* ci(bootstrap-e2e): run on the mirror branch, on NVIDIA runners

With no push trigger for pull-request/N, a pull request reached this
lane only through the gate, under pull_request, which self-hosted
runners ignore. That forced GitHub-hosted ubuntu-22.04: 22-41 min and
flaky on docker.io pull speed, against 12-13 min on cpu16.

Same route as capd-e2e and nico-e2e, and like them it leaves the gate
and reports as its own advisory check. A gate member is never
path-filtered, so controller/** joins the paths.

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

---------

Signed-off-by: Davanum Srinivas <dsrinivas@nvidia.com>
2026-09-05 16:41:55 -04:00
vwilson-nvidia 928733d91e refactor: simplify db-backed reconcile sources (#290)
* refactor: simplify db-backed reconcile sources

Refactor DB-backed reconcile sources to implement the controller-runtime TypedSource contract directly.

- Add generic DB source/key mapper support for cluster, node pool, node set, and node sources
- Unregister sources when their context is canceled
- Remove the old dbreconcile/source wrapper package
- Add typed source and cancellation coverage

Why:
This keeps DB mutation fanout in the DB wrapper, but lets each source choose the key type it enqueues. Existing controllers continue to enqueue dbreconcile.Key.

The tenant node health controller will need the same immediate DB node-change signal, but keyed as a tenant node request instead of a DB reconcile request. With this shape, it can register a DB node source that maps db.Node changes to ClusterID + NodeName and requeues the tenant-side health reconcile directly.

* test: pass typed source contexts through tests

- Start typed string sources with the same context used to construct them

- Fix contextcheck lint failures in dbwrapper source coverage
2026-08-25 16:43:20 -06:00
vwilson-nvidia e454bdb093 fix(teleport): reconcile tokens from node events (#274)
- Move the Teleport token reconciler into its own controller package
- Wire it directly into controller-runtime when Teleport is enabled
- Requeue nodes from related cluster, node pool, and node set changes
- Keep reconciliation node-scoped and update token metrics per reconcile result
- Extend DB reconcile wrappers with parent mapping helpers used by node-rooted controllers

Signed-off-by: Vivin Wilson <vwilson@nvidia.com>
2026-08-25 07:02:11 -06:00
vwilson-nvidia 510d5acb20 feat: add database-driven controller reconciliation (#226)
- Capture changed database objects in the reconcile DB wrapper and let each
  controller decide whether and how those objects map to reconcile keys.
- Move relationship-specific filtering into controller source registration
  instead of centralizing parent lookup logic in the wrapper.
- Convert the control-plane, tenant access, node pool, node set, and node
  provisioning monitor controllers to register DB-backed sources with filters
  and key mappers.
- Add source resync for all DB-backed sources as a missed-event safety net using
  a 15 minute default interval with Kubernetes-style jitter.
2026-08-21 08:23:07 -06:00
Chao 4ff7b01f31 Add Kubernetes-native tenant CSR controller (#173)
* feat(controller): reconcile tenant access from database events

Signed-off-by: Chao Chen <chaoch@nvidia.com>

* feat(controller): reconcile tenant CSRs natively

Signed-off-by: Chao Chen <chaoch@nvidia.com>

* fix(controller): retain tenant access during teardown

Signed-off-by: Chao Chen <chaoch@nvidia.com>

* docs(controller): document tenant controller scaling

Signed-off-by: Chao Chen <chaoch@nvidia.com>

* fix(controller): address tenant CSR review feedback

Signed-off-by: Chao Chen <chaoch@nvidia.com>

* fix(license): update tenant controller headers

Signed-off-by: Chao Chen <chaoch@nvidia.com>

* fix(controller): separate node and cluster enqueue paths

Signed-off-by: Chao Chen <chaoch@nvidia.com>

---------

Signed-off-by: Chao Chen <chaoch@nvidia.com>
2026-08-20 07:53:12 -06:00
Davanum Srinivas 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>
2026-08-18 20:42:45 -04:00
vwilson-nvidia 3174d9acd6 feat(controller): add database reconcile runtime (#171)
- Add controller-runtime scaffolding for database-backed reconcilers.
- Add database wrapper hooks that enqueue node reconcile keys after successful writes.
- Migrate node provisioning monitor to the database reconcile runtime.
- Register database reconcilers through the shared controller-runtime manager.
- Fix local Tilt wiring for controller env and monorepo profile paths.
- Add local CAPD RBAC needed by the controller-runtime validation path.

Signed-off-by: Vivin Wilson <vwilson@nvidia.com>
2026-08-18 13:42:39 +00:00