Commit Graph
29 Commits
Author SHA1 Message Date
Eric Staples 487f51108f feat(dev): support Ubuntu on WSL2 in host-up (#2155)
The stock WSL2 kernel is built without CONFIG_TCG_VTPM_PROXY, so host-up could not provide /dev/vtpmx and no package supplies tpm_vtpm_proxy for a Microsoft kernel. ensure-vtpm-proxy.sh now builds the module out of tree from the linux-msft-wsl tag matching uname -r, using the running kernel's /proc/config.gz, installs it under /lib/modules and loads it. The build is cached in /var/cache/nvke-wsl-vtpm, and host-up reinstalls the module from the cache after a WSL restart.

Docs gain a WSL2 section, start API Only with capi-core-up so the Cluster API Machine CRD exists, and add the nico-sim console SSH port to the free-port list.

Signed-off-by: Eric Staples <estaples@nvidia.com>
2026-11-10 23:54:33 +00:00
Aaron Patten a037fc56e1 refactor(dev): name the dev kind cluster controller-capi, with trust domain controller-capi.nvke.local (#1700)
make capd-up and tilt up stop with delete instructions when they find the old cwe-capi cluster. The five places that derive the trust domain from the kind cluster name move to .nvke.local together, so Tilt, CI and the e2e harness agree.

Signed-off-by: Aaron Patten <apatten@nvidia.com>
2026-10-16 15:37:55 -04:00
Davanum Srinivas 5e7267a6f5 feat(os-image): build OVN from dsx-ai-factory/ovn-kubernetes v2.4.2 with pod hostPort (#1694)
* feat(os-image): pin OVN to the fork's v2.4.2 and enable pod hostPort

The stream is now the fork's release tag and the lock pins its commit. values-nke.yaml sets global.enablePodHostPort; the agent clears it on container nodes, which run the local gateway.

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

* chore(qualify): qualify the 2.4 OVN stream

The node image carries the fork's 2.4.2 packages after #1694, so the plan takes the highest 2.4 the apt suites serve.

Signed-off-by: Davanum Srinivas <dsrinivas@nvidia.com>
(cherry picked from commit 0384e4a375)

* ci: free disk before the package reproducibility builds

cni-ovn's double build used 7.6 GB of the 13 GB a fresh ubuntu-latest runner had free; a fuller one died with "No space left on device" on pull-request/1694 at 13:23Z 10-16.

Signed-off-by: Davanum Srinivas <dsrinivas@nvidia.com>
(cherry picked from commit 6fc0e7990ab96fa9eb0e91ef6e04a635e5917f17)

---------

Signed-off-by: Davanum Srinivas <dsrinivas@nvidia.com>
2026-10-16 11:42:52 -04:00
nko-cpuandClaude Sonnet 5.5 9f163d42e3 feat(os-image): build the OVN debs from dsx-ai-factory/ovn-kubernetes (#1560)
Build the nvke-cni-ovn charts and images packages from the NVIDIA fork at a
commit the lock pins (release-1.6.0) instead of pulling upstream artifacts,
and make 1.6.0 the default stream.

- bundle.sh fetches the fork tarball with OVN_KUBERNETES_TOKEN (or
  GITHUB_TOKEN), verifies it against the lock, writes values-nke.yaml and
  builds localhost/nvke/ovnkube:<commit12> with docker buildx, nerdctl or
  podman. The lock pins source and tarball sha256; amd64 and arm64 must pin
  the same commit. Base images are pinned by digest and the built archive is
  cached in DIST_DIR.
- The fork's Dockerfile.ubuntu is patched in a copy for three gaps its chart
  hits: the node liveness and readiness scripts are not copied (kubelet killed
  ovnkube-controller every two minutes), firewalld is missing, and the iptables
  wrappers chroot /host, which the chart never mounts.
- nvke-agent uses global.imageRepositoryPrefix and global.gatewayOptions, runs
  OVN in local gateway mode on container nodes (--allow-no-uplink needs it and
  the chart hard-codes shared), and skips value files the chart no longer ships.
- Default stream 1.4.0 -> 1.6.0 across the agent, controller, OpenAPI, protos,
  docs and e2e scripts; the DB migration keeps 1.4.0 for existing rows. The
  nico-vms release fixtures and create-forge-nico-cluster.sh install 1.6.0.
- CI passes OVN_KUBERNETES_RO_TOKEN to the jobs that build cni-ovn. The nico-vms
  diagnostics capture ovnkube container logs and the tenant report.

Signed-off-by: Noah Kontur <nkontur@nvidia.com>
Co-authored-by: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-16 09:11:48 -04:00
John Griffith 7c7c02949e chore: Rename nke to nvnke for images segment of codebase https://github.com/dsx-ai-factory/nvke/issues/1498 (#1548)
* chore: Rename nke to nvnke for images segment of codebase #1498

This is a "brute force" grep/replace approach to the image related
occurences of the nke name.  The goal is basically just a s/nke/nvnke/g
for everything in the repo that is associated with os-images.

This replacement bleeds into some other components (controller and agent)
that includes references to os-image names.

Closes #1498

* Keep existing image names valid

* Chore: Fix/Add DCO

Signed-off-by: jgriffith <jgriffith@nvidia.com>

---------

Signed-off-by: jgriffith <jgriffith@nvidia.com>
2026-10-12 17:08:48 -06:00
Abhay Krishna 8c6e47fc1e feat(controller)!: read settings only from nke-controller-config (#1527)
The controller now takes the 61 settings nke-controller-config carries
from the mounted file only. Each config.Config field that moved trades
its env tag for a controllerconfig tag naming its config.yaml key, and
controllerconfig.LoadStartupConfig fills them at startup from the file
CONTROLLER_CONFIG_PATH names, which is now required. The chart stops
setting the 61 variables, and config.Validate checks only what the
environment still supplies; the file validates the rest when it loads.

With no tracing.endpoint in the file, the controller falls back to the
OTEL_EXPORTER_OTLP_* variables the OpenTelemetry Operator injects, as
it did before. The exporter gets the endpoint as a URL whose scheme
carries the resolved transport, so an injected http:// endpoint cannot
downgrade a secure tracing.endpoint, and an https:// one stays secure.

Host-local runs and the gofail e2e worker start from
hack/local-controller-config.yaml. The e2e helpers that toggled OIDC
and permissive mode on the Deployment now edit nke-controller-config
and restart the controller.

Rolling back across this change needs the chart and the image rolled
back together: an older image under this chart runs on Go defaults for
every setting the chart no longer passes.

Signed-off-by: Abhay Krishna Arunachalam <abhaykrishna@nvidia.com>
2026-10-12 15:17:34 -07: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
Eric Staples 3fe0dffbb4 test(controller): cover control-plane failure domains end to end (#1167)
* test(controller): cover control-plane failure domains end to end

Signed-off-by: Eric Staples <estaples@nvidia.com>

* test(controller): enforce failure-domain E2E coverage

Wire the CAPD spread row to its domain-aware fixture and fail before creation when a CAPD control-plane-controller row advertises no domains. Check observed Machine placement and scale-down balance, and simplify the related test helpers.

Signed-off-by: Eric Staples <estaples@nvidia.com>

* test(controller): satisfy E2E constant lint

Keep the shared CAPI name key because the E2E module goconst rule requires a constant for its repeated uses.

Signed-off-by: Eric Staples <estaples@nvidia.com>

* test(controller): clarify CAPD failure-domain coverage

Document CAPD observed-domain mirroring, make placement diagnostics deterministic, and state the two-domain assumption of the replacement check.

Signed-off-by: Eric Staples <estaples@nvidia.com>

* Refactor common checks

Signed-off-by: Eric Staples <estaples@nvidia.com>

* test(controller): verify CAPD container failure domains

Signed-off-by: Eric Staples <estaples@nvidia.com>

* ci(e2e): pin CAPD and CAPI core to v1.13.6

Use the provider version that publishes Machine failure-domain status and matches the CAPI API dependency compiled into NKE. Update both clusterctl architecture checksums and document the provider contract.

Signed-off-by: Eric Staples <estaples@nvidia.com>

* fix(e2e): share CAPI release and clusterctl verification pins

Signed-off-by: Eric Staples <estaples@nvidia.com>

* test(controller): harden failure-domain fixtures and placement snapshots

Signed-off-by: Eric Staples <estaples@nvidia.com>

* test(controller): advertise failure domains on the no-VIP cp-controller row

initCluster requires every CAPD control-plane-controller row to advertise failure domains; the no-VIP row from #1149 used capdSpec, which advertises none.

Signed-off-by: Eric Staples <estaples@nvidia.com>

* test(e2e): check only balance after control-plane scale-up

KCP's tie-break decides which eligible domain receives the extra Machine
when the control plane scales from one to three, so exact per-domain counts
can flake. Create keeps the exact-count check.

The README drops the controller-managed leg and flag-on wording that #1084
retired.

Signed-off-by: Eric Staples <estaples@nvidia.com>

* docs(e2e): trim the failure-domain README section

Signed-off-by: Eric Staples <estaples@nvidia.com>

---------

Signed-off-by: Eric Staples <estaples@nvidia.com>
2026-10-09 15:37:21 -07:00
Aaron Patten 48f5cab857 chore(controller): say controller, not CWE, in comments and log text (#1393)
Signed-off-by: Aaron Patten <apatten@nvidia.com>
2026-10-09 09:49:33 -06:00
Alexander Greene 92a3039bae feat: default CNI to ovn-kubernetes (#1303)
* feat: default omitted CNI to ovn-kubernetes

Empty cniPlugin and cniName now select ovn-kubernetes, and local images, examples, and create scripts follow that default. calico remains an explicit override.

Signed-off-by: Alex Greene <algreene@nvidia.com>

* fix: build OVN packages outside the gitignored bin directory

crane was installed into the package tree's bin directory, which a checkout sync can delete while the download is still running. Stage the tool in the build scratch directory and create its destination immediately before moving it.

Signed-off-by: Alex Greene <algreene@nvidia.com>

* fix(agent): complete pod checksums on the userspace datapath

veth pods send partial checksums, and the netdev datapath forwarded them unfinished, so receivers dropped pod traffic to services and the node. Enable userspace TSO and restart ovs-vswitchd only when the setting changes.

Signed-off-by: Alex Greene <algreene@nvidia.com>

* fix(tilt): label the local NICo cluster button inputs

The create dialog showed the defaults with no captions because text_input was called without label.

Signed-off-by: Alex Greene <algreene@nvidia.com>

* feat(controller): ensure host vTPM proxy for nico-containers on Linux

Share ensure-vtpm-proxy.sh between Colima and bare Linux hosts, fail fast
from Tilt and nico-sim when /dev/vtpmx is missing, and document the one-time
host prep so remote Tilt targets do not hang waiting for kubeconfig secrets.

Signed-off-by: Alex Greene <algreene@nvidia.com>

* fix: load the vTPM proxy on the kernel that runs Docker

Container nodes need /dev/vtpmx. Without it, swtpm never starts and nke-agent blocks while setting up SPIFFE, so provisioning looks stuck. Colima already loaded the module inside its VM, but a Linux host never did. One script now does that load, and make host-up runs it on either machine.

Signed-off-by: Alex Greene <algreene@nvidia.com>

* fix(agent): keep an explicit OVN version when the plugin name is omitted

Kubeadm init with no plugin name defaults to OVN, but a version sent with that request was discarded and 1.4.0 was installed instead. The requested version is used, and 1.4.0 is applied only when none was given.

Signed-off-by: Alex Greene <algreene@nvidia.com>

* fix(agent): retry userspace TSO after a failed ovs-vswitchd restart

ovs-vswitchd reads userspace-tso-enable only at startup. A failed restart left the setting enabled, so the next attempt treated it as already applied and never restarted the daemon. The previous value is restored on failure so the restart is tried again.

Signed-off-by: Alex Greene <algreene@nvidia.com>

* fix(hack): install the CNI image package selected for a Forge sample cluster

The Forge sample accepts CNI_PLUGIN=calico, but both node pools always installed the OVN image package. The pre-kubeadm commands now install the Calico images for Calico and the OVN images for OVN.

Signed-off-by: Alex Greene <algreene@nvidia.com>

* fix: rebuild CAPD OVN assets when any package is missing

capd-image skipped preparing OVN assets when the charts package was present and newer than the script, even if the images or Helm package was gone. It now rebuilds when any of those packages is missing, and still rebuilds when the prepare script is newer than the charts package.

Signed-off-by: Alex Greene <algreene@nvidia.com>

* fix(hack): fail the nico-vms sample create on HTTP errors

The create request returned success on a 400 or 401 because curl exits 0 unless --fail is set, and --fail hides the body. The response stays visible, and the script now exits from the HTTP status.

Signed-off-by: Alex Greene <algreene@nvidia.com>

* fix(hack): check the vTPM device in the configured Colima profile

The macOS check ran colima ssh without a profile, so a non-default COLIMA_PROFILE could be reported missing or present against the wrong VM. The device checks now use the same profile colima-start.sh prepares.

Signed-off-by: Alex Greene <algreene@nvidia.com>

* fix: default each CAPD OVN package path on its own

Setting CAPD_CNI_CHARTS_DEB_PATH skipped the images and Helm packages, so the node image was built without them. Each path is filled in when it is unset, and each one is checked before the image build.

Signed-off-by: Alex Greene <algreene@nvidia.com>

* fix(agent): run container nodes on the kernel Open vSwitch datapath

Userspace Open vSwitch encapsulates Geneve but has no port that can emit it, so traffic between container nodes is dropped. Container nodes now load the host kernel module and keep the dummy gateway bridge.

Signed-off-by: Alex Greene <algreene@nvidia.com>

* fix: drop the duplicate /lib/modules mount from CAPD nodes

Kind already bind-mounts the host module tree read-only, so listing it again in extraMounts makes Docker reject the node container.

Signed-off-by: Alex Greene <algreene@nvidia.com>

* fix(cli): load the vTPM proxy without sudo when already root

The arm64 bootstrap runner executes the job as root, and its sudoers file rejects sudo from root, so the e2e died after the fake nodes were ready.

Signed-off-by: Alex Greene <algreene@nvidia.com>

* fix: rebuild the CAPD Helm package when the OVN asset script changes

The Helm freshness check compared prepare-ovn-assets.sh with the charts package, so a newer script could leave a stale nke-e2e-helm.deb in place.

Signed-off-by: Alex Greene <algreene@nvidia.com>

* fix(hack): create the sample CAPD cluster through controlPlaneConfig

The local controller rejects control-plane node pools, so the sample script's node pool was rejected before a cluster was stored.

Signed-off-by: Alex Greene <algreene@nvidia.com>

* fix: build the CAPD bundle mirror for the Docker daemon's architecture

The legacy bundle path defaulted to amd64 OVN packages, so an arm64 daemon was served image debs it cannot install.

Signed-off-by: Alex Greene <algreene@nvidia.com>

* fix(agent): reject an unknown CNI plugin instead of installing OVN

The empty-plugin default already lives in the kubeadm init helper. The installer was also rewriting a typo to ovn and mutating the request.

Signed-off-by: Alex Greene <algreene@nvidia.com>

* fix: rebuild the CAPD OVN images package when the asset script changes

The images freshness check compared prepare-ovn-assets.sh with the charts package, so a newer script could leave a stale images deb in place.

Signed-off-by: Alex Greene <algreene@nvidia.com>

* fix(api): waive omitting cniPlugin on cluster create

An omitted plugin selects ovn-kubernetes. Clients built against the published spec were required to send the field, so the compatibility gate needs a named waiver.

Signed-off-by: Alex Greene <algreene@nvidia.com>

* fix(hack): target the configured Colima profile for VM setup

SSH, stop, and the failure hints used Colima's default VM, so a non-default profile never received the vTPM module or the Docker limits.

Signed-off-by: Alex Greene <algreene@nvidia.com>

* docs(agent): note that bare metal also uses the kernel datapath

The container check keys off NKE_OVS_DATAPATH_TYPE. An unset variable keeps bare metal and VM nodes off the dummy-bridge path even though they run the kernel datapath.

Signed-off-by: Alex Greene <algreene@nvidia.com>

---------

Signed-off-by: Alex Greene <algreene@nvidia.com>
2026-10-08 16:45:49 -04:00
Miancheng Lin 0f709ef431 feat(controller): resolve OS profiles from the releases and provide them locally (#1165)
* feat(controller): resolve OS profiles from the releases

CWE reads OS images and first-boot templates from ClusterRelease,
NodePoolRelease and MachineImage resources instead of the files under
PROFILES_DIR. The osProfile names clusters and node pools already store are
release names, so persisted selections keep resolving.

Provisioning and the Kubernetes upgrade both resolve a release by the node's
role through the new internal/machinerelease package: a control-plane node from
a ClusterRelease, a worker from a NodePoolRelease, with no fallback between
them. The upgrade preserves the current image's architecture, variant and
Ubuntu version and never selects a deprecated target. GET /osProfiles keeps its
contract and lists the non-deprecated ClusterRelease names.

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

* feat(controller): apply the releases in every way CWE runs locally

CWE resolves every OS image from the release resources, so each way of running
it outside a fleet now installs the CRDs and applies the releases: Tilt, `make
run-local`, the gofail e2e framework, the nke-sbom deploy, and the nico-vms and
backend CI lanes. Each reads them from a releases directory, defaulting to the
committed fixtures under test/fixtures/releases. The two Tilt resources are
named machine-engine-crds and machine-engine-releases, after the resources they
install rather than after their consumer.

capnico-create-instance.sh takes the iPXE template from the NodePoolRelease's
MachineImage, under NODEPOOL_RELEASE rather than OS_PROFILE. The OS profile
matrix test lists NodePoolReleases, replacing the fleet-profiles mirror with
test/fixtures/fleet-releases. controller/AGENTS.md, controller/README.md and
the nke-sbom README say where OS images come from now.

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

---------

Signed-off-by: Miancheng Lin <mianchengl@nvidia.com>
2026-10-08 13:06:31 -07:00
Aaron Patten 03cba1060d feat(dev): run Tilt and the e2e deploy paths with the nke-controller greenfield profile (#1271)
* feat(dev): run Tilt and the e2e deploy paths with the nke-controller greenfield profile

Tilt and the capd-e2e, capnico-e2e and nke-sbom deploy paths install the
controller the way a greenfield site does: release, namespace, Deployment,
Service and ServiceAccount nke-controller; SPIFFE ID
/nke-service/nke-controller; Temporal namespace nke-controller and queue
nke-controller-tasks; database nke-controller; and the field-manager,
managed-by and Teleport label/prefix values in nke-controller form.
backend-e2e.sh no longer branches on Tilt versus deploy path.

The e2e harness package internal/cwe is now internal/controller and
defaults to nke-controller. The CWE_* settings the dev loop, CI scripts
and e2e suite read are renamed NKE_CONTROLLER_*; the old names are still
read for one release, including when the new name is set but empty.
hack/nke-token.sh and hack/nke-auth-demo.sh find the controller in
nke-controller, then cloud-workflow-engine, as nkectl does.
The Tilt values file, Dockerfile, kind config and CAPD RBAC manifest are
renamed to say controller. The host-debug .env.local.example and README
example point at the nke-controller database, Temporal namespace and
queue, and the NKTP kind-validation doc queries the controller's metrics,
logs and traces under nke-controller.

Tilt stops with a recreate-the-cluster message on a cluster that still
runs the old release cwe in cloud-workflow-engine. The kind cluster name
cwe-capi and the nico-vms bridge cwebr0 are unchanged; renaming them would
force every developer to recreate their cluster or leave a stale bridge.

Chart defaults are unchanged, so existing sites keep their names.
The nke-sbom path now installs on a fresh cluster only, and its README
says so: nothing migrates an install from an earlier revision.

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

* fix(dev): name the controller's local SPIFFE ID and auth doc examples nke-controller

scripts/dev-env-spire.sh registers the host-run controller under the
ServiceAccount the cluster runs it as: nke-controller when that
ServiceAccount exists in namespace nke-controller, else
cloud-workflow-engine. The kubectl examples in
docs/authenticating-to-the-api.md use Tilt's names and say what to use on a
site that still runs the old name.

The comments at the cwe-capi and cwebr0 defaults describe the deferred
rename without an internal tracker reference, which docs-check rejects.

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

---------

Signed-off-by: Aaron Patten <apatten@nvidia.com>
2026-10-08 16:58:11 +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
Davanum Srinivas 3b0cd6111d fix(e2e): put the Tilt lanes' management cluster behind the Docker Hub mirror (#1220)
* fix(e2e): pull the Kind node image through the Docker Hub mirror

The management Kind cluster's node image is pulled by the host daemon,
which has no registry mirror on the ARC runners. After #1208, #1215 and
#1218 this was the last anonymous docker.io pull in every CAPI lane, in
local-entrypoint-e2e and in nktp-e2e: one per leg, every run.

When NKE_E2E_DOCKERHUB_MIRROR is set, copy the kind config with its
`image:` lines rewritten to `<mirror>/kindest/node:...` and create the
cluster from the copy. The digest is unchanged, so the pin in
cwe-capi-kind.yaml still holds, and the containerd mirror written into
the nodes afterwards is unaffected. nktp-e2e now sets the same mirror as
the other lanes.

Checked on bigbox with the pinned kind v0.32.0: kind logged `Pulling
image: mirror.gcr.io/kindest/node:v1.37.0@sha256:a1ed56...`, the control
plane was Ready after 18 s, and the image ID matched the docker.io pull.

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

* fix(e2e): put the Tilt lanes' management cluster behind the Docker Hub mirror

nico-vms-e2e builds its images through the mirror but creates its
management cluster with `make capi-core-up`, a plain `kind create
cluster`. The node's containerd had no mirror, so temporal, postgres,
alpine, busybox, curl and the local-path helper were all anonymous Docker
Hub pulls; helm fetched the Bitnami chart from registry-1.docker.io
because the lane never installed the shim; and `make registry-mirror`
pulled registry:2 from Docker Hub on the host. About ten anonymous
manifest pulls per leg per run, invisible in the job log.

Move configure_kind_dockerhub_mirror into backend-e2e-lib.sh, replacing
the copies in backend-e2e.sh and local-backend-e2e.sh, and call it in
nico-vms-e2e.sh between `make kind-up` and `make capi-core-up`, so
nothing the latter starts pulls from Docker Hub directly. Pass a
mirror-rewritten kind config to `make kind-up` there and in
local-backend-e2e.sh, which covers the node image for local-entrypoint-e2e
too. `make registry-mirror` takes REGISTRY_MIRROR_IMAGE, default
registry:2; nico-vms-e2e.sh points it at the mirror. The workflow installs
the same helm shim local-entrypoint-e2e.yml does.

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

---------

Signed-off-by: Davanum Srinivas <dsrinivas@nvidia.com>
2026-10-03 13:45:30 -04: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
vwilson-nvidia 340009f1e1 test(controller): add DSX IMDS Tilt integration (#997)
- add an optional DSX IMDS fixture using the real SPIRE plugins
- build the agent plugin into local nodes and emulate NICo host identity
- exercise TLS/JWT exchange and optional external mTLS with local certificates
- install the mock exchange CA only for the enabled local test path
- install packaged CNI manifests after kubeadm init in local node images

Signed-off-by: Vivin Wilson <vwilson@nvidia.com>
2026-09-28 17:48:54 -06:00
Davanum Srinivas efaefadb06 fix: let curl back off when a download 504s (#928)
Three jobs failed today on three different URLs with the same cause:
github.com and raw.githubusercontent.com answered the NVIDIA runners with
HTTP 504 for minutes at a time. Every one of those downloads gave up in
under 30 seconds.

--retry-delay replaces curl's exponential backoff with a flat wait, so
--retry 5 --retry-delay 2 retries five times inside ten seconds and calls
the host down. install-k8s-community.sh already found this and wrote it
down; the fix never reached the other eleven call sites.

Drop --retry-delay and raise the count to 8, which is a window of about
four minutes. --retry-max-time bounds it where a single attempt is quick.
The two package bundlers do not take it: it runs from the first attempt,
so on a fetch whose one attempt can take minutes it would cut retries
rather than add them.

Signed-off-by: Davanum Srinivas <dsrinivas@nvidia.com>
2026-09-21 11:41:45 -04:00
Davanum Srinivas fb0665912b fix(dev): give the CAPI rollout wait 300s (#760)
capd-up waited 120s for the CAPI and CAPD controllers. Those pods mount a
secret cert-manager issues, and cert-manager pulls from quay.io with no
mirror in front of it. On 2026-09-15 that pull hit ImagePullBackOff, the
certificates were issued 20s before the deadline, and Local entrypoint E2E
failed on a cluster that was already recovering. A healthy rollout takes 4
seconds, so the extra budget costs nothing.

Signed-off-by: Davanum Srinivas <dsrinivas@nvidia.com>
2026-09-16 06:51:06 -04:00
Ryan Bever 5af7334722 refactor: remove obsolete Forge integration remnants (#603)
Signed-off-by: Ryan Bever <rbever@nvidia.com>
2026-09-10 18:15:16 +00:00
Davanum Srinivas 8ed83494a4 fix(devx): make a local CWE run work without four undocumented workarounds (#527)
* fix(config): point PROFILES_DIR at profiles that exist

The default was ./profiles, which holds example/, README.md, Dockerfile
and runbooks/ -- no osProfiles/metadata.yaml. Every local run died in the
database migration:

  failed to read metadata file: open profiles/osProfiles/metadata.yaml

The profiles this repository ships are one level down. Deployments set
PROFILES_DIR explicitly through the chart, so only a bare local run reads
this default.

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

* fix(config): accept the dev-default database credentials in the test Forge environment

Validate rejects a DB_CONNECTION_STRING containing postgres:postgres@
unless CNPG_SUPERUSER_PASSWORD is also set. That is right for a
deployment, but the rejected string is the compiled-in default, so
'make run' on a laptop failed on config load:

  DB_CONNECTION_STRING uses weak dev-default credentials: set CNPG_SUPERUSER_PASSWORD

.env.local.example does not set the password either, so the file the
documentation points at did not help. FORGE_ENVIRONMENT=test already means
a local run that signs its own JWT instead of authenticating against NGC;
the check now skips that environment and holds everywhere else.

Adds the test the check never had, covering both environments.

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

* fix(devx): run-local without an NGC key, and find the temporal CLI where its installer puts it

Three things blocked 'FORGE_ENVIRONMENT=test make run-local':

validate_api_key demanded FWE_API_KEY unconditionally, but the test Forge
environment signs its own JWT and needs no key.

get_temporal_cmd and check_temporal_available only looked on PATH and in
flox. temporal.download/cli.sh installs to ~/.temporalio/bin and does not
touch PATH, so a non-interactive shell saw 'temporal: command not found'
with the binary sitting installed.

The missing-temporal message named only flox. It now gives the three ways
to install it.

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

* fix(devx): do not require Teleport for a local run

dev-check is a prerequisite of dev-start-local, and it exited 1 when tsh
was missing. Only 'make run-remote' reaches a cluster through Teleport, so
a local-only developer had to install it to get past the check. It is a
warning now.

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

* fix(config): gate the weak-credential check on the database, not on Forge

Review pushed back on keying this on FORGE_ENVIRONMENT, and rightly:
that variable selects a Forge backend and says nothing about which
database DB_CONNECTION_STRING names. An operator could set it on a
deployment reaching a real database and stand the guard down.

The risk is a property of the database, so the check now asks about the
database: dev-default credentials are refused unless the host is loopback.
A laptop's container passes, an in-cluster or remote Postgres does not,
whatever FORGE_ENVIRONMENT says. A test pins that.

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

* fix(devx): set the local profiles in run-local, not in the shipped default

The earlier commit pointed PROFILES_DIR's compiled-in default at
profiles/example/profiles. Review found that wrong twice over: the example
tree is full of REPLACE_ placeholders and its own README says the
controller does not load it, and runbooks/ sits beside profiles/ rather
than inside it, so EffectiveRunbooksDir would look in a directory that
does not exist.

A shipped default should not name developer data at all. The default goes
back to ./profiles, and run-local -- a developer-only target -- points at
test/fixtures/profiles, which the Tiltfile already calls the in-repo
fixture, with its sibling runbooks tree. Both stay overridable.

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

---------

Signed-off-by: Davanum Srinivas <dsrinivas@nvidia.com>
2026-09-06 14:22:54 -04:00
Jonathan Meier 24950e7627 feat(nkectl): initialize CAPI during CWE deployment (#427)
* feat(nkectl): initialize CAPI during CWE deployment

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

* fix(nkectl): inject the CAPI version at build time

Use make/tool-versions.mk as the single CAPI version source and pass it to nkectl with linker flags. Also record google/uuid as the direct CLI test dependency introduced on main so the workspace check is current.

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

---------

Signed-off-by: Jonathan Meier <jomeier@nvidia.com>
2026-09-01 11:34:58 -07:00
Davanum Srinivas 342e63c282 feat(controller): install cluster CNI after kubeadm init, behind a flag (#394)
* feat(controller): install cluster CNI after kubeadm init, behind a flag

The in-init CNI install resolves its manifests through a bundle server. Every
documented way to prepare a host leaves the agent with no bundle index, so on
those hosts that path cannot succeed.

Add an InstallCNI activity that runs after kubeadm init and reads manifests
from a Debian package already on the node. It needs no bundle configuration.

Off by default behind INSTALL_CNI_AFTER_INIT. InstallCNI needs the
nke-cni-<variant>-charts package, which the CAPD node image installs and Forge
user-data installs as of #398.

Both CNI plugins take this path. postInitCNIVariant maps the plugin to the
variant the agent expects and reports false for anything else, so one switch
answers both "is this supported" and "which variant" and the two cannot drift.
An unknown plugin refuses rather than defaulting. OVN needs the agent to install
its chart with `helm upgrade --install`, which #396 landed; before that it could
not survive the retry this activity depends on.

CNIInstallMode resolves the choice once, before kubeadm, and the workflow passes
it to both activities so a config rollout cannot make them disagree. The whole
block is behind workflow.GetVersion so executions started before this change
replay unchanged.

Permanent gRPC failures are non-retryable: this activity retries forever, so an
agent without the RPC or a missing charts package would otherwise hang the
cluster in provisioning.

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

* test(controller): run the local CAPD lane with no bundle source

With INSTALL_CNI_AFTER_INIT=true the local E2E entrypoint starts no bundle
mirror, capd-image stops defaulting BUNDLE_SERVER_URL to the mirror address,
and the run asserts the node image carries no bundle flags before proceeding.

A green run that way proves a node with no bundle source can still get CNI,
which is the claim the InstallCNI path makes.

Default unchanged.

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

* ci: cover both CNI install paths in the local entrypoint lane

The lane ran only with INSTALL_CNI_AFTER_INIT unset, so nothing in CI reached
the post-init CNI path. Run it both ways.

Also filter on controller/Tiltfile: the lane deploys CWE through Tilt, so a
change there changes what it runs.

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

---------

Signed-off-by: Davanum Srinivas <dsrinivas@nvidia.com>
2026-09-01 09:40:15 -04:00
Davanum Srinivas 0d00d6ea11 fix(capd): stop defaulting the node image to the CloudFront bundle server (#389)
* fix(capd): stop defaulting the node image to the CloudFront bundle server

The node image defaulted BUNDLE_SERVER_URL and INDEX_FILE_URL to
d3mq564cn7sth7.cloudfront.net and baked both into AGENT_ARGS, so every tenant
node carried that address for its whole life. The CI runners cannot reach it,
which made the default the one setting that could never work there: the agent
failed to fetch Calico, no CNI was installed, and clusters timed out.

Both are empty now, and the agent flags are only emitted when a server is
configured, the same way the SPIFFE flag already worked. An unset bundle
server is a supported state: agent.go documents it as InstallBundle being
unavailable, and a nico VM already runs that way.

NODE_AGENT_BASE_URL and SPIRE_BUNDLES_BASE_URL lose their CDN defaults too.
Each is now required by the path that uses it, which fails with the flag to
set or the source to use instead, rather than silently reaching a host the
caller cannot get to.

Callers that need a bundle server set one. Both E2E entrypoints already do,
pointing at the mirror they build from public sources. Two callers never did
and inherited the CDN: cli/Makefile's ensure-capd-image and Makefile.dev's
capd-image, so a plain `make capd-up` baked it in as well.

Verified by building the image both ways:
  unset  -> AGENT_ARGS="--disable-mlx5-rescan --secure-server-port 15005"
  set    -> ... --bundle-server-url http://172.18.0.9/ --index-file-url
            http://172.18.0.9/nke_bundles/Ubuntu_24.04/index.json
and by grepping the built image: no CDN string under /etc or /usr/local/bin.

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

* ci(e2e): run the local entrypoint lane on node image changes

The entrypoint builds the CAPD node image through `make capd-up`, so a change
under capd-kindest-node/ affects this lane, but its paths filter did not list
that directory. The commit before this one changes exactly those files and
would not have run the lane that exercises them.

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

* fix(capd): give `make capd-up` a bundle source of its own

Review caught that emptying the node image default broke the manual path.
capd-image passed seven variables to build-image.sh and none was
BUNDLE_SERVER_URL, so it had relied on the deleted ARG default. The agent
installs Calico through FetchBundleFromIndex, and NoCniInstall is set only by
the kubeadm bringup test, so a node built that way would have failed CNI with
an empty URL. The E2E entrypoints export a mirror and were never affected.

A new bundle-mirror target builds the bundle from public sources and serves
it on the kind network beside the registry caches, and capd-image depends on
it and falls back to its address. A caller that exports its own URLs still
wins, which is what both E2E entrypoints do.

The Dockerfile now gates each agent flag on its own variable. An index-only
build was being dropped: build-image.sh keeps a caller-supplied
INDEX_FILE_URL when the bundle server is empty and passes it as a build arg,
and the agent lets --index-file-url win outright.

Two comments that this branch made wrong: backend-e2e-lib.sh said the mirror
saved a run from a CDN default that no longer exists, and cli/Makefile said
its job used a public bundle host, which it no longer does.

Verified by running the targets: the build failure now propagates rather than
serving an empty directory, the mirror answers /index.json, and capd-image
produces
  --bundle-server-url http://172.18.0.6/ --index-file-url http://172.18.0.6/index.json
The first attempt derived nke_bundles/Ubuntu_24.04/index.json, which 404s
against this layout, so the index is set explicitly.

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

* fix(capd): pass the whole env to build-image.sh, and share the mirror helper

Review caught that the `&&` before the environment prefix made the seven
existing assignments a bare assignment list, so they became shell variables
and never reached build-image.sh. Only the two after the `&&` did. That put
CAPD_NODE_AGENT_LOCAL_BUILD back to auto and dropped COLIMA_DOCKER_HOST,
which matters on a Colima host. The mirror address is now computed before the
prefix, so the list is unbroken.

My own check had missed it: I passed those variables on the make command
line, and make exports command-line variables to a recipe on its own, which
hid the broken prefix. This one runs `make capd-image` with nothing on the
command line.

bundle-mirror now calls e2e_start_bundle_mirror from backend-e2e-lib.sh
instead of running its own docker. That copies into a named volume rather
than bind mounting the working tree, because the daemon that resolves a bind
path is not always this host, and it drops the always-restart policy that
would have outlived the cluster. kind-down removes the mirror and its volume.

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

* ci(e2e): run the local entrypoint lane on the inputs it actually uses

The lane did not run on the previous head. GitHub matches paths against the
push, not the pull request's cumulative diff, and that push touched only
controller/Makefile.dev, which the filter did not list.

capd-image and bundle-mirror live in Makefile.dev, the mirror runs
prepare-capd-bundles.sh, and kind-up brings the management cluster up from
cwe-capi-kind.yaml. All three decide what this lane runs, and none was listed.
PR 390 changes that kind config and did not run this lane either.

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

---------

Signed-off-by: Davanum Srinivas <dsrinivas@nvidia.com>
2026-08-29 20:22:33 -04:00
Aaron Patten 0d0d42396a feat(controller): TenantAccess-only kubeconfig publish (#188)
* feat(controller): TenantAccess-only kubeconfig publish
Make TenantAccess the only kubeconfig writer and always publish
nke-system/<name>-kubeconfig. CAPI objects stay in cluster-<name>
until the object-move follow-up.

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

* fix(controller): render nke-rbac without Argo prune
Keep the ConfigMap when the live OIDC flag is off by rendering it
whenever spiffe.trustDomain is set, and restore Namespace apply on
machine create.

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

* fix(controller): satisfy testifylint on nke-rbac chart test

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

* chore(controller): relicense new files to Apache-2.0

main normalised SPDX headers to Apache-2.0 and asserts it (a3c86861). The
rebase reconciled every pre-existing file, but the files this branch adds
still carried LicenseRef-NvidiaProprietary from before the OSS cutover.

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

* fix(controller): pin kind node image and enable ImageVolume

The capi-spiffe-exec-auth overlay mounts the SPIRE exec-auth plugin as an
OCI image volume. ImageVolume is beta but off by default through k8s 1.34,
and the management cluster inherited whatever the local kind binary
defaulted to (1.36 on kind v0.32, which NKE does not support yet). Pin
kindest/node:v1.34.8 -- the KINDEST_NODE_TAG the CAPD workload image
already uses, shipping containerd 2.3.1 -- and enable the gate explicitly.
The same config drives hack/ci/capd-e2e.sh, so dev and CI now match.

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

* refactor(controller): publish from Controller, drop Publisher type

Publisher had no consumer outside the package: it moved tenantClientFor off
Controller only to recreate the same seam, relocated the live re-read guard
out of upsertSecret (losing its rationale comment), and added an Upsert
override whose safety rested on a comment.

Also collapses a double re-read: EnsurePublished refreshed the cluster and
then guardedUpsert refreshed it again per Secret, so SPIRE mode issued three
GetCluster calls per cluster per pass. publish() now reads once and passes
the live row down.

Behavior is unchanged: mode still follows the live persisted
OIDCAuthEnabled, Secrets still carry ownership labels and ClusterSecretType,
and a missing nke-rbac ConfigMap still fails closed.

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

* refactor(controller): single ownership guard on teardown delete

capi.ValidateSecretOwnership deliberately permits missing labels for the
publish-side adopt path, and the following check rejected exactly that case,
so the two guards reduced to one equality test. Collapse them and document
why the guard exists: the cluster row is already gone, so the label is the
only ownership evidence, and nke-system also holds CAPI-written
<name>-kubeconfig Secrets.

Teardown wants strict matching where adopt wants permissive, so it no longer
shares the helper.

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

* test(controller): rename teleport_defaults_test to cluster_defaults_test

Only 2 of 8 tests in the file are Teleport-specific; the rest cover cluster
and node pool defaults and API conversion. Also marks the OIDCAuthEnabled
subtest as characterization of pre-existing applyClusterDefaults behavior,
which this branch depends on but does not change.

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

* perf(controller): check published kubeconfig past the client cache

consumePublishedKubeconfig ran before clientFromSecretVersion, so
clientcmd.Load plus the AuthInfo scan executed on every ClientForDBCluster
call including cache hits -- and nodehealth calls it per cluster per pass.
Move it inside, past the cache-hit return: a rewritten Secret gets a new
resourceVersion, so every content change is still checked.

Also corrects the LabelKeyKubeconfigMode comment, which claimed
publish/consume/delete refuse on mode mismatch. None of them do: the label
is rewritten in place when EnableOIDC flips a cluster.

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

* fix(controller): re-read the cluster row before each Secret write

Collapsing the per-write re-read into a single refresh per publish reopened
the race that guard existed to close. publishSPIRE applies RBAC into the
tenant cluster between the refresh and the writes, bounded by
tenantRequestTimeout, so a cluster that starts deleting during the apply had
its Secrets re-created after teardown removed them -- orphaned for good once
the row is gone.

publish() keeps one refresh to select the mode; upsertSecret re-reads again
immediately before each write, as main does. Found by Codex review.

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

* fix(controller): key the tenant client cache on credential mode

The cache key came entirely from the Secret, but the expected credential mode
comes from the DB row, so they are independent inputs. A cluster that flipped
to OIDC before TenantAccess rewrote its Secret kept the same resourceVersion,
hit the cache, and got back the admin.conf client built before the flip --
never running consumePublishedKubeconfig, and silently continuing to use the
credential OIDC retires.

Including the mode in the key makes the flip a cache miss, so the check runs
and fails closed. Found by Codex review.

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

* fix(license): use Apache-2.0 for CAPI patches

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

* fix(controller): preserve legacy CAPI workflow replay

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

* test(controller): drop obsolete tenant access manager test

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

* fix(controller): address tenant access review feedback

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

---------

Signed-off-by: Aaron Patten <apatten@nvidia.com>
2026-08-20 10:47:53 -06:00
Davanum Srinivas 20c0d90be6 feat: build from public upstream artifacts, and fix local bring-up on a bare box (#216)
* feat: default artifact downloads to public upstream sources

The node image build and the node agent both fetched artifacts from an
internal bundle server. That server answers NVIDIA networks and returns
403 to everyone else, so neither the image build nor a tenant node's CNI
install works from outside. The artifacts themselves are not internal:
the published SPIRE bundle carries the upstream spire-agent and
tpm_attestor_agent binaries unmodified, byte for byte.

Default to the upstream public releases and let downstream point back at
the internal server:

- build-image.sh assembles the SPIRE agent bundle from the spiffe/spire
  and spiffe/spire-tpm-plugin releases. Set SPIRE_AGENT_SOURCE=bundle to
  download the pre-assembled internal bundle instead.
- install.sh and spire-agent.service move into the repository, since the
  bundle was the only place they existed.
- The TPM plugin checksum is computed from the binary that was fetched,
  so a version bump cannot leave a stale value behind.

Resolve bundles by their conventional URL first and fall back to the
index. The index only maps a name, version and architecture to a path
that already follows a fixed convention, so requiring it lets an
unreachable index block an artifact that is reachable. A bundle server
that serves artifacts but refuses index.json failed every CNI install
with 'unable to fetch index'.

Retry artifact downloads with backoff, in the build script and in the
agent. Nodes fetch these seconds after their network comes up.

Do not use curl --remove-on-error. It needs curl 7.83.0 and Ubuntu 22.04
ships 7.81.0, where the whole command fails with 'option
--remove-on-error: is unknown'. The surrounding code already removes the
partial file.

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

* fix: reuse the in-repo bundle assets, and clear three papercuts

Reuse rather than duplicate. hack/ci/assets already carries
spire-agent-install.sh and spire-agent.service, and
hack/ci/prepare-capd-bundles.sh already assembles bundles from the
upstream public releases with checksum verification. The previous commit
added a second copy of the two assets; drop them and point the node
image build at the existing ones.

Also:

- Makefile.dev no longer passes curl --remove-on-error when downloading
  clusterctl. That option needs curl 7.83.0 and Ubuntu 22.04 ships
  7.81.0, where the whole command fails with 'option --remove-on-error:
  is unknown' and clusterctl cannot be installed at all. The failure
  branch already removes the partial file. Retry the download too.

- The root Makefile gains a test target. It built every module and
  tested none, which invites the assumption that make test at the root
  does what make test in a module does. Each module keeps its own
  exclusions, so defer to its Makefile when it has one.

- cmd_version strips whichever tag prefix git describe returns, not only
  the module's own. With no tags of their own, capd-reboot-controller
  and nico-mock fell through to git describe --always, picked up the
  nearest agent tag, and reported 'agent/v...' as their version.
  version-check could not catch it because the value looked plausible.

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

* fix: clear five more local-development papercuts

PC-8: docs/getting-started.md offered one way to run CWE and it needed an
NGC key. FORGE_ENVIRONMENT=test skips NGC auth and was documented
nowhere.

PC-4: the Tiltfile defaulted the profiles tree to the nke-site-deploy
sibling, so a plain tilt up failed for anyone without that checkout even
though controller/test/fixtures/profiles ships here and CI already uses
it. Default to the in-repo fixture and name both options when it is
missing.

PC-3: integration-test/ had no build tag, so a plain go test ./... picked
it up and failed on a connection refused to localhost:8080. make test
avoided it with grep -v './integration-test', which matched by accident:
. is a regex wildcard, not a path prefix. Tag the package and drop the
grep.

PC-7: with SPIFFE off the trust domain is empty, and CAPI node
provisioning formats spiffe://<trustDomain>/... from it. The malformed
ID fails after the infra machine is applied and before the CAPI Machine
is, so the symptom is infra machines with no Machines, retrying forever.
Refuse at startup when CAPI is enabled. SPIFFE off stays valid without
CAPI.

PC-10: a Temporal restart lasting seconds was enough to exit at startup,
and CrashLoopBackOff then held CWE down for minutes. Retry for a minute
first.

PC-6: nothing is scheduled for an unregistered site and the workflow
waits rather than failing, so a missing site is indistinguishable from
slow provisioning. The e2e assumed the nil-UUID site but never created
it. It now registers what it asks for, and the wait activity fails with
a non-retryable error naming the site.

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

* fix: satisfy CI for the build-tag and retry changes

Three CI failures from the previous commits.

The integration-test compile job ran `go vet ./integration-test/...`,
which now matches no packages because the package sits behind the
`integration_test` build tag, and vet exits non-zero when nothing
matches. Pass the tag.

revive flagged the retry loop in the Temporal namespace registration:
the if block ends in a return, so the else is redundant. Assign first,
then return early.

goconst flagged `ovn` and `calico` in the agent. Both name CNI
plugins on InstallCNIPluginRequest and appeared as literals in three
switch statements and two bundle lookups. Name them, next to the
existing CNI stream constants.

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

---------

Signed-off-by: Davanum Srinivas <dsrinivas@nvidia.com>
2026-08-20 11:44:22 -04: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
nhammernik fd95309ade chore: re-sync cwe from gitlab (#136) 2026-08-15 19:32:05 -04:00
jgriffith 18e42b26e6 Rename node-agent to agent.
Drop the redundant "node-" prefix so the module path is
github.com/NVIDIA/nke/agent rather than stuttering as nke/nke-agent.
Controller still consumes the published gitlab node-agent module until a
follow-up cutover.
2026-08-10 08:33:04 -06:00
nhammernik 7ce92b69ce feat: import cloud-workflow-engine (#7) 2026-08-05 16:25:10 -06:00