Commit Graph
15 Commits
Author SHA1 Message Date
Abhay Krishna ba862e2f62 test(e2e): move CI and dev defaults to 1.36 (#2132)
Moves CI and local development off Kubernetes 1.34, which reached end
of life on 2026-10-27.

The CAPD node image's kindest/node base, which supplies the kubelet
and kubeadm of every container node, moves from v1.34.8 to v1.36.4.
kubeadm deploys a control plane at most one minor version older than
itself, so every cluster version on that base moves with it: tenant
defaults to 1.36.3, and site clusters and the control-plane roll
target to the base's 1.36.4.

The other 1.34.2 defaults move to 1.36.3: the nico-vms entries, the
sample scripts and Tilt buttons, the nvkectl smoke suite and the kind
smoke lane's site spec. The upgrade test starts at 1.35.3 and upgrades
to 1.36.3, and the no-VIP spec, which took its target from that chain,
asks for the roll target instead. The e2e kubectl image moves to
alpine/k8s 1.36.4. The local development channel keys its release
under "1.36".

Implements part of #2041.

Signed-off-by: Abhay Krishna Arunachalam <abhaykrishna@nvidia.com>
2026-11-05 12:47:55 -07:00
Aaron Patten 55b2a0029a refactor(dev)!: remove the deprecated CWE_* and NKE_CONTROLLER_* setting names (#2114)
* refactor(dev)!: remove the deprecated CWE_* and NKE_CONTROLLER_* setting names

The controller's development, test and build settings read only their
NVKE_CONTROLLER_* names now. The CWE_* and NKE_CONTROLLER_* aliases,
deprecated since v0.23.0, are gone from the Makefiles, Tiltfiles, hack and
CI scripts, the e2e framework and tests, and the docs. So are CWE_IMAGE
(use CONTROLLER_IMAGE), the cwe_image key in tilt_config.json (use
nvke_controller_image), --cwe-api in get-kubeconfig.sh (use
--controller-api) and the cwe-name input of qualify-e2e.yml (use
controller-name). local-backend-e2e.sh reads LOCAL_NVKE_CONTROLLER_IMAGE
instead of LOCAL_CWE_IMAGE.

BREAKING CHANGE: a value set under an old name, in .env, .env.tilt,
tilt_config.json, a shell profile or a repository variable, is now ignored
without a warning. Rename CWE_X and NKE_CONTROLLER_X to NVKE_CONTROLLER_X,
except CWE_API (use NVKE_CONTROLLER_API_URL) and CWE_IMAGE in
make -C cli images (use CONTROLLER_IMAGE). Rename LOCAL_CWE_IMAGE to
LOCAL_NVKE_CONTROLLER_IMAGE and the cwe_image key to nvke_controller_image.
get-kubeconfig.sh rejects --cwe-api (use --controller-api), and
qualify-e2e.yml has no cwe-name input (use controller-name).

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

* ci: fail when a removed controller setting name comes back

make name-check, which the merge gate runs, now also runs
hack/removed-settings-check.py. It fails on any removed CWE_* or
NKE_CONTROLLER_* setting name, LOCAL_CWE_IMAGE, cwe_image, --cwe-api or
cwe-name in a tracked file, so a branch cut before the removal cannot bring
a reader of an old name back. CHANGELOG.md is not scanned, and two
look-alikes that are not controller settings are allowed by file.

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

---------

Signed-off-by: Aaron Patten <apatten@nvidia.com>
2026-11-04 12:29:02 -05:00
Aaron Patten 68c0294c0a refactor(dev): rename the controller's NKE_CONTROLLER_* dev and test settings to NVKE_CONTROLLER_* (#1771)
The NVKE controller's development, test and build settings now use the
NVKE_CONTROLLER_* prefix that AGENTS.md sets for settings that name the
controller. The deployed controller reads none of them.

Where a developer sets a value (Tiltfiles, Makefiles, hack and CI entry
scripts, the e2e, gofail and integration test readers), the old
NKE_CONTROLLER_* name is still read after the new one and before the
existing CWE_* alias. #1399 removes both. Where our own scripts hand a
value to another script, to Tilt or to a test, the writer and the reader
both use only the new name.

Signed-off-by: Aaron Patten <apatten@nvidia.com>
2026-10-21 08:17:38 -07:00
Aaron Patten e19274429e chore(controller): say controller, not CWE, in the settings-rename files (#1653)
Comments, help, log and error text in the files the CWE_* settings rename
owns say "the controller". Every deprecated CWE_* alias statement cites
#1399, which removes them, so `git grep '#1399'` finds every alias site.
No behaviour change.

Signed-off-by: Aaron Patten <apatten@nvidia.com>
2026-10-16 07:58:55 -04:00
Miancheng Lin 3317737e1e refactor(api): rename the OS profile surface to releases (#1612)
* refactor(api): rename the OS profile surface to releases

/osProfiles becomes /releases and nico.osProfile becomes nico.release, so
the REST API uses the release vocabulary the rest of the management plane
already does. Internal db and workflow structs keep their field names.

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

* refactor(controller): rename the OS profile to the release

Nico payloads gain a release key. os_profile is still written alongside
it and still read as a fallback, so a CWE predating the rename keeps
reading and writing the value through a rolling upgrade or a rollback.
No stored data changes. A later release backfills release from
os_profile, then drops the mirror and the fallback.

The os_profile Prometheus label is deliberately unchanged.

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

* docs: follow the OS profile rename

The request YAML in the workload-cluster guides named a field the API no
longer accepts, and two troubleshooting entries quoted error text that no
longer appears. The dashboard panel descriptions in operate/observe.md
keep the old wording: the panels and the os_profile metric label they
read are unchanged.

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

* fix(scripts): read cluster NICo fields from .nico and allow an absent configProfile

The cluster-level orgID, siteID and vpcID live under .nico in the API
response, as the node pool fields already corrected do, so the script
exited before generating anything. configProfile is optional in the same
schema, and requiring it skipped a valid node pool.

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

---------

Signed-off-by: Miancheng Lin <mianchengl@nvidia.com>
2026-10-15 11:56:35 -07:00
Davanum SrinivasandClaude Fable 5.1 7c2d8b3d79 test: rename the suite's own OS profile fixtures to nvke-* (#1475)
The three fixture profiles the suite owns, nke-nico-vms-24.04-amd64-fde,
nke-nico-vms-24.04-arm64-fde and nke-local-dev-kindest-arm64, become
nvke-*, together with the release manifests regenerated from them
(make -C controller fixture-releases, exact under --check), their
entries in the fleet-releases index including the -old-agent variant,
the metadata index, the lane and the two developer scripts that select
them by name, and the tests and documents that spell them.

The fleet release names mirrored from nke-site-deploy, such as
nke-260625-24.04-x86-fde, stay: they are rows users typed and names
existing sites carry (decision D15). The amd64 fixture remains a copy
of the fleet profile nke-nico-vms-24.04-amd64-fde, and its README now
says so by name.

Closes #1474

Signed-off-by: Davanum Srinivas <dsrinivas@nvidia.com>
Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
2026-10-10 18:41:35 -04:00
Davanum SrinivasandClaude Fable 5.1 6029bf16ab chore: say NVKE in the comments and display text that still said NKE (#1470)
* chore: say NVKE in the comments that still said NKE

The word NKE in comments becomes NVKE: Go comments through the token
scanner, so no string literal moves; proto doc comments, with the
generated *.pb.go files regenerated by `make -C agent protos`; and the
comment lines of YAML, shell, Make, Tilt, systemd, Packer, Nix and
template files. The provisioned provider's CRD description comes from a
doc comment, so `make -C cluster-api-provider-provisioned manifests` and
`make -C cli provider-manifest` regenerated the CRD and the CLI's
embedded copy of it.

Kept on purpose: the comment quoting the "NKE Agent Version:" line the
updater parses, and the comments about the NGC organisation that is
named NKE.

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

* chore: say NVKE in the display text that still said NKE

User-facing text that carried the word NKE now says NVKE: nvkectl help
text; log, error and condition messages; Ginkgo suite and spec names;
deb and OCI package metadata; systemd unit descriptions; workflow step
names and input descriptions; Helm render failures; and the nine
Markdown lines the prose sweep (#1462) missed. The tests that assert
these strings move with them.

Kept on purpose, because something parses or persists them: the
"NKE Agent Version:" and "NKE Agent Updater Version:" lines the updater
reads; the "update NKE RBAC:" errors of the UpdateNKERBAC rpc; the 2025
migration text; the OIDC upstream CA's CN and OU, since re-issuing that
CA would break tenant trust; the nico-sim tenant "Forge-Tenant-NKE"; the
Keycloak lab realm; and the NGC organisation that is named NKE.

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

---------

Signed-off-by: Davanum Srinivas <dsrinivas@nvidia.com>
Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
2026-10-10 18:28:35 -04:00
Davanum SrinivasandClaude Fable 5.1 3e8ca2590f refactor: rename the Go identifiers, packages and fixture paths that carried the old product name (#1453)
After the repository rename and the module-path change (#1449) the tree
still carried the old name where it is ours alone: Go identifiers, two
internal package names, import aliases, fixture and test-data
directories, the e2e deploy overlays and a few deploy and hack scripts.
None of these is a wire protocol, a persisted name or a user-typed
value, so they change now, before the repository goes public, without a
migration.

Identifiers change as tokens, through a go/scanner pass, and in comments
only on word boundaries, so every string value stays: NamespaceNVKESystem
is still "nke-system" and the env and json struct tags keep their keys.
Generated files are untouched and regenerate identically. The packages
controller/internal/nkerbac and controller/test/e2e/internal/nke move
with their import paths; the e2e deploy overlays, the nke-deploy.yaml
files, deploy/nke-deploy.sh, deploy/lib/nke-deploy-items.py and the two
hack scripts move with every reference; the twelve management-engine
test-data directories move with the test prefixes that select them.

Kept on purpose: the NKECluster types and their schema tests (the CRD
kind), the UpdateNKERBAC rpc names and their tests (from the proto), the
SubjectNKE release subject, agent/pkg/nkeauth and its record magic, and
every nkectl name, which moves with the binary.

Closes #1452

Signed-off-by: Davanum Srinivas <dsrinivas@nvidia.com>
Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
2026-10-10 16:31:31 -04: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
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
Miancheng Lin b6a25000fa refactor(restapi)!: nest provider fields under nico and infra payload (#246) 2026-09-04 12:28:43 -06:00
Dan BudrisandClaude Opus 5 63790e8540 feat(chart): ship the authentication configuration, and the dev scaffolding (#237)
* feat(chart): ship the authentication configuration, and the dev scaffolding

Packaging for the wiring that landed in the previous commit. Two halves: what
a deployment needs, and what a developer needs to exercise it locally.

The chart gains an `apiAuth` block that mounts a ConfigMap, sets
AUTH_CONFIG_PATH and PERMISSIVE_MODE, and binds the RBAC that lets CWE read
the cluster's own JWKS at /openid/v1/jwks -- that endpoint is not anonymous,
and without the binding the fetch is 403 and an enforcing CWE refuses to
start. The grant is gated on apiAuth.clusterIssuerDiscovery rather than
inferred, because the issuer list lives in a ConfigMap this chart mounts and
never parses. Issuers and audiences are deliberately absent from values.yaml
for the same reason.

apiAuth.enabled defaults to false, so an existing release upgrades with
AUTH_CONFIG_PATH absent and behaves exactly as before. hack/chart-auth-assertions.sh
asserts that in 14 render checks, because `helm lint` proves the chart parses,
not that enabling authentication yields a deployment that can authenticate --
and not that disabling it leaves AUTH_CONFIG_PATH unset rather than empty.

The dev half adds Tilt wiring behind NKE_AUTH_ENABLED, an example auth
ConfigMap, two sample service accounts (one admitted, one not), hack/nke-token.sh,
and credentials to the bootstrap scripts that would otherwise start failing the
moment authentication is on.

chart-auth-assertions.sh resolves the chart relative to itself rather than to a
"repository root" that means two different directories in this layout; CHART
still overrides, which is what the chart workflow sets.

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

* fix(chart): address review on the authentication packaging

nke-auth-demo.sh assigned AUDIENCE a fallback on the line after a `die` that
already guaranteed it was non-empty. Unreachable; removed.

Both scripts read AUTH_CONFIG_PATH and PERMISSIVE_MODE off containers[0]. The Go
side deliberately does not -- SetOIDCEnabled errors rather than guessing, and
the e2e helper picks by name -- because a sidecar can sort first and its
environment is not NKE's. Both now select the container by name, which is also
what makes the demo's mode detection agree with what the specs report.

The demo's metrics parser took $NF as the sample value. An exposition line may
carry a trailing timestamp, in which case $NF is the timestamp. Take the field
after "}", the way test/e2e's sumCounter does.

Comment fixes: the Tiltfile said the config is mounted by
hack/tilt-cwe-chart-values.yaml, which says the opposite and is right -- the
chart mounts it from the apiAuth values the Tiltfile sets. A chart assertion
described itself as "and nothing else", which describes nothing.

The README said a stock cluster already works because Kubernetes ships a
bootstrap binding for system:service-account-issuer-discovery. It ships the
ClusterRole bound to nobody, and the paragraph above already said an enforcing
NKE will not start without the binding. The two contradicted each other.

Not changed: the `required` guard on apiAuth.configMap.name. Review called it
unreachable behind the values.yaml default, but it fires on an explicitly
blanked name, which is the case that would otherwise render a volume with no
name. Verified with helm.

helm lint clean, all 14 chart assertions pass, bash -n on every touched script.

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

* docs(readme): apply the review notes on the local-development section

The three suggestions left on the wiring PR were never applied: "You need no
identity infrastructure" reads better as "You don't need", and the em-dash
clause about what you exercise locally being what ships was a flourish on top of
a sentence that already made its point.

RBAC Prerequisite opened and closed with the same fact. The closing sentence is
merged into the opening one, which now says why the binding is needed rather
than saying it twice.

"the RBAC below" pointed at a section two headings away; it names it.

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

* docs(readme): tighten the local-development and RBAC sections

Same pass. Two "already"s that carried no meaning, "a working example to start
from" saying example twice, and a sentence about the issuer-discovery binding
that put its conclusion in the middle.

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

* refactor(chart): fix the auth mount path and file name in the chart

apiAuth exposed five values where three vary. mountPath and configMap.key were
neither: nothing outside the pod observes either, AUTH_CONFIG_PATH is the two
joined, and an operator writing the ConfigMap the chart tells them to write is
already choosing the key. Their only effect was to give the mount and the path a
way to disagree.

Both are now template helpers with one definition each. What stays is what a
deployment genuinely differs on: enabled, permissive, the ConfigMap name, and
whether to bind the issuer-discovery ClusterRole.

Removing a value is breaking and adding one is not, so this is the moment: the
chart has not shipped, and nothing sets either key today.

The assertion that mountPath and key flow into AUTH_CONFIG_PATH is replaced by
one that the mount and the path still agree on the fixed value, which is the
property that mattered. 15 checks across 6 renders.

configMap.name's comment said "Required when enabled", which reads as an input
an operator must supply; it has a default and is only required in the sense that
explicitly blanking it fails the render. It now says that.

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

* ci(chart): run the apiAuth render assertions

hack/chart-auth-assertions.sh landed here with nothing invoking it; the workflow
step was in the e2e pull request further up the stack. If this merged and that
one stalled, the chart's authentication rendering would be unverified in CI,
which is the gap the script exists to close.

The script arrives with its caller now. The step is unconditional: the chart
renders apiAuth in every state the script asks for, including disabled, so there
is nothing to gate it on.

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

* fix(chart): correct why AUTH_CONFIG_PATH is omitted when disabled

Two comments said an empty AUTH_CONFIG_PATH crash-loops the deployment because
NKE treats a set-but-unreadable path as a startup failure. It does not. The
empty string takes the same branch as unset: auth.Setup returns (nil, nil) and
the process starts with authentication off. Confirmed by calling it.

The template's behaviour was right and the assertion guards the right thing, but
the stated reason was inverted in the direction that matters. It described a loud
failure where the truth is a silent fail-open, so anyone who tested the claim,
found no crash, and concluded the comment was stale could reasonably decide that
always emitting the variable is harmless.

Both now say what actually happens: an empty value renders a deployment that
looks configured and authenticates nobody. That also matches what chart.yml
already said, so the three statements agree rather than contradicting.

Presence, not value, is what carries the meaning, and test/e2e's
detectAuthnEnforcement reads it that way: it returns disabled only when the
variable is absent from the container, so an empty one would report a disabled
deployment as enforcing.

Also moves the apiAuth mount helpers to the end of _helpers.tpl. Inserting them
above serviceAccountName left "Create the name of the service account to use"
reading as documentation for them.

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

* fix(tilt): correct the same AUTH_CONFIG_PATH claim in the Tiltfile

A fourth copy of the crash-loop reason, missed in the previous commit. Same
correction: an empty value is read as unset and disables authentication, so it
fails nothing and renders a deployment that looks configured.

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

* docs: tighten the comments added by this branch

Comments only; no code changed. Three habits ran through them:

They argued for decisions instead of describing behaviour. "Deliberately not
optional", "Gated on X rather than inferred, because...", "Nothing for apiAuth
here on purpose", "TokenRequest, not a long-lived Secret". A reader needs to
know what the line does and, occasionally, what breaks without it -- not the
case for choosing it.

The same three-sentence argument about an empty AUTH_CONFIG_PATH appeared in
five places. It now appears once, in the chart template where the decision is
expressed; the Tiltfile and the assertion script just state the rule.

Several were one long sentence with the point buried mid-clause. The chart
workflow's was five lines with a nested aside, and the JWKS ClusterRoleBinding
led with an assertion about the issuer list before saying what it grants.

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

* fix(tilt): default API authentication off until the suite can authenticate

Both e2e lanes went red on this branch. The Tiltfile defaulted
NKE_AUTH_ENABLED to true, so CI deployed an enforcing NKE, and the suite on this
branch has no credential to present: internal/authtoken arrives with the
authentication specs, one pull request later. Every spec that calls the API got
401.

    "API authentication is enabled","mode":"enforcing"
    "rejected request","reason":"no_token","status":401,"path":"/api/clusters/..."

capd-e2e 3 passed / 4 failed, nico-e2e 0 / 1, and in both cases the four
failures are cluster creation. The health specs passed throughout, which is the
anonymous surface behaving as intended.

The default is off here and flips on with the specs that can authenticate. That
is what this branch can actually back: nothing on it is able to present a token,
so deploying enforcing by default claims a capability it does not have.

Enabling by hand still works and is what hack/nke-auth-demo.sh and
hack/nke-token.sh are for.

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

* docs(readme): document the chart values, the ConfigMap and the token path

The authentication section described the two environment variables NKE reads,
but not the Helm values an operator actually sets. It also never said where the
ConfigMap comes from, or how a script gets a token.

Adds the apiAuth values to Enabling Authentication, the kubectl that creates the
ConfigMap the chart mounts but does not create, and a section on hack/nke-token.sh
for scripts and CI, including the overrides that matter: NKE_AUTH_TOKEN to supply
a token directly, NKE_AUDIENCE to skip discovery.

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

---------

Signed-off-by: dbudris <dbudris@nvidia.com>
Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-25 11:37:27 -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
nhammernik fd95309ade chore: re-sync cwe from gitlab (#136) 2026-08-15 19:32:05 -04:00
nhammernik 7ce92b69ce feat: import cloud-workflow-engine (#7) 2026-08-05 16:25:10 -06:00