58 Commits
Author SHA1 Message Date
Davanum Srinivas f91b3e1b24 feat(agent): add a control plane endpoint health gate (#2514)
* feat(agent): add a control plane endpoint health gate

The agent can take a control plane node out of the cluster endpoint
before an operation, but only when the node runs kube-vip. A node behind
a load balancer that it does not run has no kube-vip, so the withdrawal
did nothing there. Connections through the load balancer stayed on the
node while its API server or its etcd restarted, and worker kubelets on
those connections went NotReady.

Add a second way to withdraw a node, a health gate. The gate is a file,
and the health check of the load balancer has to fail while the file
exists. NodeAgentServer.ControlPlaneEndpointGate configures it. The zero
value means no gate, and the agent then behaves as before. No flag sets
the field yet.

withdrawKubeVipLocked closes the gate first. It reads the IPv4 address
of the backend interface, writes the gate file, waits the settle time,
closes the established sockets of remote clients on that address and
port 6443 with the existing ss -K code, and runs the existing quiet
window check on that address. A failed check fails the withdrawal.

restoreKubeVipLocked opens the gate after kube-vip is back. So
StartKubeVipRestore opens the gate, and the etcd defragmentation gets
the gate through the two calls that it already makes. A node with
kube-vip and a gate leaves both, and returns to both.

The gate file names the park directory of the flow that closed it. The
directory decides who opens the gate, as it decides who restores a
parked manifest. A caller's restore opens each gate. The etcd
defragmentation opens only a gate that it closed, and it leaves a gate
that a caller closed as it is.

The backend interface must have one global IPv4 address. IPv6 is not
handled, as for kube-vip.

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

* feat(agent): open or hand off a gate that an etcd defrag left closed

The etcd defragmentation closes the control plane endpoint gate and
opens it in the same call. Two cases left the gate closed with nobody to
open it.

The agent can stop in the middle of a defragmentation. The repair of
stale state at startup now opens a gate that names the park directory of
the defragmentation, after it has put the parked manifests back. A gate
that a caller closed names another directory and stays closed.

The defragmentation can leave the node out of service on purpose, when
etcd does not come back healthy. It then hands the parked manifests to
the caller. It now hands the gate over with them, so the next start of
the agent does not open the gate, and StartKubeVipRestore does.

The tests of the defragmentation with a gate are in this commit, because
one of their cases is the hand-off.

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

* feat(agent): add the control plane endpoint gate flags

Three flags configure the control plane endpoint gate:

  --control-plane-endpoint-gate-file          path of the gate file
  --control-plane-endpoint-backend-interface  interface on which the
                                              connections of the load
                                              balancer arrive
  --control-plane-endpoint-gate-settle        settle time, default 10s

With no gate file the agent has no gate. The agent does not start with a
gate file and no backend interface, with a backend interface and no gate
file, with a relative gate file path, or with a negative settle time.

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

* docs(agent): describe the control plane endpoint gate

The agent README lists the three flags, and says what the deployment has
to provide and who opens a closed gate.

Two pages were wrong with the gate. The agent design page said that the
graceful shutdown and StartKubeVipRestore handle only kube-vip. The
certificate renewal page said that a node without kube-vip skips the
drain.

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

* feat(agent): close the control plane endpoint gate around kubeadm upgrade apply

KubeadmUpgradeApply runs kubeadm upgrade apply, which restarts etcd and
the API server of the node. The control plane endpoint gate did not
cover this call. The load balancer took the node out only after its
health check had failed, and in that time it still sent calls to an API
server that could not answer them.

With a gate, the call now takes the node out of the load balancer after
kubeadm upgrade plan and before kubeadm upgrade apply, in the way the
graceful shutdown does it. It opens the gate when kubeadm returns, also
when kubeadm fails. A node that cannot leave the load balancer does not
start the apply, and the call fails.

The call parks no manifest, so the gate file names the call and not a
park directory. A gate with that name is one that the agent opens, as it
opens a gate of the etcd defragmentation. The repair of stale state at
startup therefore opens it too, when the agent stopped in the middle of
the call.

The gate stays open on a cluster with one control plane node, which the
agent reads as one voting member of etcd. kubeadm reaches the cluster
through the load balancer, so with the only node out of it the apply
would fail. The gate also stays open when the members cannot be listed.

The call holds the lock of the static pod changes from the close to the
open. A second call, which a caller sends when the first one takes too
long, then waits and does not open the gate under the first.

The call has no operation record, so it logs its gate steps as the
repair at startup does. The log line of those steps no longer names the
repair: it is now "control plane step outside an operation".

With no gate file the call runs the same two commands as before and
nothing else.

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

* docs(agent): describe the gate of kubeadm upgrade apply

The agent README says when KubeadmUpgradeApply closes and opens the
control plane endpoint gate, that the call does not withdraw kube-vip,
and why the gate stays open on a cluster with one control plane node.
The list of gate file contents has the name that this call writes.

The README also says that the other calls that restart the API server
do not touch the gate, and that their caller closes and opens it.

The agent design page names the call next to the graceful shutdown.

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

* fix(agent): reject a directory as the control plane endpoint gate file

The agent accepted a gate file path that is an existing directory. It
started, and each later withdrawal failed: the agent renames the gate
file into place, and a rename cannot replace a directory. An operation
of the agent that reads the gate first failed at the read.

The check of the gate flags now rejects such a path at startup, like
the other gate settings that cannot work. A path with no file is still
accepted. No file is the open gate, so the file is absent at each
normal start.

The test of the gate flags has a case for an existing directory and a
case for an absent file in an existing directory.

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

* fix(agent): stage the control plane endpoint gate file under a private name

The agent staged the gate file at the gate path plus ".tmp" and wrote
it with os.WriteFile, which follows a symbolic link. The agent runs as
root. A user who can write to the folder of the gate could leave a link
at that name. The agent then wrote the owner of the gate into the file
that the link names, and the rename put the link at the gate path.

The gate file now goes through atomicWriteFile, as the other files of
this package that are renamed into place. That helper creates the
staged file itself, with a name that nobody knows before, writes
through the open file and removes it when a step fails. The rename
replaces a link at the gate path and does not follow it. The gate no
longer uses the FileWriter of the server. The tests fail the write
through a function of the server that stands in for the helper.

Startup does not refuse a folder that another user can write to. The
folder often does not exist before the first close, and its mode does
not say enough on a node image that has the folder on a mounted volume.
The README now names such a folder as a thing the deployment has to
provide.

A new test puts a link at the old staging name and at the gate path.
It checks that the file behind the link is unchanged and that the gate
file is a regular file with mode 0644.

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

* fix(agent): keep parked manifests with the gate when its hand-off fails

A defragmentation that gives up on its etcd member hands the gate and
the parked manifests to the caller. The hand-off recorded a failure of
the gate and still moved the manifests. The gate file then named the
defragmentation, and the caller held the manifests. At its next start
the agent opened that gate, because the gate file named a flow of the
agent, while kube-apiserver was still parked for the caller.

The hand-off now does the gate first and stops when the gate fails.
No manifest moves. The gate and the manifests all stay with the
defragmentation, and the defragmentation reports the failure as
before. At its next start the agent puts the manifests back and then
opens the gate, as it does for a defragmentation that was interrupted.

A new test runs a defragmentation whose member does not return and
whose gate file cannot be written again. It checks that the gate and
kube-apiserver stay with the defragmentation, and that the next start
puts kube-apiserver back and opens the gate.

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

* fix(agent): list the etcd members of kubeadm upgrade apply under the lock

With a gate, KubeadmUpgradeApply listed the members of etcd before it
took the lock of the static pod changes. When the list failed, it ran
kubeadm upgrade apply with no lock. The apply of a first call restarts
the local etcd. A second call, which a caller sends when the first one
takes too long, could then fail its list and run a second kubeadm
upgrade apply next to the first.

The call now takes the lock before it lists the members. A second call
waits for the first, and lists the members when the first apply is
over. The apply on a cluster with one control plane node and the apply
with members that cannot be listed still leave the gate open, and they
now run under the lock too. With no gate file the call takes no lock,
as before.

The helpers that run under the lock do not take it themselves, and the
defragmentation already lists the members under the same lock.

A new test holds a first call in its apply, fails the member list and
sends a second call. It checks that the second apply does not start
while the first one runs. The cases for one control plane node and for
a failed member list now expect the lock during the apply.

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

* docs(agent): say what kubeadm upgrade apply does with a gate that exists

The agent README and the agent design page said that
KubeadmUpgradeApply removes the gate file when kubeadm returns, and
that the gate stays open with one control plane node or with members
that cannot be listed. Both say more than the code does.

The call removes only a gate file that it wrote. A gate that a caller
closed stays closed until the caller opens it with StartKubeVipRestore,
and the call then closes no connection. With one voting member of etcd,
or with members that it cannot list, the call does not use the gate. It
creates no gate file and leaves one that exists as it is.

The two pages now say this. The cases of the upgrade test for a gate of
a caller, for one control plane node and for a failed member list show
the same behavior.

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

* fix(agent): reject a gate file path that names a directory by its form

Startup refused a gate file that is an existing directory. A path that
ends with a separator, or whose last element is "." or "..", passed
that check while nothing existed there. At the first close of the gate
the agent creates the folder of the gate file, which for such a path is
the gate path itself. The rename of the staged file then fails, and a
directory stays at the gate path.

Startup now refuses such a path with the same message. A path of an
absent file with no such ending still passes.

Three new cases of TestControlPlaneEndpointGateFlags have a path that
ends with a separator, with "/." and with "/..". They fail without the
new check.

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

---------

Signed-off-by: Davanum Srinivas <dsrinivas@nvidia.com>
2026-11-30 14:01:59 -05:00
Dan Budris 3ed03c7530 docs: document controller API authorization (#2174)
* docs: document controller API authorization

Add an operator guide for API authorization: the admin and viewer
roles, granting them by claim and by service account, turning
authorization on in permissive mode, finding the callers enforcing mode
would refuse, switching to enforcing, and the metrics to watch.

Link it from the docs index, the controller README and docs, and the
observability page. Pages that said NVKE does no authorization now say
every admitted caller can call every endpoint until authorization is on.

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

* docs(operate): name the Teleport app settings the roles claim needs

The token carries roles only when rewrite.jwt_claims includes them, and
the header rewrite is written differently in teleport.yaml and in a
dynamic app resource.

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

* docs: use the apiAuthz.authorizer.localBundle values paths

The chart now holds the authorization bundle under
apiAuthz.authorizer.localBundle, beside apiAuthz.authorizer.backend.
Update the operator guide, the controller README and the
troubleshooting table to match.

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

* docs(operate): say the chart refuses permissive authorization while it is off

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

* docs(operate): restructure the API authorization page after review

Explain grants and the shipped roles up front, and show the apiAuth
admit change a viewer grant needs. Restart NVKE when switching to
enforcing mode, since only nvke-controller-config changes, and add a
rollback. Name the failed-to-authorize log line, act on each outcome,
and give success signals for grant changes. Split steps to one command
each, move Teleport and role customization to the end, drop the metrics
table that observe.md already covers, and add next steps.

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

---------

Signed-off-by: dbudris <dbudris@nvidia.com>
2026-11-24 16:20:39 +00:00
Suket Sharma c34780da4b feat: authenticate node agents in KubeVirt VMs over TLS/JWT (#2379)
* feat(controller): accept VM subjects for TLS/JWT node agents

DSX Identity issues /vm/<id> subjects to virtual machines through the
metadata-service sidecar. Accept /vm/<node UUID> alongside /bm/<node UUID>
so node agents in KubeVirt VMs can authenticate.

Signed-off-by: Suket Sharma <sukets@nvidia.com>

* feat(agent): fetch TLS/JWT tokens from the DSX metadata service

Add --dsx-identity-metadata-url (NKE_DSX_IDENTITY_METADATA_URL). When set,
the tls-jwt token source fetches the DSX identity token from the metadata
service at /latest/meta-data/identity instead of minting a JWT-SVID from the
SPIRE workload API and exchanging it. A KubeVirt VM cannot run an attested
SPIRE agent, but the DSX metadata-service sidecar in its virt-launcher pod
returns an already exchanged token for the VM's workload identity.

Signed-off-by: Suket Sharma <sukets@nvidia.com>

* fix(agent): bypass HTTP proxies for DSX metadata service requests

The metadata service is reachable only from the VM's own pod network, so a node-wide HTTP_PROXY must not carry the request.

Signed-off-by: Suket Sharma <sukets@nvidia.com>

* refactor(agent): read metadata token expiry with golang-jwt

Use jwt.ParseUnverified instead of decoding the JWT payload by hand, and reword the MetadataClient doc comment.

Signed-off-by: Suket Sharma <sukets@nvidia.com>

* fix(agent): require external mTLS with the DSX metadata service

A VM has no SPIRE agent, so without --nvke-controller-client-ca-bundle the
agent would fall back to the SPIRE workload API for its server certificate
and fail at runtime. Reject that configuration at startup instead.

Signed-off-by: Suket Sharma <sukets@nvidia.com>

---------

Signed-off-by: Suket Sharma <sukets@nvidia.com>
2026-11-19 21:35:05 +00:00
Abhay Krishna 51dc0c4dae feat!: make apiAuth the only API authentication source (#1938)
apiAuth in nvke-controller-config becomes the only place the
controller reads its API authentication configuration from. This is
the breaking second step of phase 2.

- The controller refuses to start when AUTH_CONFIG_PATH is set, naming
  apiAuth as the replacement, and passes authn.Setup only the apiAuth
  section. authn.Load and Options.ConfigPath stay for
  management-engine's --auth-config.
- The chart no longer renders or mounts nvke-auth-config. It refuses
  apiAuth.configMap and an AUTH_CONFIG_PATH env entry by name, and a
  caBundlePath into the old mount, pointing at jwks.caBundle.
- apiAuth.permissive requires apiAuth.enabled, in the chart and at
  startup. Tilt passes it only with authentication on.
- controllerconfig, which decodes the apiAuth section, gets the
  decoder-strictness tests.
- nvkectl and the token scripts keep their fallback to the
  authentication ConfigMap for controllers from before this change.
- The e2e suite reads the enforcement mode from apiAuth alone.
- The pod template carries a checksum of nvke-controller-config, so an
  upgrade that changes apiAuth rolls the controller without Reloader,
  which the NVKE stack does not install.
- API authorization (#2125) counts authentication as on exactly when
  apiAuth.enabled is.

BREAKING CHANGE: AUTH_CONFIG_PATH and apiAuth.configMap are removed.
A site that managed its own authentication ConfigMap moves audiences
and issuers into apiAuth.config, CA bundles into jwks.caBundle, and
sets apiAuth.enabled. apiAuth.permissive without apiAuth.enabled is
refused. nvkectl older than the previous step gets 401.

Signed-off-by: Abhay Krishna Arunachalam <abhaykrishna@nvidia.com>
2026-11-17 13:25:25 -08:00
Carl Danley 3256d9cae4 docs: propose operator-set Kubernetes feature gates (#2095)
* docs: propose operator-set Kubernetes feature gates for workload clusters

Add a design and a proposed ADR for letting operators set beta and GA
Kubernetes feature gates on a workload cluster's control plane and
kubelets, validated in the API request against a catalog generated from
Kubernetes' own gate registry, and rechecked on upgrade.

Signed-off-by: Carl Danley <cdanley@nvidia.com>

* docs: scope the feature gate upgrade guarantee to gates the operator set

Signed-off-by: Carl Danley <cdanley@nvidia.com>

* docs: replace feature-gates on control-plane upgrade instead of keeping old values

Signed-off-by: Carl Danley <cdanley@nvidia.com>

* docs: merge NVKE's kubelet gates with the operator's map

Signed-off-by: Carl Danley <cdanley@nvidia.com>

* docs: update stored control-plane gate maps in the upgrade transaction

Signed-off-by: Carl Danley <cdanley@nvidia.com>

* docs: align feature gates design with control-plane isolation and review feedback

Store the control-plane map in the control-plane configuration snapshot
and each pool's map in its node sets, and render every host from its own
snapshot or node set, so the design works with today's kubeadm bootstrap
and with control-plane isolation.

Drop the control-plane kubelet map, add the required-gates list, name
every stored gate in a dependency failure, and keep the replaced map for
rollback. Put kubelet gates in a JSON patch that replaces what the
kubelet-config ConfigMap holds, and reject upgrades of clusters with
stored gates until the upgrade recheck lands.

Signed-off-by: Carl Danley <cdanley@nvidia.com>

* docs: move feature gates to ControlPlaneClass and pass them through unchecked

Gates are set per control-plane component on ControlPlaneClass, and the management engine passes them to the NVKE controller as given. The controller no longer validates gates against a per-version catalog or restricts stages; it rejects only values that contradict gates NVKE sets. Gate changes roll the control plane, upgrades carry gates unchanged, and a version check moves to later work.

Signed-off-by: Carl Danley <cdanley@nvidia.com>

* docs: take control-plane extraArgs per component in the NVKE controller

The NVKE controller's API takes extraArgs for kube-apiserver, kube-controller-manager and kube-scheduler instead of feature gate maps, so it carries any flag without a field per feature. ControlPlaneClass keeps a featureGates map per component, and the management engine renders it into a feature-gates flag. Operator arguments can't override flags NVKE sets; feature-gates is merged with NVKE's gates instead.

Signed-off-by: Carl Danley <cdanley@nvidia.com>

---------

Signed-off-by: Carl Danley <cdanley@nvidia.com>
2026-11-17 21:00:09 +00:00
Dan Budris 6451d897f4 feat(auth): admit API callers by a claim value (#2141)
* feat(auth): admit API callers by a claim value

An issuer's admit rules gain claims: a list of {name, value}. A token
is admitted when one rule's top-level claim is the value, or a string
array holding it. This admits tokens with no groups claim, such as
Teleport application-access JWTs (roles), Entra app-only tokens (roles)
and CI OIDC tokens.

Claims that describe the token rather than the caller (iss, aud, nonce,
jti, exp, nbf, iat, typ) are refused. LocalBundle role mappings use the
same rule, matcher and validation.

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

* docs(auth): Teleport needs an Authorization rewrite and either algorithm

Teleport sends its app JWT in Teleport-Jwt-Assertion, and NVKE reads only
Authorization, so the Teleport app needs a header rewrite. Teleport signs
with RS256 under the legacy signature_algorithm_suite and ES256 under the
others, so the example accepts both.

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

* docs(auth): spell out the Teleport app settings NVKE needs

The roles claim needs rewrite.jwt_claims to include roles. The header
rewrite has a different form in teleport.yaml and in a dynamic app
resource, so show both. Name the application access JWKS path, which is
not Teleport's OIDC discovery key set.

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

---------

Signed-off-by: dbudris <dbudris@nvidia.com>
2026-11-06 19:04:06 +00:00
Dan Budris cc474ce481 fix(auth): refuse a null service account name in authN admission (#2036)
In YAML, name: with no value, name: ~ and name: null decoded the same as
leaving name out, which matches every service account in the namespace.
An operator who meant to narrow a rule could admit the whole namespace
without an error. The chart passes such a value through as name: null.

ServiceAccountRule.Name is now a ServiceAccountName that records an
explicit null, and Validate refuses it:

  issuers[0] (k8s): admit: serviceAccounts[1]: name is null; remove the
  key to match any service account in namespace "nke-clients", or set a
  name

Both loaders call Validate, so the authentication config file and the
apiAuth section of the controller config refuse it. An absent name keeps
matching every service account. A null rule that skipped Validate
matches nobody. Strict decoding keeps reporting unknown and
case-mismatched keys with their full path.

LocalBundle uses the same type and reports the same message.

Signed-off-by: dbudris <dbudris@nvidia.com>
2026-11-06 11:11:11 -07:00
Dan Budris 970e811036 feat(controller): count and alert on rejected tenant kubeconfigs (#2096)
Count every tenant kubeconfig the controller refuses to load in
nvke_controller_tenant_kubeconfig_rejected_total, by source: node_agent
for a control-plane node's admin.conf, secret for a published
kubeconfig Secret. Each rejection also logs the cluster, and the node
or Secret. Content rejections wrap kube.ErrInvalidKubeconfig, so other
failures are not counted.

Add NVKETenantKubeconfigRejected to the credential PrometheusRule. It
fires on any rejection in the last ten minutes.

Signed-off-by: dbudris <dbudris@nvidia.com>
2026-11-03 13:11:16 -05:00
Terry Howe 8eed5173c8 feat(deploy)!: move the greenfield overlays and the release namespace to nvke-controller (#1889)
* feat(deploy)!: move the greenfield overlays and the release namespace to nvke-controller

This moves them, and with them the persisted identifiers a site carries:
the Helm release and its namespace, the database, and the Temporal
namespace and task queue.

In the three greenfield stacks: nameOverride, fullnameOverride,
namespaceOverride, serviceAccount.name, serviceMonitor.name,
appDb.dbName, the Temporal namespace and queue, the field managers and
the managed-by values, tracing.serviceName, and the objects the stacks
render around them -- the Namespace manifest, the Postgres CREATE
DATABASE, the SPIRE admin ID and ClusterSPIFFEID namespace selectors,
the auth-dev ConfigMap's namespace, the CAPD RBAC ClusterRole and its
subject, and the spire-client probe URL.

Consumers that move with it: controller/Tiltfile (release name,
namespace, SPIRE admin path and the string-matched resource names),
deploy/check-site.sh, the e2e site helpers and their collect script,
cli/internal/bootstrap/controllerdeploy (including the NodePort Service
nvke-controller-external), cli/internal/deploypath's admin path,
management-engine/hack/nvke-controller.sh, and the CI lane scripts.

The discovery paths search the new name first and keep the old one:
nvkectl's authConfigNamespaces, nvke-token.sh, nvke-auth-demo.sh and
dev-env-spire.sh now try nvke-controller, then nke-controller, then
cloud-workflow-engine. The reference health dashboard matches all three
workload names, and Tilt's preflight refuses to take over a cluster
that still runs the nke-controller release rather than failing later.

The published image keeps its name per #1554 decision 2, as do the
nke-controller-config ConfigMap and the nke-controller-chart release
artifact; hack/name-check-allowlist.txt now carries one entry per
reason rather than one blanket token.

Refs #1861, #1554, #1496, #1818

Signed-off-by: Terry Howe <thowe@nvidia.com>

* fix: address review feedback

Name nke-controller as the intermediate namespace in the authentication
docs, matching authConfigNamespaces, and restore the legacy node-agent
audience in the exchange mock's test.

Signed-off-by: Terry Howe <thowe@nvidia.com>

* fix: address review feedback

Signed-off-by: Terry Howe <thowe@nvidia.com>

* fix(e2e): point the nico bootstrap lane at the nvke-controller namespace

The nico lane still asserted the tenant credentials Secret landed in
nke-controller, so both e2e (nico) jobs failed after the rename.

Signed-off-by: Terry Howe <thowe@nvidia.com>

* fix(deploy): carry the nvke-controller rename into the rebased files

The rebase onto main replayed the rename over two files that gained
nke-controller references after the branch was cut: the management-engine
dev overlay, which succeeds the hack script this branch had edited and
was removed in #1918, and an API-authentication example added in #1935.

Refs #1861

Signed-off-by: Terry Howe <thowe@nvidia.com>

* fix: address review feedback

Continue namespace discovery past a Forbidden lookup in nvke-token.sh and
nvke-auth-demo.sh. --ignore-not-found suppresses absence, not denial, so a
kubeconfig scoped to nke-controller alone died on the nvke-controller probe
before reaching the namespace it can read -- the migration case this branch
adds. Keep the first denial, try the remaining candidates, and fail with it
only when none was readable, since falling back to cloud-workflow-engine
needs a confirmed absence.

Refs #1861

Signed-off-by: Terry Howe <thowe@nvidia.com>

---------

Signed-off-by: Terry Howe <thowe@nvidia.com>
2026-10-29 08:17:40 -06:00
Tjark Rasche 62d22e7dbb feat(qualification): add credential rotation evidence collector (#1380)
* feat(qualification): add credential rotation demo and evidence collector

Redistribute the reviewed five-scenario collector and all evidence fixes from cff67ff5, 2bc9fd9c, 65a1b2d1, 568b1104, 2fafa32c and d9542b83 onto the finished native guides layer. Preserve fresh matching metrics, scheduled due-subset outcomes, required check aggregation, the bounded in-flight observer join and single-operation manual audit contract.

Reference the separate immutable #1050 runbook rather than resubmitting it. Document inherited qualified-build, Kubernetes 1.34+, loaded-config/process-start and external-writer prerequisites. Offline validation does not qualify a deployment.

Closes #1348

Signed-off-by: Tjark Gunnar Rasche <trasche@nvidia.com>

* fix(qualification): accept an alert resolution received after the mutation started

The alert lane required the resolved receipt at or after the
collector-observed completion. RenewK8sCertsV2 renews control planes one
at a time, so when the alert node renews before the last node, its
inspection can resolve the alert while later nodes are still renewing.
Alertmanager then delivers the single resolved notification before
completion, nothing re-fires, and the lane failed with
notification_delivery_incomplete after the forced renewal had consumed
the warning-window precondition.

Accept a resolved receipt at or after mutation_at, keep the receipt-ID
pairing, require no firing receipt between that resolution and
completion, and keep the final not-firing check. A test covers a
resolution between mutation and completion and a re-fire after it.

Signed-off-by: Tjark Gunnar Rasche <trasche@nvidia.com>

* fix(qualification): accept per-step T1 operation IDs and reject duplicate events

The manual-T1 collector required every row to carry the single configured
manual_operation, which removed the only way to keep repeated identical
steps distinct: event_id hashes every field except the timestamp, so a
repeated failed renew on one node collapsed into one row on export, and
the collector also accepted duplicate event_ids.

Accept manual_operation itself or with a per-step suffix
/<action>-<n>, as the audit guide recommends, and reject a duplicate
event_id with audit_event_duplicate. Revert the doc waivers in the audit
guide and the credential lifecycle page that told operators to drop the
suffix. Both pages and the demo README now also state that --cluster
must be the exact kube-system namespace UID, which the collector already
required. Links from those navigated pages to the demo README are
absolute, like the other links to files outside the navigation. A test
covers a repeated identical step, a duplicate event and a foreign run.

Signed-off-by: Tjark Gunnar Rasche <trasche@nvidia.com>

* fix(qualification): report the collector's reason code and release a rejected output

main reserved --output with O_EXCL and then reported every escaped error
as one generic line. A config rejected before run's own error handling,
or an aggregate error, lost its fixed reason code, and the empty 0600
file blocked a rerun to the same path with the same message.

Print the CheckError code (or collector_input_or_protocol_error for other
exceptions) to stderr, and remove the reserved file when nothing was
serialized. A file that already existed is still never touched. A test
reuses the path after a rejected config.

Signed-off-by: Tjark Gunnar Rasche <trasche@nvidia.com>

* fix(qualification): fail when two control planes report the same node leaf

T1 attributes whatever the configured ssh destination returns to that
node, and validation only checks that ssh is non-empty. A copy-pasted
destination recorded cp-2's certificates as cp-3's and could pass. Every
certificate inventory now fails with node_certificate_attribution_ambiguous
when two control planes report the same apiserver, etcd-server or
etcd-peer fingerprint; shared CAs are unaffected. The existing manual
inventory test now gives each node its own leaves, and new tests cover a
duplicated leaf and a duplicated ssh destination.

Signed-off-by: Tjark Gunnar Rasche <trasche@nvidia.com>

* fix(qualification): require the scheduled cycle to start after traffic started

The scheduled lane read the prior cycle ID before the baseline metrics
wait, and traffic started only afterwards, while scheduled() accepted any
new scheduler cycle. A cycle accepted in that window was credited with
continuous API traffic it never observed. Require the selected cycle's
certificateRenewal.startedAt to be at or after traffic start, and stop at
once with cycle_started_before_traffic otherwise. A test covers a cycle
that appears during the baseline phase.

Signed-off-by: Tjark Gunnar Rasche <trasche@nvidia.com>

* fix(qualification): keep polling a partially written T1 completion marker

The documented cat > t1-completed.json <<'EOF' creates the marker before
writing it, so a two-second poll could read an empty or partial file.
read_json then raised ValueError, which wait_for does not retry, and the
run failed after the manual maintenance had finished. Map empty or
unparseable marker content to manual_completion_not_observed while
waiting, so polling continues until the deadline. A test starts with an
empty marker that becomes partial and then valid.

Signed-off-by: Tjark Gunnar Rasche <trasche@nvidia.com>

* fix(qualification): validate kubelet serving inputs before any T2 mutation

T2 config validation never checked kubelet_ca_file or each node's
kubelet_address. Both are first read in serving_certificates, after the
production renewal or rotation, so a missing key failed as
collector_input_or_protocol_error only after the mutation ran. Require an
existing kubelet_ca_file and a kubelet_address for every node in T2
scenarios during validation; manual T1 still needs neither. The offline
config points kubelet_ca_file at an existing fixture file, and a test
covers each missing input without contacting the cluster.

Signed-off-by: Tjark Gunnar Rasche <trasche@nvidia.com>

* fix(qualification): require one deployed build across passed T2 reports

The release index bound T2 reports only by checkout revision, cluster,
kube-system UID and profile, and never compared the observed
deployed_versions_before hashes. If the controller or agents were
redeployed between lanes and expected_versions was updated as the README
instructs, aggregate still passed scenarios that ran against different
builds. Require identical deployed-version sets across passed T2 reports;
manual T1 runs on another cluster and is excluded. A regression changes
only one version hash.

Signed-off-by: Tjark Gunnar Rasche <trasche@nvidia.com>

* fix(qualification): require the firing alert receipt before the alert lane mutates

The collector accepts only the bundled receiver's nke.alert-receipt.v1
records and read them only after the forced renewal. Using the site's own
receiver, or starting the helper after the last firing notification,
failed the lane after the renewal had already consumed the warning-window
precondition. Before starting the renewal, require a matching firing
receipt in alert_receipts_file and fail with
firing_notification_not_received otherwise. A test with only a resolved
receipt fails before any mutation.

Signed-off-by: Tjark Gunnar Rasche <trasche@nvidia.com>

* docs(qualification): state lane order, receiver, timeouts and T1 steps in the demo README

Review corrections to hack/rotation-demo/README.md:

- State the required T2 lane order (scheduled renewal before the forced
  and alert lanes) and the alert lane's staggered-expiry precondition
  before the first T2 command.
- The bundled alert receiver is required, and a matching firing receipt
  must already exist before the alert lane starts; describe the resolved
  receipt window after the collector change.
- Start the scheduled lane only when nextCertRenewalDue plus renewal and
  the next inspection fit inside timeout_seconds (at most eight hours).
- List openssl and base64 as node prerequisites and describe the
  kubectl config view --raw read of kubeconfigs under sudo.
- Show the one-time build before starting manual-t1 and the verify call
  separately, with a per-step operation ID.
- Add timeout_seconds, sized for the whole T1 runbook and post-checks, to
  the T1 configuration list.
- Link the in-tree site certificate renewal runbook instead of the pinned
  e76ea3db blob.

Signed-off-by: Tjark Gunnar Rasche <trasche@nvidia.com>

* docs(operations): name the audit tool as the self-reported operator subject

The rotation-demo exception inserted before "Its operator subject is
self-reported" made "Its" read as the collector's. The exception now
follows that sentence, and the sentence says "The audit tool's operator
subject" explicitly.

Signed-off-by: Tjark Gunnar Rasche <trasche@nvidia.com>

* chore(qualification): ignore Python bytecode caches

Running the rotation demo's tests or the other hack/ Python scripts
outside the Makefile, which sets PYTHONDONTWRITEBYTECODE, leaves
__pycache__ directories behind. That bytecode is build output, and some
of it was nearly committed with the demo. Ignore it next to the other
per-checkout scratch and tool caches.

Signed-off-by: Tjark Gunnar Rasche <trasche@nvidia.com>

* fix(qualification): stop waiting on a duplicate audit event

The T1 audit check runs inside wait_for, which retries every reason
outside its fatal set until the deadline. A duplicate event_id cannot
clear by waiting, because the guide forbids deleting ledger rows, so a
run with a duplicate polled for up to timeout_seconds, as long as eight
hours, before reporting audit_event_duplicate.

Add the reason to the fatal set. The new test fails with must not retry
when the reason is removed again.

Signed-off-by: Tjark Gunnar Rasche <trasche@nvidia.com>

* docs(qualification): warn about an early scheduled cycle and redeploys in the demo README

The scheduled-renewal lane fails with cycle_started_before_traffic when
the scheduler accepts the cycle while the lane is still in its baseline
checks. That cycle has already renewed the due node, so the next one is
a no-op and the cluster cannot qualify until its certificates approach
expiry again. Tell operators to start the lane early enough that the
baseline checks finish before nextCertRenewalDue.

The release-index section also did not mention that passed T2 reports
must share the observed deployed versions, which aggregate enforces
with release_deployed_versions_mismatch.

Signed-off-by: Tjark Gunnar Rasche <trasche@nvidia.com>

* docs(qualification): describe the rotation demo as a collector and name the NVKE controller

Signed-off-by: Tjark Gunnar Rasche <trasche@nvidia.com>

* fix(qualification): record an interrupted demo run as failed evidence

Ctrl-C raised KeyboardInterrupt past run and main, leaving an empty reserved
output file and losing the record that a workflow had started. run now
returns a failed report with reason interrupted, mutation_started and the
workflow hash.

Signed-off-by: Tjark Gunnar Rasche <trasche@nvidia.com>

* fix(rotation-demo): require provenance and pin traffic to the approved cluster

Release aggregation now rejects reports without Boolean source cleanliness and passed reports without well-formed hashed deployed versions. Continuous API traffic pins the approved API server and checks the kube-system UID on every sample, so target drift fails independently of the outage budget.

Signed-off-by: Tjark Gunnar Rasche <trasche@nvidia.com>

* fix(rotation-demo): accept zero audit counters at baseline

The controller creates every credential audit result series at zero and a
restart resets them, so a quiet site has no stored writes before the
mutation. The baseline now requires the stored series and no failure
increase only; positive stored evidence is required after the mutation. A
zero-series fixture covers both checks.

The README now shows the lanes in run order, keeps the alert node's leaves
between thresholdDays and warningDays with a different scheduled
candidate, and gates the scheduled lane on nextCertRenewalDue. The three
guides state the exact /<action>-<n> suffix form and its 1-99 bound.

Addresses review threads r4335395773, r4335396217, r4335396675,
r4335397034 and r4335397446.

Signed-off-by: Tjark Gunnar Rasche <trasche@nvidia.com>

* fix(qualification): address rotation demo review findings

- N1: document that cwe_authorization_file holds "Bearer <token>" for the
  controller audience, is reread per request, and must stay valid until
  the lane ends.
- F3: release the reserved output only before writing starts, so an
  fsync failure keeps the written evidence.
- F4: time out a stalled alert webhook body.
- F5: compare deployed builds independent of node order.
- F11: require the node name as --node for demo-observed T1 rows in both
  guides.

Signed-off-by: Tjark Gunnar Rasche <trasche@nvidia.com>

* fix(rotation-demo): address review comments on audit and metric checks

Compare the audit-write failure counter, including rate_limited, between
the baseline and the final sample instead of a trailing 10m window. Report
an absent CSR age series as csr_metric_missing, require cluster_name for
T2 lanes, drop the unreachable worker branch and the unrun PromQL sample
file, and run the offline tests from name-check so the merge gate runs them.

Signed-off-by: Tjark Gunnar Rasche <trasche@nvidia.com>

* fix(rotation-demo): stop on past notification failures and pick receipts deterministically

Applies review suggestions: notification_order_invalid and notification_refired_before_completion describe past events that polling cannot clear, so wait_for stops on them; alert_receipts checks receipts in sorted order and keeps the first specific reason, so one invalid receipt no longer hides a valid one depending on set order; public-certificates.sh accepts only the control-plane role, the only one demo.py sends.

Signed-off-by: Tjark Gunnar Rasche <trasche@nvidia.com>

* fix(rotation-demo): address review findings on receipts, audit resets and docs

Report a specific receipt failure only once no fired receipt still awaits
its resolution, fail the lane on any audit failure counter reset since the
baseline, document that a controller restart during a lane fails it, require
Temporal CLI 1.1.1, anchor the recovery link, and label the name-check job as
also running the rotation-demo tests.

Signed-off-by: Tjark Gunnar Rasche <trasche@nvidia.com>

---------

Signed-off-by: Tjark Gunnar Rasche <trasche@nvidia.com>
2026-10-27 18:29:08 +01:00
Tjark Rasche bdd4baf7d4 docs(operations): add credential rotation operator guides (#1379)
* docs(operations): add credential rotation operator guides

Redistribute the non-T1 operator guides from 2499f8e9cdc4d8eac4cfc866a93887f708f68d21 and 07937b43e025b2e69b2d1636e3bc74a9511ceeb4 onto the complete audit layer. Keep PR #1050 separate with immutable references and retain only the additional manual audit, public-certificate and qualification guidance here.

Preserve inherited rotation safeguards and require the same qualified controller/agent build. Adapt navigation to current main, correct condition-status and IPv6 probe examples, and make the newly indexed audit guide parse as MDX without changing its license text.

Closes #1347

Signed-off-by: Tjark Gunnar Rasche <trasche@nvidia.com>

* docs(operations): verify renewed leaves on the node, not the breakglass kubeconfig

The tenant renewal guide compared the downloaded nvke:breakglass
kubeconfig before and after renewal and sent operators to debug the
publication path when it was unchanged. nvkectl get kubeconfig returns the
tenant-access breakglass certificate, not a kubeadm leaf, and tenant
access reissues it only near its own expiry or on a CA change; leaf
renewal keeps the CA, so a healthy renewal leaves it unchanged and the
gate failed on every working cycle.

State that leaf renewal does not reissue the downloaded kubeconfig, verify
renewed leaves on each node with kubeadm certs check-expiration plus the
cluster status fields, and drop the .before copy. The credential
lifecycle table and the Kubernetes API access page no longer promise
refreshed client copies.

Signed-off-by: Tjark Gunnar Rasche <trasche@nvidia.com>

* docs(operations): correct failed-cycle retry, lock release check and Temporal values

Three corrections to the tenant renewal guide's recovery and forced-run
steps:

- The automatic retry the guide told operators to wait for needs
  certRenewal.controllerEnabled and starts no earlier than both one hour
  after the failure and nextCertRenewalDue. A forced cycle that failed
  before its due time could wait a full interval, and with scheduling
  disabled forever, while the guide forbade the only other path. It now
  says to start a new forced workflow once the lock is released when no
  retry will come.
- The lock release check named only the workflow ID and lock type. The
  contract also requires certificateRenewal.state = failed; releasing an
  accepted cycle's lock leaves the scheduler requeuing it without
  dispatch. The guide now requires failed and says to stop and escalate
  on accepted.
- Name temporal.namespace and temporal.taskQueue from
  nke-controller-config with their defaults and link the forced renewal
  contract for the TLS flags, since a wrong queue starts a workflow no
  worker polls.

Signed-off-by: Tjark Gunnar Rasche <trasche@nvidia.com>

* docs(operations): link the in-tree site certificate renewal runbook

The T1 runbook is already in this tree and in the site navigation, so
"unmerged" was false, and the pinned e76ea3db blob links sent readers to a
frozen copy that will drift from the maintained page. Link
../site-operations/certificate-renewal.md and its section anchors instead,
and drop the PR #1050 wording.

Signed-off-by: Tjark Gunnar Rasche <trasche@nvidia.com>

* docs(operations): keep navigated credential pages linking only navigated pages

The pages this change adds to the navigation linked files outside
docs/index.yml, which the docs authoring rule forbids: agent/docs/SECURITY.md,
controller/docs/configuring-node-agent-tls-jwt.md,
docs/qualification/overview.md, docs/operations/observability.md,
docs/tenant-clusters/kubernetes-api-access.md and controller/test/e2e/README.md
now use absolute GitHub URLs. The API authentication link points at the
navigated "Call the API" section instead. The etcd guide's e2e link was
written earlier but is fixed here, where that guide enters the navigation.

Signed-off-by: Tjark Gunnar Rasche <trasche@nvidia.com>

* docs: check the cert renewal reservation before a retry or forced start

After a failed cycle's lock is released, the page told operators to wait
for the automatic retry or start a forced workflow. A reservation left in
the cluster row's certificate_renewal column still blocks both. A fenced
one makes admission refuse every cycle and restart the backoff, and an
unfenced V1 one fails the cycle at that node. The REST API does not show
the column, so say to check that it is empty and to follow the contract's
reservation paragraph if it stays set.

Also give the actual reason not to release an accepted cycle's lock:
the scheduler keeps requeuing it without dispatching, so releasing the
lock does not resume renewal.

Signed-off-by: Tjark Gunnar Rasche <trasche@nvidia.com>

* docs(operations): wait for the automatic cert renewal retry before forcing

The tenant guide allowed a forced workflow before the automatic retry had
run, while the component contract says to wait for that retry and inspect
its result. The retry takes the lock, so an earlier forced start is refused
anyway. Follow the contract: force only after the retry has finished, or
once the lock is released when scheduling is disabled.

Signed-off-by: Tjark Gunnar Rasche <trasche@nvidia.com>

* docs(operations): scale two-control-plane clusters up to three for cert renewal

Signed-off-by: Tjark Gunnar Rasche <trasche@nvidia.com>

* docs(operations): name the NVKE controller in the credential renewal guides

Signed-off-by: Tjark Gunnar Rasche <trasche@nvidia.com>

* docs(operations): name the controller ConfigMap as main now does

Main renamed the chart's default controller ConfigMap to
nvke-controller-config, so looking up the renewal and Temporal settings
under the old name found nothing on a default install. The runbook now
names controllerConfig.name with its default.

Signed-off-by: Tjark Gunnar Rasche <trasche@nvidia.com>

* docs(certificate-renewal): limit the accepted-cycle rationale to scheduled cycles

Releasing the lock of an accepted forced cycle lets the scheduler start a
new scheduled cycle that overwrites the status while the terminated run's
node work is unconfirmed; the tenant guide now says so and still asks to
escalate without releasing. It also shows the contents of the mode-0600
curl configuration the API reads use.

Addresses review threads r4335322741 and r4335323177.

Signed-off-by: Tjark Gunnar Rasche <trasche@nvidia.com>

* docs(certificate-renewal): correct V1 reservation failure point and navigation

Fixes PR #1379 review findings:
- R1: a leftover V1 reservation fails the cycle at the first node that needs
  renewal, whichever node it names; failedNodeID does not identify it.
- N1: drop the duplicate renewal-contract entry from docs/index.yml and
  docs/README.md.
- N2: align the new navigation page names with their page titles.

Signed-off-by: Tjark Gunnar Rasche <trasche@nvidia.com>

* docs(certificate-renewal): clarify failedNodeID may name the reserved node

Signed-off-by: Tjark Gunnar Rasche <trasche@nvidia.com>

---------

Signed-off-by: Tjark Gunnar Rasche <trasche@nvidia.com>
2026-10-26 23:13:57 +01:00
Tjark Rasche 6e6152857e feat(controller): record credential operation audit evidence (#1378)
* feat(controller): record credential operation audit evidence

Redistribute the reviewed credential audit ledger and manual evidence tool onto the native monitoring stack. Keep writes bounded and best-effort, preserve operation results and retained ownership, classify explicit V1 no-op markers, and record failed legacy attempts and confirmed terminal outcomes.

Sources: 73d9368b, 1e44e29b (d2039631), f96c9150, and 33d7e1aa; final source 66bfce3a. Adapt fence-store recording to the inherited neutral credential mutation tests and verify PostgreSQL evidence retention after cluster deletion.

Closes #1346

Signed-off-by: Tjark Gunnar Rasche <trasche@nvidia.com>

* feat(controller): retire lost control-plane nodes from failed etcd key rotations

A failed rotation from add_secondary on keeps the etcd_key_rotation lock, and
every phase and reset needs all snapshot nodes, so a permanently lost host
left the cluster unable to finish the rotation or replace the node.

Add the operator-started RetireLostEtcdRotationNode workflow. Under the
cluster row lock it requires the failed owning rotation, a node-mutation
phase, a joined control-plane node that is unready and does not answer a live
agent probe, no other removal in flight, and a ready etcd quorum. It records
the node in the rotation status, marks it deleting, writes a credential audit
event with the new node_retired reason, and tears only that node down. The
retained lock admits removal of a retired node alone; joins, scale-up,
upgrades and other nodes stay fenced until the reset rotation completes on
the survivors, so the replacement joins with the finalized key.

Document the recovery procedure and the audit reason.

Signed-off-by: Tjark Gunnar Rasche <trasche@nvidia.com>

* fix(controller): bound CSR-derived credential audit rows per managed node

A workload customer holds the nvke:breakglass cluster-admin kubeconfig, so
it can impersonate system:node:<managed node> and create CSRs with fresh
keys. The CSR controller wrote a ledger row per CSR UID for the skip path
and three for a valid one, and the table has no bound or retention, so a
tenant could grow the shared management database without limit. The
code comment and the audit guide claimed otherwise.

Route every CSR-derived write through Recorder.RecordCSR, which stores
the event only while that cluster and node have fewer than 12 CSR-derived
events in the last hour (four check/approve/verify triples). The count is
taken from credential_audit_events under a per-target advisory lock in the
insert transaction, so a controller restart does not reset the bound and
concurrent reconciles cannot both pass it. Background inspections of the
same credential do not consume the budget. Dropped events are counted
under the new, pre-initialized rate_limited result of
nvke_controller_credential_audit_writes_total, which the guide describes
as expected under CSR churn rather than a sink failure.

A controller test floods one managed node with distinct-UID CSRs and
checks rows stop at the bound while a second node is unaffected; a
Postgres test covers the SQL count, the window, the per-node scope and
idempotent repeats.

Signed-off-by: Tjark Gunnar Rasche <trasche@nvidia.com>

* fix(controller): audit a rolled-back lost-node retirement as a failure

RetireLostEtcdRotationNode set the audit outcome inside the transaction
closure and recorded it even when RunInTx returned an error, including a
commit failure. A rolled-back retirement was then audited as
rotate/success/node_retired, and the Temporal retry recorded a second
success. Any RunInTx error now records failure/operation_failed. A test
runs the closure successfully and then fails the commit.

Signed-off-by: Tjark Gunnar Rasche <trasche@nvidia.com>

* fix(controller): require a quorum of the current membership to retire a lost node

The retirement quorum check counted members without the lost node, so it
checked quorum after removal. The etcd member removal itself must commit
under the current membership, which still includes the lost node, so for
even sizes the check was one vote short: on a four-node control plane
with two ready survivors it committed RetiredNodes and Deleting=true, and
RemoveEtcdMember could then not reach quorum.

Require ready >= (members+1)/2+1. Tests refuse two- and four-node
control planes without a ready majority, refuse five nodes with two ready
survivors, and still admit three of three, four of four and three of
five. The rotation guide states the rule.

Signed-off-by: Tjark Gunnar Rasche <trasche@nvidia.com>

* fix(controller): start the retired node's teardown after any closed run

The retire workflow started its teardown-node-<id> child with
ALLOW_DUPLICATE_FAILED_ONLY. Label-driven remediation starts that ID with
AllowCPNode=false and, for a control-plane node, returns success without
tearing it down. Retirement has already committed Deleting=true, so every
rerun of the retire workflow then failed until Temporal retention purged
the completed run.

Use ALLOW_DUPLICATE so the child starts after any closed run of that ID.
A run that is still open keeps failing the start with an already-started
error, which the workflow returns as before. A workflow test completes a
remediation-style run of the same ID first and requires the retire
workflow's teardown to run.

Signed-off-by: Tjark Gunnar Rasche <trasche@nvidia.com>

* fix(controller): skip audit rows for unchanged certificate inspections

The inspection audit's operation hash includes AttemptedAt, so every
inspection got a new event_id and ON CONFLICT never deduplicated an
unchanged observation. With monitoring on by default every hour, each node
added one or two rows per hour indefinitely, and the guide only said to
monitor growth.

Do not record a successful inspection event when it repeats the previous
inspection's outcome and fingerprints for that node and credential; the
controller already has the previous CertificateInspection. Changes and
failures are still recorded. A test covers two unchanged inspections
leaving one row, a changed fingerprint adding one, and repeated failures.
The audit guide describes the dedupe.

Signed-off-by: Tjark Gunnar Rasche <trasche@nvidia.com>

* docs(controller): list CSR audit outcomes, link the T1 runbook, split the tool build

Three corrections to the credential audit guide:

- List the CSR controller's actual action/outcome/reason pairs. A
  managed node's rejected CSR is check/no_op/identity_not_approved, so
  filtering on outcome='failure' missed rejected identities.
- "The manual runbook" and "the runbook's health and CA checks" named no
  document. Link docs/site-operations/certificate-renewal.md and its
  health-check and verification sections.
- The only example chained the one-time build with a check/success/
  verified observation, so following it recorded a check nobody had
  performed. Show the build and the first observation as separate steps.

Signed-off-by: Tjark Gunnar Rasche <trasche@nvidia.com>

* docs(controller): set the retire workflow inputs and order its checks

The retire procedure used $rotation_workflow_id and $lost_node_id without
setting them, and the only rotation_workflow_id assignment in the guide
mints a new ID, while this workflow needs the retained owner's. Show where
to read both: conditions.etcdKeyRotation.workflowID of the cluster and the
lost node's id from the node list.

The guide also placed the live agent probe and the audit event inside the
one locked transaction. The probe runs before the locked checks and the
audit event is written after the transaction returns, best effort; the
guide now says so.

Signed-off-by: Tjark Gunnar Rasche <trasche@nvidia.com>

* docs(controller): list cmd/credential-audit in the contributor layout

The controller AGENTS.md layout still listed cmd/worker as the only
entrypoint, so the new credential-audit tool was missing from contributor
guidance.

Signed-off-by: Tjark Gunnar Rasche <trasche@nvidia.com>

* fix(controller): record rejected CSRs once per node and hour

Rejected CSRs drew from the same per-node audit bound as approvals and
issued certificates, and each used its own CSR UID as the operation
identity. A tenant holding the break-glass kubeconfig could create a
dozen mismatching CSRs naming a node, use up the hour's budget, and then
get a valid CSR approved with no check, approve or verify row. Only
rate_limited went up, and the guide called that benign.

A rejection now uses the operation identity node/rejected/<UTC hour>.
The event timestamp is excluded from the event ID, so every rejection for
one node in one hour has the same ID. The existing duplicate check stores
it once, and it uses one slot of the bound. Verified, approve and verify
events keep the per-UID identity, and the SQL is unchanged.

The guide now says rejections are recorded at most once per node per
hour, that a non-zero rate_limited means CSR evidence, including
approvals, may be missing, and how to find the affected node. The
suggested alert includes rate_limited.

The flood test now requires one rejection row after many rejected CSRs,
then the check, approval and issued-certificate events of a following
valid CSR. With the old identity it stores 12 rejection rows and fails.

Signed-off-by: Tjark Gunnar Rasche <trasche@nvidia.com>

* fix(controller): skip repeated identical certificate inspection failures

Unchanged successful inspections were already skipped, but every failed
inspection was recorded with a fresh event ID. A node whose agent lacks
the inspection RPC is reported as unsupported and re-inspected every
interval, so each such node kept adding one or two ledger rows an hour.
The same happened for a credential that stays missing.

Skip any inspection observation whose outcome, reason and fingerprints
match the previous inspection's for the same credential. All failed
probes map to the same audit reason, so compare the inspection's own
reason too: a change from unsupported to unavailable is still recorded.
Recording a long-running failure again later, for example once a day,
is left out to keep this simple.

The test now requires that two identical unsupported inspections leave
one row and that a changed failure reason adds one. Both fail with the
change reverted.

Signed-off-by: Tjark Gunnar Rasche <trasche@nvidia.com>

* test(controller): group the inspection audit test helper parameters

gofumpt's extra rules require grouped parameters of the same type, and
lint flagged the helper added by the previous commit.

Signed-off-by: Tjark Gunnar Rasche <trasche@nvidia.com>

* fix(controller): record a repeated inspection until the ledger holds it

The certificate inspection controller skipped an observation that repeated
the previous inspection, but that inspection is committed to the node row
before its best-effort ledger write. When the write failed, every later
identical inspection was skipped, so the ledger held no row for that
credential state until it changed.

Recorder.Record now reports whether the ledger holds the event. The node's
inspection carries AuditRecorded, set by a second small update under
GetNodeForUpdate once all of its events are stored, and a repeat is
skipped only when the previous inspection has it. The update is best
effort: if it fails, the next identical inspection is recorded again, and
the deterministic event ID keeps that idempotent.

This was chosen over querying the ledger for the previous observation's
event IDs because it needs no new query method on the store and no
migration: the field is appended to the existing JSONB inspection.

Signed-off-by: Tjark Gunnar Rasche <trasche@nvidia.com>

* docs(controller): count the retried approval in the CSR audit bound

Signed-off-by: Tjark Gunnar Rasche <trasche@nvidia.com>

* docs(controller): link the credential audit guide from the documents it supports

Signed-off-by: Tjark Gunnar Rasche <trasche@nvidia.com>

* test(controller): keep renewal retry fixtures compatible with audit

Signed-off-by: Tjark Gunnar Rasche <trasche@nvidia.com>

* fix(controller): require a live probe before retiring a lost node

A failed preliminary node lookup or missing agent address previously looked like an agent that did not answer. Lost-node retirement now refuses new retirement unless the live probe actually runs, while already-retired repeats can still resume teardown.

Signed-off-by: Tjark Gunnar Rasche <trasche@nvidia.com>

* docs(credential-audit): prepare T1 evidence before the renewal window

The site certificate-renewal runbook now lists the NVKE checkout and Go
toolchain on the operator machine, and asks for the credential-audit build
and per-step recording in Section 1, before the first node's checks. The
rotation guide's fence overview names retired-node teardown alongside
cluster deletion.

Addresses review threads r4335326733 and r4335327189.

Signed-off-by: Tjark Gunnar Rasche <trasche@nvidia.com>

* fix(controller): tighten credential audit certificate evidence

Reject a certificate PEM bundle whose first block is malformed instead of
fingerprinting the valid certificate pem.Decode skips to. Record
verify/success/observed only for a CSR that NVKE approved, has no Failed
condition, and whose leaf carries the request's public key; a key mismatch
records verify/failure/observation_unavailable. Document that the row does
not authenticate the issuer.

Fixes PR #1378 review findings: F1, F4.

Signed-off-by: Tjark Gunnar Rasche <trasche@nvidia.com>

* fix(controller): record only the key-checked leaf fingerprint for issued CSR certificates

Signed-off-by: Tjark Gunnar Rasche <trasche@nvidia.com>

* fix(controller): mark inspection audit state column-only

markInspectionAuditRecorded wrote the whole node through the wrapped UpdateNode, which enqueues every node controller, for a change to the certificate inspection column only. Use the column-only UpdateNodeCertificateInspection, as the inspection write itself does.

Signed-off-by: Tjark Gunnar Rasche <trasche@nvidia.com>

---------

Signed-off-by: Tjark Gunnar Rasche <trasche@nvidia.com>
2026-10-26 18:56:19 +01:00
Tjark Rasche adeb0c3e1e feat(controller): monitor credential expiry and lifecycle health (#1377)
* feat(controller): monitor credential expiry and lifecycle health

Port the reviewed NKX-15682 inspection RPC, persisted inventory/exporter, direct-API CSR observation and optional alert rules onto the completed rotation layer. Keep monitoring independent of renewal and preserve last-success freshness on failed probes.

Retain ParseConfigFromEnv startup and the unmounted current-main config map; render monitoring fields in both surfaces with parity regressions. Regenerate proto and chart documentation using exact pinned tools.

Sources: c903c3ca2b24b52d3e4dc563e6e6f81ce0e77af3, 12e425e01dcb7a229ab1bf7caf507fdb44e8ff18 and 00a82a9bb8b4d81e98332a2270f04f991cf20188. Inherit rotation safety and deterministic notices without duplicating their changes.

Closes #1345

Signed-off-by: Tjark Gunnar Rasche <trasche@nvidia.com>

* fix(controller): keep certificate observations available across a failed probe

certificate_observation_available used observation.Available, which
reflects only the latest attempt. A failed probe keeps the last good
ObservedAt and certificates, but every per-credential series dropped to
zero, so a firing NVKECertificateExpiring resolved on any transient
failure and agent rollouts made it flap fleet-wide.

Derive certificate_observation_available from the age of the last
successful observation (ObservedAt within observationMaxAge) and keep
certificate_inspection_available tied to the latest attempt. A collector
test covers a failed attempt within and after observationMaxAge, and a
promtool fixture shows the expiry alert staying firing while inspection
is unavailable. The monitoring guide describes both series.

Signed-off-by: Tjark Gunnar Rasche <trasche@nvidia.com>

* fix(controller): inspect certificates with a bounded worker pool

The certificate-inspection controller registered with default options, so
it ran one reconcile at a time, each with a 30s probe deadline.
Unreachable agents are re-probed every 1-32 minutes and held the only
worker, so healthy nodes queued behind them and could age past
observationMaxAge.

Register through dbreconcile.AddController with eight workers, the
agent-readiness controller's default for the same probe pattern. A
manager-level test blocks one node's probe and requires another node to
be inspected meanwhile.

Signed-off-by: Tjark Gunnar Rasche <trasche@nvidia.com>

* ci(chart): assert the credential PrometheusRule is absent when disabled

The default-off and global.monitoring.enabled=false renders were asserted
only by a Go test that skips without helm, and the charts unit lane
installs no helm, so the gate never checked either contract. The
assertions script that chart-check runs with the pinned helm now renders
the whole chart in both cases and fails if a PrometheusRule appears. The
monitoring guide lists the new assertions.

Signed-off-by: Tjark Gunnar Rasche <trasche@nvidia.com>

* ci(chart): pin the PrometheusRule schema and trigger the chart job on its inputs

chart-check validated the rendered PrometheusRule against a schema fetched
from the mutable main branch of datreeio/CRDs-catalog with no digest, so
an upstream change could turn the gate red, or change its result, for an
unchanged commit. Fetch the schema from catalog commit 501527ab and verify
it against a sha256 committed in make/tool-versions.mk, as the promtool
download already is.

The script's pin() helper printed an empty string for a missing or
renamed name, which surfaced only after minutes of 404 retries. Read
promtool and schema pins through hack/read-tool-version.sh, which fails
at once on an unknown name.

The chart.yml push filter did not cover the inputs chart-check now reads,
so a main commit touching only them ran no Chart job. Add
controller/deploy/monitoring/**, make/tool-versions.mk,
hack/check-tool-version.sh and hack/read-tool-version.sh.

Signed-off-by: Tjark Gunnar Rasche <trasche@nvidia.com>

* test(controller): allow repeated certificate-inspection manager setup in tests

controller-runtime keeps a process-wide registry of controller names, so
the manager-level inspection test failed under go test -count=N with
"controller with name certificate-inspection already exists". Keep the
registered name in an unexported field, unchanged in production, and give
the test a unique one.

Signed-off-by: Tjark Gunnar Rasche <trasche@nvidia.com>

* fix(controller): fire credential availability alerts only when monitoring is enabled

All credential rules ship as one PrometheusRule, so the availability rules
cannot be disabled individually. With credentialMonitoring.enabled=false
and alerts enabled, the collector still exports unavailable inspection and
CSR series while the inspector and observer are off, so
NVKECertificateInspectionUnavailable and
NVKEKubeletServingCSRObservationUnavailable fired for every node and
cluster.

Gate both rules on nvke_controller_credential_monitoring_enabled == 1.
Promtool fixtures cover the disabled case and keep the existing firing
cases enabled. The monitoring guide and the credentialMonitoring.enabled
value description state the coupling; the chart README row follows the
value comment.

Signed-off-by: Tjark Gunnar Rasche <trasche@nvidia.com>

* docs(controller): correct credential monitoring schema, CA and threshold notes

- Every run of the alert assertions fetches the pinned PrometheusRule
  schema, so the check is never fully offline; the guide now says so.
- "use manual CA procedure for a CA" pointed nowhere. NVKE ships no CA
  rotation procedure and does not rotate CAs, so the response is to
  escalate, linking the renewal guide that says so.
- thresholdDays was documented as 7 through 90, but with monitoring
  enabled warningDays must exceed it by two renewal intervals, which
  limits it to 44 with the defaults. The values comment, the chart README
  row and the guide's table state the coupling.

Signed-off-by: Tjark Gunnar Rasche <trasche@nvidia.com>

* refactor(controller): append the credential observation fields to their structs

CertificateInspection was inserted before ID in db.Node, and
CredentialCSRs before the existing ClusterConditions fields. Contributor
guidance asks for new fields after existing ones, so move both to the end
of their structs. The JSON and bun column names are unchanged and the tree
has no positional literals of either struct.

Signed-off-by: Tjark Gunnar Rasche <trasche@nvidia.com>

* ci(chart): fail the credential alert absence check when helm fails

The disabled-rule check piped helm template into grep inside an if
condition. set -e does not apply there and pipefail turns a failed render
into a false condition, so a template error in either disabled render
read as "no PrometheusRule" and the check passed.

Render each case to a file under set -e first, then grep the file. With a
helm wrapper that fails only the global.monitoring.enabled=false render,
the script now exits 1; before this change it exited 0.

Signed-off-by: Tjark Gunnar Rasche <trasche@nvidia.com>

* docs(controller): say expiry alerts stop only after observationMaxAge

With monitoring disabled the collector keeps exporting the last
successful observation until it is older than observationMaxAge, so the
expiry and missing-certificate alerts can keep firing for up to that age
(3h by default). The guide said no rule reports them once monitoring is
disabled.

Signed-off-by: Tjark Gunnar Rasche <trasche@nvidia.com>

* test(controller): require concurrent certificate probes regardless of node order

The worker-pool test blocked one named node and required the other to be
inspected meanwhile. With a single worker it failed only when the blocked
node was dequeued first, which depended on ListNodes returning rows in
insertion order, and ListNodes has no ORDER BY.

Block every probe instead and require two probes to be in flight at the
same time. That needs a second worker whichever node comes first. With
inspectionWorkers set to 1 the test fails after 10s.

Signed-off-by: Tjark Gunnar Rasche <trasche@nvidia.com>

* fix(controller): gate stale and failed CSR alerts on credential monitoring

With credentialMonitoring.enabled=false the CSR observer is not registered,
but the collector keeps exporting the last stored CSR inventory and its
pending age keeps growing, so NVKEKubeletServingCSRStale and
NVKEKubeletServingCSRFailed kept firing on a frozen snapshot. Gate both on
nvke_controller_credential_monitoring_enabled like the availability alerts,
and cover the disabled case with a promtool test.

Signed-off-by: Tjark Gunnar Rasche <trasche@nvidia.com>

* build: run chart-check in preflight for credential alert fixtures

controller/deploy/monitoring/credential-alerts-test.yaml is only consumed by
promtool inside chart-check, but preflight did not route that directory to
chart-check, so a fixture-only change skipped it locally.

Signed-off-by: Tjark Gunnar Rasche <trasche@nvidia.com>

* docs(controller): state renewal setting limits in the renewal guide

certRenewal.interval and thresholdDays now have enforced ranges, and with
credential monitoring enabled warningDays must exceed thresholdDays by two
renewal intervals, so installs with thresholdDays above 44 fail to upgrade.
Say so where operators configure renewal and link the monitoring rule.

Signed-off-by: Tjark Gunnar Rasche <trasche@nvidia.com>

* docs(controller): mark the gated CSR alerts in the response table

Signed-off-by: Tjark Gunnar Rasche <trasche@nvidia.com>

* docs(controller): name the credential monitoring ConfigMap as main now does

Main renamed the chart's default controller ConfigMap to
nvke-controller-config, so the guide's lookup for these settings found
nothing on a default install. The guide now names controllerConfig.name
with its default, and the new comments use the current name.

Signed-off-by: Tjark Gunnar Rasche <trasche@nvidia.com>

* fix(credential-monitoring): give kubelet certificates their own expiry alert

The kubelet rotates its client and serving certificates itself at 70-90%
of their lifetime, so NVKECertificateExpiring's warningDays window fired on
healthy rotations. NVKECertificateExpiring now excludes kubelet-client and
kubelet-serving, and the new NVKEKubeletCertificateExpiring rule warns when
either has fewer than a fixed seven days left, which only happens when
kubelet rotation has stopped working. Promtool fixtures cover 40 and 6 days
for both kubelet certificates and a kubeadm leaf inside warningDays.

The monitoring guide also names the metrics NetworkPolicy namespace
requirement and says inspection availability keeps its stored value until
observationMaxAge when monitoring is disabled.

Addresses review threads r4335329332 (seven-day kubelet threshold),
r4335329829 and r4335330237.

Signed-off-by: Tjark Gunnar Rasche <trasche@nvidia.com>

* fix(credential-monitoring): match controller duration bounds and env inventory

Fixes PR #1377 review findings F1 and F2.

F1: the chart compared duration bounds in whole seconds, dropping any
fractional second, while the controller compares exact time.Duration values.
Compare in nanoseconds so the chart refuses exactly what Validate refuses,
and add the sub-second refusals and accept render to the assertions script.

F2: the CREDENTIAL_MONITORING_ENABLED, CERTIFICATE_INSPECTION_INTERVAL,
CERTIFICATE_OBSERVATION_MAX_AGE and CERTIFICATE_WARNING_DAYS variables never
existed, so drop them from controller-config-env.yaml and list their keys in
configMapOnly. The drift test now refuses a key in both. The guide limits the
"no longer reads" sentence to the former CERT_RENEWAL_* variables.

Signed-off-by: Tjark Gunnar Rasche <trasche@nvidia.com>

* fix(credential-monitoring): escalate stuck accepted renewals from alerts

The renewal Stuck and Overdue alerts told operators to confirm termination
and then release ownership or retry. Certificate renewal now treats an
accepted cycle whose Temporal execution has closed as stop-and-escalate:
the lock must not be released, the cycle ID not restarted and no forced
cycle started.

The Stuck alert now asks whether the workflow is still running and, if it
has closed while the cycle is accepted, to stop maintenance and escalate.
The Overdue alert defers to that response when a cycle is still accepted.
The alert table matches, and the Failed row states the full automatic
retry condition. The promtool fixtures carry the new descriptions.

Signed-off-by: Tjark Gunnar Rasche <trasche@nvidia.com>

* docs(credential-monitoring): correct renewal margin, retry and two-voter notes

Signed-off-by: Tjark Gunnar Rasche <trasche@nvidia.com>

* fix(credential-monitoring): write certificate inspection column-only and reject zero observed time

Signed-off-by: Tjark Gunnar Rasche <trasche@nvidia.com>

---------

Signed-off-by: Tjark Gunnar Rasche <trasche@nvidia.com>
2026-10-26 17:08:13 +00:00
Tjark Rasche 9336f06eb4 feat(encryption): add recoverable owned etcd key rotation (#1376)
* feat(encryption): add recoverable owned etcd key rotation

Redistribute reviewed rotation lifecycle, storage-name identity, membership convergence, acknowledged rewrite recovery, loaded-config restart proof and version-gated Begin acceptance from c39e7326. Reuse the renewal foundation admission fences and deterministic notices without duplicating their implementation.

Adapt API descriptions and Kubernetes test dependency pins to current main; retain current-main VIP, nodepool replacement and machine-materialization admissions. Synchronize module manifests and regenerate protobuf, OpenAPI and notices artifacts through pinned Make targets.

Closes #1344

Signed-off-by: Tjark Gunnar Rasche <trasche@nvidia.com>

* docs(encryption): drop database lock release for lost rotation hosts

The documented add_secondary lock release trusted the recorded rotation
phase, but RecordEtcdKeyRotationPhase is not monotonic, so a reset can move
the phase back while nodes already use the new key. Remove the database-edit
exception and keep the lock until the owning workflow completes; a lost host
is restored with the same identity or the cluster is restored from backup.

Signed-off-by: Tjark Gunnar Rasche <trasche@nvidia.com>

* fix(controller): finalize unnamed enablement key under the legacy name

Enablement may reuse a pending key staged before names were recorded and
admits node agents that predate the encryption identity RPC. Finalizing
that key queried every joined control-plane agent and failed on them.
Enablement distributes an unnamed pending key under the legacy name, so
record that name without discovery. Rotation, including rotation histories
recorded before ownership that finalize through the same activity after
EtcdEncrypted is set, keeps discovering the deployed pending name.

Signed-off-by: Tjark Gunnar Rasche <trasche@nvidia.com>

* fix(controller): reject reused workflow ID of a succeeded etcd key rotation

A new execution that reused the workflow ID of a succeeded rotation got
AlreadyCompleted from Begin and returned success without rotating. Begin
succeeds at most once per run, so a succeeded owner can only mean ID reuse;
return the non-retryable rotation precondition error instead. A retry of an
accepted Begin within the same run still finds a running owner and stays
idempotent. The workflow keeps its AlreadyCompleted branch, unchanged, so
recorded histories that carry it replay with their original commands.

Signed-off-by: Tjark Gunnar Rasche <trasche@nvidia.com>

* docs(agent): state the actual UpdateEncryptionConfig error codes

The contract said FailedPrecondition meant only a missing config and that
other codes left no partial state. The agent also returns Canceled,
Unavailable, and FailedPrecondition for a stale WAL entry, a config the
apiserver has not loaded, and config or ownership changes, and it retains
the WAL entry for a retry of the same operation. List the codes and drop
the no-partial-state guarantee. Comment-only; *.pb.go regenerated.

Signed-off-by: Tjark Gunnar Rasche <trasche@nvidia.com>

* docs(controller): note that a prepare failure releases the rotation lock

EtcdKeyRotationStatus said every failed rotation retains UpdateInProgress.
FailEtcdKeyRotation clears it for a prepare-phase failure; only failures
after prepare retain it.

Signed-off-by: Tjark Gunnar Rasche <trasche@nvidia.com>

* fix(controller): give a failed encrypted-object rewrite a fixed remedy

The rewrite activity clears ErrorMessage so agent errors that can echo
rejected Secret bodies never reach workflow history, which left the
workflow error as "encrypted-object rewrite failed: ". Return a fixed,
secret-free message pointing at the node rewrite state instead.

Signed-off-by: Tjark Gunnar Rasche <trasche@nvidia.com>

* fix(controller): refuse etcd key rotation until control-plane nodes run the cluster's Kubernetes version

PATCH records the desired Kubernetes version before the control-plane
upgrade marks ControlPlaneUpgrading, so Begin could accept a rotation
while every node still ran 1.33. add_secondary then failed for lack of the
encryption-config reload metric and the retained lock blocked the upgrade.

Begin now compares each control-plane node's pinned configuration version
with the cluster version and refuses, before taking the lock, when any node
differs or its version cannot be determined.

Signed-off-by: Tjark Gunnar Rasche <trasche@nvidia.com>

* fix(controller): complete legacy etcd key rotations on agents without key identity

A rotation started by the previous controller (no workflow owner) keeps
its node agents, because agent upgrades are refused while it holds the
mutation lock. After the controller upgrade, every rotation-phase node
call and its finalization required GetEtcdEncryptionKeyIdentity. Agents
without that RPC therefore failed the run, and the legacy failure path
released the lock while nodes could already write with the pending key.

Restore the original protocol for that case. A pending key with no
recorded name was staged by the earlier controller. Its node mutations
skip the identity RPC and send the request unnamed, as before: the agent
derives the name on add and matches the key by its bytes afterwards.
Legacy finalization makes the key active without recording or guessing a
name and drops the stale active name. The next init, join or rotation
discovers the name. Named pending keys, and every owned rotation, still
verify identity before each mutation. Enablement finalization still
records the legacy bootstrap name.

Signed-off-by: Tjark Gunnar Rasche <trasche@nvidia.com>

* fix(controller): require agent success status for etcd rotation membership gate

The node agent reports scripts it cannot start (for example EACCES) with
status "error" and exit code 0. Require the "success" status so the
membership gate never passes without a live check before old-key removal.

Signed-off-by: Tjark Gunnar Rasche <trasche@nvidia.com>

* docs(controller): pass the required --reason to the etcd rotation reset example

Signed-off-by: Tjark Gunnar Rasche <trasche@nvidia.com>

* docs(controller): bound etcd rotation resets by Temporal history retention

Signed-off-by: Tjark Gunnar Rasche <trasche@nvidia.com>

* fix(agent): match UpdateEncryptionConfig error codes to the documented list

A pre-write reload baseline that cannot read apiserver metrics now returns
Unavailable; nothing was written, so a retry is safe. A failed WAL removal
after confirmation returns Internal at once instead of being retried as a
metrics outage and reported as Unavailable.

Signed-off-by: Tjark Gunnar Rasche <trasche@nvidia.com>

* fix(controller): tell callers to start a new etcd rotation after a prepare failure

A prepare failure already released the rotation lock, so no reset of that
workflow can succeed. Begin now directs the caller to start a new rotation
with a new workflow ID instead of resetting the failed phase.

Signed-off-by: Tjark Gunnar Rasche <trasche@nvidia.com>

* fix(controller): retry retry-safe UpdateEncryptionConfig errors in key rotation

Every rotation UpdateEncryptionConfig error became FailedNotRestored, and
ApplyToNode returns outcomes rather than activity errors, so nothing
retried a node mutation. A transient Unavailable or DeadlineExceeded,
which the RPC contract calls safe to retry, failed the phase and kept the
lock until an operator reset the workflow.

Retry those two codes up to three times per node with a doubling backoff
from 5s, stopping when the context ends. Each attempt can wait about two
minutes for the reload, so the budget fits in the eight-minute
ApplyToNode activity timeout. Every other code still fails at once. The
guide now says what the automatic retry covers.

Signed-off-by: Tjark Gunnar Rasche <trasche@nvidia.com>

* docs(controller): correct etcd key rotation recovery, backup and agent boundary

Three guide corrections from review:

- A terminated or timed-out owner never runs its failure cleanup, so
  state stays running and the lock stays held in any phase, prepare
  included. Begin refuses a new workflow ID then; recovery is resetting
  that same workflow ID. The prepare row and the recovery intro now say
  so.
- Finalization replaces active and active-name and keeps no prior key, so
  operators must retain the current key Secret with their etcd backups
  before starting; the guide says to copy the Secret object into the
  backup store without printing its data.
- agent/v0.3.0-rc.2 also lacks GetEtcdEncryptionKeyIdentity, so it is
  now the named boundary.

Signed-off-by: Tjark Gunnar Rasche <trasche@nvidia.com>

* docs(agent): describe the current encryption rotation WAL protocol

The encRotationWALFile and commitConfigWrite comments still described a
reload-counter snapshot. The WAL now records only the operation id, and
the write first checks that the apiserver's loaded-config identity matches
the current on-disk config. Comments only.

Signed-off-by: Tjark Gunnar Rasche <trasche@nvidia.com>

* fix(controller): point a prepare-phase etcd rotation failure at a new workflow

After a prepare failure the rotation lock is already released and Begin
refuses a reset of that owner, yet updateFailed still told the operator to
recover the owning workflow. For prepare it now says to fix the
prerequisite and start a new rotation with a new workflow ID; later
phases keep the recover-the-owner message.

Signed-off-by: Tjark Gunnar Rasche <trasche@nvidia.com>

* test(controller): require bash and jq before the rotation membership probe test

The probe test ran host bash and jq with no precondition, and the probe
discards stderr, so without jq the converged case failed with a bare exit
status and the negative cases passed for the wrong reason. Skip when
either tool is missing, as the certificate-renewal runbook harness does.

Signed-off-by: Tjark Gunnar Rasche <trasche@nvidia.com>

* docs(controller): back up the old storage name when the key Secret lacks it

The guide told operators to copy the key Secret before a rotation because
its active and active-name fields hold the key and its storage name. A
Secret from before storage names were recorded, or one last rotated by
an earlier controller, has no active-name, so that copy cannot restore
a pre-rotation snapshot whose ciphertext carries the old name.

The workflow records the old key's storage name in active-name before
it enters add_secondary and keeps the old key in active until finalize.
Tell operators to copy the Secret again in that window when the first
copy has no active-name.

Also say that a node key update makes up to three attempts, which is
what the code does, instead of "retries up to three times".

Signed-off-by: Tjark Gunnar Rasche <trasche@nvidia.com>

* docs(agent): say what defaultReloadPollInterval polls

The interval is used to poll the apiserver encryption metrics, both the
loaded-config identity during a key update and the reload counter during
enablement, not only the reload counter.

Signed-off-by: Tjark Gunnar Rasche <trasche@nvidia.com>

* fix(controller): record the active key name when rotation reuses a pending key

Signed-off-by: Tjark Gunnar Rasche <trasche@nvidia.com>

* docs(api): point control-plane 409s at the etcd key rotation runbook

Signed-off-by: Tjark Gunnar Rasche <trasche@nvidia.com>

* docs(controller): name the NVKE controller in the etcd key rotation runbook

Signed-off-by: Tjark Gunnar Rasche <trasche@nvidia.com>

* fix(controller): tolerate an old key already removed from some nodes when reusing a pending key

Signed-off-by: Tjark Gunnar Rasche <trasche@nvidia.com>

* docs(controller): say an old key removed from every node needs an earlier backup

When rotation reuses a pending key and no control-plane node still has
the old key, no node records its storage name either, so a node's
encryption config cannot replace the backup. Also drop an unreachable
error check: the pending-key lookup just above already returns those
errors.

Signed-off-by: Tjark Gunnar Rasche <trasche@nvidia.com>

* fix(agent): replace a stale encryption config when bootstrapping a reset node

kubeadm reset removes the static pod manifests, PKI, kubeconfigs and the
etcd data directory, but leaves /etc/kubernetes/kube-api-encryption behind.
Init or join after a reset, or on a reused host, then failed the storage
identity check with "renaming a storage key is unsafe" before kubeadm ran.

kubeadm init and join now replace an existing config whose key identity
conflicts when no local data can depend on it: /var/lib/etcd/member is
absent or empty and /etc/kubernetes/manifests/kube-apiserver.yaml is
absent. If either exists, the rename check still applies. The
enable-encryption RPC keeps the check unconditionally. A replacement is
logged with SHA-256 key digests only.

The agent does not receive the etcd dataDir. It checks kubeadm's default
/var/lib/etcd, which is also what the controller renders
(kubeadmconfig defaultEtcdDataDir).

Signed-off-by: Tjark Gunnar Rasche <trasche@nvidia.com>

* fix(controller): preserve legacy pending-key staging on redelivery

Legacy rotation histories may persist an unnamed pending key before losing the staging activity acknowledgement. Redelivery under the legacy etcd_encryption lock now reuses that key without the identity RPC, while owned rotations still prove pending-key identity.

Signed-off-by: Tjark Gunnar Rasche <trasche@nvidia.com>

* docs(etcd-encryption): point PATCH conflicts at rotation recovery

A failed etcd key rotation keeps the etcd_key_rotation lock, so the
updateCluster description, its 409 response, the runtime 409 message and
the troubleshooting entry now point to phase-aware recovery. The rotation
guide names the Temporal namespace, task queue, address and TLS settings
the way the certificate-renewal guide does.

Addresses review threads r4335392969 and r4335393460.

Signed-off-by: Tjark Gunnar Rasche <trasche@nvidia.com>

* fix(etcd-encryption): guard host verifier test and document rotation lock retention

Review fixes for PR #1376:

- F3: skip TestEtcdKeyRotationVerifierRequiresExistingSecretRewriteAndConvergence
  when sha256sum is not on PATH, matching the runbook membership test, instead
  of failing with a misleading verifier error.
- F5a: the troubleshoot 409 cause and step-1 list, the create.md Updating row
  and the observe.md checklist now name a failed etcd key rotation that
  retained updateInProgress (type=etcd_key_rotation, etcdKeyRotation.state=failed)
  and link to phase-aware recovery.

Signed-off-by: Tjark Gunnar Rasche <trasche@nvidia.com>

* docs(etcd-encryption): cover closed running rotation owners and bound their reset

Signed-off-by: Tjark Gunnar Rasche <trasche@nvidia.com>

---------

Signed-off-by: Tjark Gunnar Rasche <trasche@nvidia.com>
2026-10-26 09:52:24 -07:00
Tjark Rasche c04c118fc0 feat(controller): harden rolling certificate renewal and admission (#1375)
* build(agent): preserve deterministic notice attribution for renewal checks

Reuse the reviewed deterministic notices generator and regression fixtures from c39e7326. URL discovery must not change linked-module attribution or drop saved license and NOTICE texts. Regenerate the index for current-main dependencies without changing the dependency graph.

Signed-off-by: Tjark Gunnar Rasche <trasche@nvidia.com>

* feat(controller): harden certificate renewal and fence control-plane mutations

Rebase the reviewed renewal foundation from 6cb2c325 (#967) onto current main and retain rollout-adapter compatibility from 5621b713. Move the shared cluster-row admission safeguards from a1e46d20/c1643fca/cb63cb35 into this bottom layer, covering both acceptance orders and retained failed renewal ownership.

Keep current-main OIDC provider pinning, VIP replacement constraints, nodepool reconciliation, NICo behavior and whole-row condition locking. Rotation-specific lifecycle, RPCs and audit remain in later stack layers. Regenerate protobuf and OpenAPI output; conform new schemas to current lint conventions.

Signed-off-by: Tjark Gunnar Rasche <trasche@nvidia.com>

* fix(controller): retain provisioning intent during pre-join cleanup

Classify etcd removal and kubeadm reset from the locked node lifecycle after taking the cluster admission lock. Reserve Provisioning for an unjoined node without teardown intent, and retain Deleting for joined, requested or in-progress teardown. CAPI machine deletion remains unconditionally destructive, including before a first join. Keep existing Temporal commands and payload semantics unchanged.

Exercise real cleanup activities and persisted completion updates with stateful stores: fresh and retried cleanup, unknown RPC results, locked-state classification, both credential admission orders, successful renewal admission after completion, and the next serial control-plane join. Align the existing admission fixture with current main’s added controller reader parameter.

Signed-off-by: Tjark Gunnar Rasche <trasche@nvidia.com>

* fix(controller): leave queued deletion promotion to the reconciler

An accepted DeleteRequested on an unjoined node is not a started teardown. Keep the request and provisioning reservation during pre-join cleanup under the existing cluster-first/node-second locks; leave Deleting and its outbox entry paired in StartRequestedTeardown. Retain real teardown, CAPI deletion and uncertain-RPC fences without changing Temporal payloads or commands.

Exercise real request admission, cleanup and completion activities, then full controller reconciliation and teardown outbox contents with stable, queued and deleting siblings. Cover locked stale lifecycle state and queued versus started deletion on successful and uncertain RPCs. The final regression compiles and fails against the rebased helper before this fix and passes after it.

Adapt the inherited renewal failure log to golangci-lint 2.14.0 by checking the nullable UUID before logging its Stringer value. Full preflight on captured main 7ce1352d and required module, generation, API v0.0.28, race, notices, docs, workspace, license and build checks pass.

Signed-off-by: Tjark Gunnar Rasche <trasche@nvidia.com>

* fix(controller): accept a missing super-admin.conf on joined control-plane nodes

kubeadm v1.34 lists super-admin.conf in certs check-expiration and reports it
as missing on every node that joined the control plane, because kubeadm join
never writes it. Both expiry parsers treated that row as fatal, so CHECK_ONLY
failed and every non-forced cycle on a multi-node control plane failed hourly.

Skip only the exact `!MISSING! super-admin.conf` row in the runbook and the
agent parser; any other missing certificate still fails closed. Add parser
cases for fresh and due joined nodes, runbook cases for renewal and check-only
selection, and a non-forced cycle on the three-node e2e control plane before
the forced one.

Signed-off-by: Tjark Gunnar Rasche <trasche@nvidia.com>

* fix(controller): finish pending legacy-runbook restarts on the legacy executor

CHECK_ONLY reported RENEWAL_REQUIRED=true for the runbook's own renewing or
restart_pending phase, and the workflow then dispatched the typed V2 RPC. The
agent never reads the runbook phase file, so a fresh non-forced cycle returned
unchanged and advanced nextCertRenewalDue while components after the failed
restart kept their old in-memory certificates.

Report runbook intent as RENEWAL_REQUIRED=legacy. The check activity now
returns whether renewal is required and whether the legacy executor must
resume it, and the workflow sends that node straight to the legacy runbook,
which completes the remaining restarts before clearing its phase. Agent-side
intent still goes to the typed executor. Cover runbook check-only output, the
activity result and a workflow cycle with runbook restart_pending intent on a
V2-capable agent.

Signed-off-by: Tjark Gunnar Rasche <trasche@nvidia.com>

* fix(controller): retry transient status errors while resolving a node renewal

Resolution returned on the first GetKubernetesCertificateRenewalStatus error,
and the workflow runs it once, so an agent restart or network blip right after
a node failure retained the cluster mutation lock even when the agent reported
a terminal status seconds later.

Within the five-minute cleanup budget, keep polling through transport errors
without a gRPC status and Unavailable or DeadlineExceeded responses. NotFound,
Unimplemented and other agent answers stay conclusive, and the lock is retained
only when no matching terminal status arrives by the deadline. Test one failed
status call followed by a terminal failure, and a persistent error.

Signed-off-by: Tjark Gunnar Rasche <trasche@nvidia.com>

* test(agent): report failing notices generator assertions

Give each bare grep -q assertion in test-generate-notices.sh an explicit ERROR message so a regression does not fail the gate silently under set -e.

Signed-off-by: Tjark Gunnar Rasche <trasche@nvidia.com>

* docs(controller): note retained renewal lock in 409 responses

The control-plane mutation 409 message and the deleteNodePool/deleteNode descriptions told clients to retry after the operation completes. A failed certificate renewal can retain the lock until an operator clears it; say so and point to the recovery procedure in controller/docs/certificate-renewal.md.

Signed-off-by: Tjark Gunnar Rasche <trasche@nvidia.com>

* docs(controller): note refused renewal cycles record startedAt without the lock

Refused certificate renewal cycles (admission, two-control-plane-voters) set startedAt but never take the cluster mutation lock. Clarify the CertificateRenewalStatus.startedAt description and regenerate the API code.

Signed-off-by: Tjark Gunnar Rasche <trasche@nvidia.com>

* fix(controller): refuse certificate renewal while a node reservation is held

Begin now records an admission refusal while cluster.CertificateRenewal is set. Resolve releases the matching reservation after confirmed terminal evidence, and the reconciler clears a fenced (V2) reservation the agent reports as NotFound or Unimplemented once no cert_renewal lock is held.

Signed-off-by: Tjark Gunnar Rasche <trasche@nvidia.com>

* docs(controller): direct two-node control planes to scale to three for renewal

A healthy two-node control plane cannot scale down to one: the controller only scales up and refuses deleting a healthy node below three survivors. Point the refusal message and guide at three or more nodes.

Signed-off-by: Tjark Gunnar Rasche <trasche@nvidia.com>

* docs(controller): clarify cert renewal retry waits for due time

A failed renewal does not move nextCertRenewalDue, and the controller checks the due time before the one-hour failure backoff. Document that automatic retries run only after both have passed.

Signed-off-by: Tjark Gunnar Rasche <trasche@nvidia.com>

* fix(controller): finish pending cert-renewal restarts of both executors in one cycle

When both the legacy runbook phase file and the agent's k8sCertRenewalState hold renewing/restart_pending intent, the check-only mode now reports legacy_then_typed. The workflow then runs the legacy executor and, behind the same kube-vip drain, the typed executor, so the agent's pending restart no longer waits a full renewal interval.

Signed-off-by: Tjark Gunnar Rasche <trasche@nvidia.com>

* test(controller): cover legacy cert-renewal intent on single node and on failure

Run the pending legacy-intent test against one and three control-plane nodes (two is refused by production Begin) so the single-node no-drain path is covered, and add a failure case asserting cleanup resolves the legacy operation.

Signed-off-by: Tjark Gunnar Rasche <trasche@nvidia.com>

* fix(controller): decode legacy bool cert-renewal check results on replay

Earlier heads of this change returned a bare bool from CheckKubernetesCertificateRenewalRequired. Accept that recorded payload when decoding the struct result so in-flight RenewK8sCertsV2 histories still replay; true maps to Required.

Signed-off-by: Tjark Gunnar Rasche <trasche@nvidia.com>

* fix(controller): note retained renewal lock in cluster update 409

A failed certificate renewal can keep the cluster mutation lock after the cycle ends. The PATCH /clusters/{clusterID} description, its 409 response and the certificate_renewal conflict message now say so and point to the retained-lock recovery procedure, matching the delete endpoints.

Signed-off-by: Tjark Gunnar Rasche <trasche@nvidia.com>

* docs(controller): document the node reservation blocking cert renewal retry

Admission refuses renewal while clusters.certificate_renewal is set. List that refusal and tell operators to check the column before expecting a retry after clearing a retained lock.

Signed-off-by: Tjark Gunnar Rasche <trasche@nvidia.com>

* fix(controller): keep two-voter renewal halt while desired count is below three

A two-node control plane cannot scale down to one, so desiredCount 1 must not restart the hourly two-voter refusal loop. Halt while desiredCount < 3 and flip the scaled-to-one test case.

Signed-off-by: Tjark Gunnar Rasche <trasche@nvidia.com>

* test(controller): assert unchanged outcome after non-forced e2e cert renewal

The non-forced e2e step only checked that static-pod containers kept their IDs. Read the cluster's certificateRenewal condition and require this cycle to have succeeded with outcome unchanged, so a cycle that renews without restarting pods fails.

Signed-off-by: Tjark Gunnar Rasche <trasche@nvidia.com>

* test(controller): cover cert renewal table with only missing super-admin.conf

A kubeadm expiration table whose only leaf row is the tolerated '!MISSING! super-admin.conf' has no certificate to judge; assert the runbook fails closed in renewal and check-only modes. Also cover tabwriter trailing padding on a leaf row. The script already handles both (seen == 0 exits 2); no script change.

Signed-off-by: Tjark Gunnar Rasche <trasche@nvidia.com>

* test(controller): make persistent cert renewal status retry case deterministic

Cancel the resolve context from the status hook instead of relying on a 50ms deadline, so the case no longer depends on the first status call finishing before the deadline under load.

Signed-off-by: Tjark Gunnar Rasche <trasche@nvidia.com>

* test(controller): cover cert renewal reservation replaced under the row lock

Add cases where the locked cluster row holds a different renewal reservation (another operation or node) than the status-RPC snapshot, and assert clearAbsentCertificateRenewal keeps it.

Signed-off-by: Tjark Gunnar Rasche <trasche@nvidia.com>

* fix(controller): keep resolving cert renewal when release fails after termination

Once terminal status confirms the operation ended, a failed reservation release is logged instead of failing Resolve, so the workflow no longer retains the cluster mutation lock; the reconciler clears the reservation. Status polling also stops with time left so the release does not run on an expired context.

Signed-off-by: Tjark Gunnar Rasche <trasche@nvidia.com>

* fix(controller): keep V1 cert renewal from adopting a fenced reservation

A V1 RenewK8sCerts history never takes the cert_renewal lock, so reattaching to a fenced V2 reservation on its node let the reconciler clear that reservation while V1 work ran. V1 now treats a fenced same-node reservation as busy and waits.

Signed-off-by: Tjark Gunnar Rasche <trasche@nvidia.com>

* fix(controller): refuse certificate renewal only for fenced reservations

A leftover unfenced V1 reservation is never cleared by the reconciler when the agent lacks the typed RPC, so refusing on it blocked every later cycle. Begin now refuses only fenced reservations; dispatch reattaches an unfenced one on the same node and refuses as not-dispatched on another node, as before.

Signed-off-by: Tjark Gunnar Rasche <trasche@nvidia.com>

* docs(controller): limit the reservation refusal to fenced reservations

Admission refuses only fenced (current-workflow) reservations; a leftover V1 reservation is reattached by the next cycle on the same node.

Signed-off-by: Tjark Gunnar Rasche <trasche@nvidia.com>

* fix(controller): admit direct legacy cert renewal like typed renewal

A node whose expiry check selected the legacy runbook was dispatched without the reservation checks, so the runbook could restart static pods on a node marked for repair, recycling or deletion, or in a deleting cluster. V2 legacy dispatch now reserves the node first, reports a refusal as CertificateRenewalNotDispatched so the cycle releases its lock without resolution, and releases the reservation once the receipt confirms termination.

Signed-off-by: Tjark Gunnar Rasche <trasche@nvidia.com>

* fix(controller): release the V1 renewal reservation after a failed Start

V1 histories never run Resolve and the reconciler keeps unfenced reservations, so a failed V1 Start kept clusters.certificate_renewal set and blocked node-agent upgrades. Release it as main did; V2 keeps the reservation for Resolve.

Signed-off-by: Tjark Gunnar Rasche <trasche@nvidia.com>

* fix(controller): let status-only cert renewal abandon on a fresh node

Status-only resolution opened the lock read-only, so on a node where the runbook never ran it failed before recording the abandoned receipt, leaving the certificate_renewal lock held. Create STATE_DIR (0700) and open the lock for append without truncating, and cover the no-state-directory case.

Signed-off-by: Tjark Gunnar Rasche <trasche@nvidia.com>

* docs: note two-node control planes are excluded from cert renewal

State in the desiredCount row and the tenant admin.conf description that a cluster with exactly two control-plane nodes is not renewed automatically, matching the two-control-plane-voters refusal.

Signed-off-by: Tjark Gunnar Rasche <trasche@nvidia.com>

* fix(controller): refuse V2 cert renewal on a node with a V1 reservation

Since admission stopped refusing unfenced reservations, a V2 cycle that
reached the node holding a V1 workflow's reservation reattached to it and
ran under the V1 operation ID. Workflow cleanup still polled the cycle's
own operation ID, got NotFound and kept the cluster mutation lock, and the
cycle could record the V1 outcome without renewing anything.

A V2 request now never adopts an unfenced reservation. It is refused like
a reservation on another node, so the first attempt reports
CertificateRenewalNotDispatched and the cycle releases its lock. V2 still
reattaches to its own fenced reservation on retry, and V1 still reattaches
to an unfenced one.

Signed-off-by: Tjark Gunnar Rasche <trasche@nvidia.com>

* fix(controller): release the V1 cert renewal reservation on every failed dispatch

V1 workflows never run Resolve, and the reconciler clears an unfenced
reservation only once the agent reports that operation terminal. Two V1
failures still kept the reservation, which then blocked node-agent
upgrades with nothing to clear it: the inline legacy fallback failing with
anything other than a RunbookError (for example a transport error), and a
Start that returned no operation.

Release on both, as main does, through the same releaseAfterFailedStart
helper main uses; release failures are joined into the returned error.
This deliberately accepts that a legacy script may still be running after
a transport error, which main already accepts on the V1 path. Status-poll
errors after the agent accepted typed work still keep the reservation, as
on main, because that work may still be running and the reconciler clears
it on terminal status. V2 behavior is unchanged.

Signed-off-by: Tjark Gunnar Rasche <trasche@nvidia.com>

* docs(controller): say a V2 cycle refuses a node with a V1 reservation

The guide and the admission comment still said the next cycle reattaches
to a reservation left by a V1 workflow. A V2 cycle now refuses that node
without dispatch, fails and retries after the backoff, and the V1 activity
releases its own reservation when it ends unless the agent accepted the
work and stopped answering, in which case the reconciler clears it once
the agent reports it terminal.

Signed-off-by: Tjark Gunnar Rasche <trasche@nvidia.com>

* fix(controller): version the typed dispatch after a legacy cert renewal

Finishing pending restarts of both executors in one cycle added a typed
RenewKubernetesCertificates dispatch after a successful legacy run when
the check reports legacy_then_typed. The check can return that only since
the same change, but a cycle started on an old worker can still be
mid-flight during a deploy, and its history has no such activity, so a
new worker could not replay it.

Guard the second dispatch with a new GetVersion change ID,
certificate-renewal-typed-after-legacy. At DefaultVersion the node keeps
the legacy result, as before. GetVersion runs only on the path that would
dispatch, so histories that never reach it are unaffected.

The repository has no recorded-history replayer test, so the workflow
test stands in for replay: it pins OnGetVersion to DefaultVersion and
asserts no typed dispatch, and to version 1 and asserts the typed run and
the outcome merge.

Signed-off-by: Tjark Gunnar Rasche <trasche@nvidia.com>

* fix(controller): let malformed agent state not block a pending legacy resume

The check-only mode of the renewal runbook parsed the node-agent
state.json, and died on a parse error or an unknown state, before it
looked at its own persisted phase. A node whose runbook was left in
renewing or restart_pending then failed every expiry check, so the legacy
executor, the only one that can finish those restarts, was never
dispatched.

When the runbook has pending intent, an unreadable or unknown agent state
is now logged to stderr and the check reports RENEWAL_REQUIRED=legacy;
stdout stays exactly the marker line. Without pending runbook intent the
check still fails closed, as before.

Signed-off-by: Tjark Gunnar Rasche <trasche@nvidia.com>

* fix(controller): retry the cert renewal release after a successful legacy run

After a legacy run succeeded, a single failed releaseCertificateRenewal
left the node reservation set. On V2 the activity logs it and returns the
result, but the cycle's next node is then refused as busy and the cycle
fails until the one-hour backoff passes; on V1 the activity fails.

Retry the release up to three times, waiting 1s and then 2s, and stop
early when the context ends. The retry lives in one helper used by both
legacy success paths. After the last attempt the existing behavior stays:
V2 logs a warning and returns the result, V1 returns the error. The
backoff is a package variable so the tests run fast.

Signed-off-by: Tjark Gunnar Rasche <trasche@nvidia.com>

* fix(controller): satisfy lint in cert renewal release retry and replay test

The release retry kept its backoff in a package variable, which
gochecknoglobals rejects, and the version-marker test helper did not call
t.Helper(). Move the attempt count and initial backoff into the existing
constant block (three attempts, 1s doubling to 2s) and mark the helper.
The retry test now waits the real backoff, a few seconds in total.

Signed-off-by: Tjark Gunnar Rasche <trasche@nvidia.com>

* fix(controller): refuse a V1 reservation on V2 retries too

A V2 cert renewal that found an unfenced V1 reservation on its node
returned CertificateRenewalNotDispatched only on the first attempt. If
attempt 1 failed before reserving, for example on a transient database
error, and a V1 workflow reserved the node in between, later attempts
returned a plain retryable error. The cycle then treated the node as
pending, Resolve on its own operation ID got NotFound, and the cluster
mutation lock stayed held.

V2 writes only fenced reservations, and the reconciler clears a fenced
one only after the lock is released. An unfenced record on the node
therefore means this cycle holds no reservation there, so refusing it
as not dispatched is safe on every attempt.

The activity test environment always runs attempt 1, so the new retry
rows run the activity in a workflow test environment with a retry policy
and fail the first reservation transaction.

Signed-off-by: Tjark Gunnar Rasche <trasche@nvidia.com>

* docs(controller): say when a V1 cert renewal reservation needs a manual clear

The guide said any leftover V1 reservation is cleared automatically once
its node operation has ended. That is not true. An interrupted V1 activity,
a failed release or an agent without the typed status RPC can leave an
unfenced reservation, and the reconciler clears an unfenced record only
when the agent reports the operation finished or the node row is gone.
NotFound and Unimplemented leave it in place.

Describe those cases and the operator procedure: confirm that the runbook
has stopped on the node, then clear the column under the cluster row lock
after checking that it still holds the same node and operation ID.

Signed-off-by: Tjark Gunnar Rasche <trasche@nvidia.com>

* test(controller): skip the real release backoff in the retry test

TestLegacyRenewalSuccessRetriesRelease waited the real 1 s and 2 s
release backoff in every case, about 8 s per run and more under
-count. The backoff is a const to keep gochecknoglobals clean, so an
unexported field on Activities now overrides the first wait when
non-zero, and the test sets it to a millisecond. Production code leaves
it zero and keeps the const.

Signed-off-by: Tjark Gunnar Rasche <trasche@nvidia.com>

* docs: explain Updating status for a failed certificate renewal that kept the lock

A failed certificate renewal whose node work was not confirmed terminal
keeps updateInProgress=certificate_renewal, which nvkectl shows as
Updating. Say so in both STATUS descriptions and link the recovery steps.

Signed-off-by: Tjark Gunnar Rasche <trasche@nvidia.com>

* docs: say an existing two-node control plane must scale to three

The controller only adds control-plane nodes and refuses to delete below
three, so a two-node cluster cannot move to one. Certificate renewal
resumes only once desiredCount is three or more.

Signed-off-by: Tjark Gunnar Rasche <trasche@nvidia.com>

* docs(controller): name the NVKE controller and its ConfigMap in the renewal guide

Replace the old CWE name with the NVKE controller and refer to the chart's
default ConfigMap, nvke-controller-config.

Signed-off-by: Tjark Gunnar Rasche <trasche@nvidia.com>

* docs: name the retained renewal lock field as the API exposes it

Signed-off-by: Tjark Gunnar Rasche <trasche@nvidia.com>

* fix(controller): preserve renewal executor ownership across retries

Signed-off-by: Tjark Gunnar Rasche <trasche@nvidia.com>

* fix(controller): use embedded legacy renewal runbook for V2 dispatch

V2 legacy fallback relies on the embedded runbook lock and operation receipts to prove termination before releasing ownership. Configured overrides cannot be assumed to participate in that protocol, so V2 now dispatches only the embedded runbook while V1 keeps its existing override behavior.

Signed-off-by: Tjark Gunnar Rasche <trasche@nvidia.com>

* fix(controller): release the renewal lock when a pre-V2 agent holds typed intent

A node whose agent predates certificate renewal V2 can still record an interrupted typed renewal. V2 Start returns Unimplemented, which proves no typed work was accepted, but the workflow kept the operation pending, the old agent answered NotFound to the status check, and the cycle retained the cluster mutation lock. That also blocked the agent upgrade that would let the typed renewal finish.

New histories now fail the cycle with a message to upgrade the node agent and release the lock without resolving the never-accepted operation. A Temporal change ID keeps earlier histories on the previous path.

Signed-off-by: Tjark Gunnar Rasche <trasche@nvidia.com>

* test(controller): expect the fence reads in no-VIP remediation

Remediating a control-plane node reads the node and locks its cluster to check the control-plane mutation fence before deleting. The no-VIP remediation test added on main predates that fence, so its override case did not expect those reads.

Signed-off-by: Tjark Gunnar Rasche <trasche@nvidia.com>

* docs(api): wrap the merged deleteNode VIP sentence

Wrap the deleteNode description line that combined the no-VIP development override from main with the stack's mutation-lock note, matching the surrounding wrapping. The embedded spec in the regenerated server code no longer contains an encoded run that the name check misreads as the old product name.

Signed-off-by: Tjark Gunnar Rasche <trasche@nvidia.com>

* fix(controller): restart terminated accepted scheduled renewal cycles

An accepted scheduled certificate-renewal cycle whose Temporal execution
was terminated or timed out kept the cluster mutation lock indefinitely.
The controller now starts the recorded cycle ID again with USE_EXISTING /
ALLOW_DUPLICATE_FAILED_ONLY, so the new run re-enters the cycle and
reattaches to the recorded node operation. Accepted forced cycles still
defer; the guide documents their manual recovery as the exception to
using a new workflow ID for every forced run.

The guide no longer claims every failure path restores the active
manifest, and states that a leftover V1 reservation refuses the first
node needing renewal, whichever node it names.

Fixes review findings for #1375: F2, F3 (option A), and DECISIONS #5.

Signed-off-by: Tjark Gunnar Rasche <trasche@nvidia.com>

* fix(controller): escalate stranded accepted renewal cycles

Re-dispatching an accepted scheduled cycle under its recorded ID was not
safe: the new run re-enters Begin indistinguishably from fresh admission,
can fail before reattaching the node reservation and then release the
mutation lock while the old run's node or kube-vip work may still be
outstanding.

The reconciler again requeues an accepted cycle without dispatching it
and defers whenever the mutation lock is held. An accepted cycle whose
Temporal execution has closed stays halted with ownership intact and
needs operator escalation. The guide drops the same-ID restart recipe
for scheduled and forced cycles, states what evidence an escalation
needs, and keeps the failed-cycle recovery procedure unchanged.

Tests observe each accepted case twice and assert no workflow start and
no database write; dispatch and released-failure retries are checked for
stable IDs across repeated observations.

Signed-off-by: Tjark Gunnar Rasche <trasche@nvidia.com>

* docs(controller): correct certificate-renewal recovery and failedNodeID wording

Signed-off-by: Tjark Gunnar Rasche <trasche@nvidia.com>

---------

Signed-off-by: Tjark Gunnar Rasche <trasche@nvidia.com>
2026-10-26 14:57:18 +00:00
Abhay Krishna ddab4187b5 feat: read API authentication from apiAuth first (#1935)
Prepare for apiAuth in nvke-controller-config to be the only source of
the NVKE API authentication configuration. Nothing here is breaking;
retiring AUTH_CONFIG_PATH and the external-ConfigMap mode follows once
an nvkectl with this change is released.

- nvkectl, the e2e token helper and hack/nvke-token.sh read apiAuth
  from nvke-controller-config first and fall back to the
  authentication ConfigMap when the section is off or absent.
- permissiveMode moves to apiAuth.permissive, beside the rest of the
  section and matching the Helm value. A config.yaml that still sets
  the top-level key is refused with an error naming the new one.
- Issuers take an inline jwks.caBundle as an alternative to
  caBundlePath, so a private CA no longer needs a file mounted from
  nvke-auth-config.
- Tilt and the CAPNICo e2e path render the configuration from chart
  values, as CAPD already does, and their nvke-auth-dev manifests drop
  the ConfigMap. Nothing in the repository uses
  apiAuth.configMap.create=false any more.
- The design document replaces its phase 2 outline with the design.

Signed-off-by: Abhay Krishna Arunachalam <abhaykrishna@nvidia.com>
2026-10-25 13:24:07 -07:00
Abhay Krishna e7ebbc4b1b feat(controller): read chart-rendered API authentication from nvke-controller-config (#1812)
When the chart renders the API authentication configuration
(apiAuth.configMap.create), the controller now reads it from an apiAuth
section of nvke-controller-config instead of the file at
AUTH_CONFIG_PATH. auth/authn stays the only owner of the schema: the
section reuses authn.Issuer and is validated with the new
Config.ValidateStartup, which authn.Load also uses.

The section is required and carries an explicit enabled switch, so a
missing section is a startup failure rather than "off". A section
filled in but switched off is refused, and enabling it while
AUTH_CONFIG_PATH is set is a startup failure. A ConfigMap managed
elsewhere keeps the AUTH_CONFIG_PATH path, and the chart still renders
the authentication ConfigMap for nvkectl and extraFiles.

The CAPD e2e lane moves to the chart-rendered configuration; Tilt and
capnico-e2e keep the external ConfigMap, so CI covers both. The e2e
suite and the token and demo scripts treat either source as
authentication being on, whichever name the settings ConfigMap has.
The auth-mode gauge now follows whether authn.Setup built an
authenticator.

Also renames the remaining references to the settings ConfigMap,
nke-controller-config, to nvke-controller-config, the chart's default
since #1769, in docs, comments, test messages and help text. Kept: the
legacy pins and fallbacks for installs that predate the rename, and
the "Loaded nke-controller-config" startup log line, which the e2e
OIDC site helper matches and released images still print.

Includes the design doc,
controller/docs/api-auth-in-controller-config-design.md.

Signed-off-by: Abhay Krishna Arunachalam <abhaykrishna@nvidia.com>
2026-10-23 16:33:27 -07:00
Dan Budris a3cabe2db2 refactor(auth): move the authN library to auth/authn (#1903)
Move controller/internal/auth to auth/authn as package authn, in a new
module, github.com/dsx-ai-factory/nvke/auth. This is a pure move with no
behavior change: only the package name, import paths, the qualifier and
path references change. The new module is wired the way controller/api
is: go.work use, a require and replace in controller/go.mod, a replace
to ../controller/api in auth/go.mod, the root Makefile module lists,
the lint and unit-test CI matrices, the e2e path filters, the coverage
registry, the notices and licence ignore lists, CODEOWNERS and the
labeler.

Signed-off-by: dbudris <dbudris@nvidia.com>
2026-10-23 11:40:55 -06:00
Abhay Krishna 0e41205a98 feat(controller): build the image on distroless static (#1883)
The runtime stage was Alpine plus bash, curl, util-linux and nine more
packages kept for in-container debugging. Build it on
gcr.io/distroless/static-debian12:debug-nonroot instead: the controller
and the SPIFFE exec-auth plugin are static binaries, and the debug
variant still gives `kubectl exec` a busybox shell with wget, grep, sed
and find. It has no bash, no curl and no package database.

The image drops about 39 MB uncompressed on arm64, the OS packages go
from 77 to none, and the curl High finding goes with them.

The base's entrypoint is /busybox/sh, so the image clears it and keeps
CMD ["controller"], which starts exactly as before. The empty /profiles
mount point is made in the builder, since the runtime stage has no
shell to run mkdir. The metrics examples in the API authentication docs
use wget instead of curl.

The troubleshooting page gains a section on what an exec session in
the pod has, and on attaching a debug container with kubectl debug
--profile=restricted for the tools it does not.

Signed-off-by: Abhay Krishna Arunachalam <abhaykrishna@nvidia.com>
2026-10-22 15:36:22 -07:00
Terry Howe 6f84d0e01b feat(chart)!: move the remaining chart names, mount paths and filenames to nvke (#1818)
* refactor(controller): move the controller pod's mount paths to /etc/nvke

The controller pod mounts its authentication ConfigMap, its controller-config
ConfigMap and its node-agent client identity under /etc/nke. Nothing outside
the pod observes any of them: the chart owns both the mount and the path it
joins into AUTH_CONFIG_PATH and CONTROLLER_CONFIG_PATH, and the client
identity paths are compiled constants the chart's volumeMounts match. So the
three move together with no values key and nothing for an existing site to
pin -- an upgraded pod simply mounts them one directory over.

Moved: /etc/nvke/auth, /etc/nvke/controller-config,
/etc/nvke/node-agent-client-tls and the e2e mock's /etc/nvke/dsx-identity.

Not moved: the node-side paths (/etc/nke/spire.env, /etc/nke/trust-bundle.pem,
/etc/nke/controller-ca.crt, /etc/default/nke-agent). Those are the node
contract, they are chosen per node from the agent's version, and they belong
to #1497.

While here, chart-node-agent-auth-assertions.sh asserted the absence of
`mountPath: /etc/nke/node-agent-tls`, a path the chart never rendered under
either name, so the check could not fail. It now names the real mount.

Related: #1554, #1496
Signed-off-by: Terry Howe <thowe@nvidia.com>

* feat(chart)!: default the authentication ConfigMap to nvke-auth-config

apiAuth.configMap.name was already a value an install can pin, so this moves
only the default. A new install mounts nvke-auth-config; an install that
predates the rename keeps nke-auth-config by pinning the key, which
chart-legacy-pinned-values.yaml now carries and chart-auth-assertions.sh now
proves.

The consumer moved first. nvkectl discovers the API audience by reading this
ConfigMap, and the name was a compiled constant, so flipping the default alone
would have left one nvkectl unable to talk to the other kind of site.
cli/internal/auth now searches both names in every controller namespace --
greenfield name first, pinned legacy name second -- in the same shape it
already searched the two namespaces, because a site that pinned one of the two
need not have pinned the other.

Also moved with it, all of them internally consistent and none observable
outside this repository: the e2e authtoken constant and the nvke-auth-dev
scaffolding that creates the ConfigMap the suite reads, the two e2e copies of
it, and the pod-internal volume names (nke-auth-config, nke-controller-config)
in deployment.yaml.

nvke-token.sh and nvke-auth-demo.sh take NKE_AUTH_CONFIGMAP, defaulting to the
new name, alongside the NKE_CONTROLLER_CONFIGMAP that #1769 added.

The chart's two env-refusal messages named nke-controller-config literally and
so went stale whenever the value moved. They now interpolate
controller.controllerConfig.name and say whatever the install configured.

Related: #1554, #1496
Signed-off-by: Terry Howe <thowe@nvidia.com>

* feat(chart)!: name the chart nvke-controller

Chart.yaml's name is the last path segment of the OCI repository helm pushes
to, so this moves the published GHCR chart from
ghcr.io/dsx-ai-factory/nvke/charts/nke-controller to .../charts/nvke-controller
and the packaged tarball with it. It is an artifact-location change: what an
install renders comes from nameOverride, not from here.

chart-publish-nvcr.yml rewrites this line with an anchored sed before pushing,
so its anchor moves too -- left behind, the rename would silently not apply and
the chart would push to NVCR under whatever name Chart.yaml happened to carry.
NVCR already publishes as nvke-controller-chart and is otherwise unaffected.

malware-backfill.yml pulls the chart by path to scan published tags, including
tags that predate this rename. It already chained fallbacks for the two earlier
chart renames; the new name goes at the front of that chain.

Not moved, deliberately:

- image.repository. #1554 decision 2 settled that the chart moves and the image
  does not, so ghcr.io/dsx-ai-factory/nvke/nke-controller and the sed in
  chart-publish.yml that pins it stay as they are.
- `component: nke-controller-chart` in the record-digest step. That is a key in
  the release manifest, read outside this repository, and nothing in #1554
  calls for moving it.

Related: #1554, #1496
Signed-off-by: Terry Howe <thowe@nvidia.com>

* feat(deploy)!: rename the OIDC upstream CA Issuer to nvke-oidc-upstream-ca

The cert-manager Issuer that signs the OIDC discovery provider's leaf serving
certificate. #1554 lists it as a Secret; it is an Issuer -- the Secret it reads
is oidc-provider-upstream-ca and carries no nke.

Renaming the Issuer is safe: spec.ca.secretName is unchanged, so the renamed
Issuer signs with the same CA key, and nothing a tenant holds is derived from
the Issuer's name. All ten references move together (deploy/nico, both e2e
stacks, helm-values/spire.yaml, deploy/k8s, the Tiltfile and the identity
exchange mock), so the issuerRef never dangles.

NOT changed, and it needs a decision before anyone does: the CA subject
(commonName "NKE OIDC Upstream CA", OU "NKE") on the Certificate in the same
file. #1554 wants it moved "for new sites only", but these items are what
`nvkectl ... install` applies, and the file's own comment says any subject
change forces a re-issue with a new private key, which invalidates every
tenant's embedded trust anchor. Nothing here distinguishes a new site from an
existing one re-running install, so moving the subject would re-key the CA
under an existing site. That gate has to exist first.

Related: #1554, #1496
Signed-off-by: Terry Howe <thowe@nvidia.com>

* refactor: rename the nke-prefixed chart templates and deploy manifests

Filenames only. Nothing these files render changes: Helm takes no object name
from a template's filename, and the two renamed Go files keep package
nvkerbac and every identifier in it.

  templates/nke-rbac.yaml             -> templates/nvke-rbac.yaml
  templates/rbac-nke-system.yaml      -> templates/rbac-nvke-system.yaml
  deploy/k8s/nke-auth-dev.yaml        -> deploy/k8s/nvke-auth-dev.yaml
  deploy/k8s/nke-spire-client.yaml    -> deploy/k8s/nvke-spire-client.yaml
  deploy/k8s/spire-nke-services-spiffe-id.yaml
                                      -> spire-nvke-services-spiffe-id.yaml
  internal/nvkerbac/nkerbac{,_test}.go -> internal/nvkerbac/nvkerbac{,_test}.go

and the e2e stacks' copies of the first three, whose directories were already
named nvke-*.

rbac-nke-system.yaml was named for the management namespace, which moved to
nvke-system in #1698, so its filename was already one rename behind.

Every reference moves with them, including the two Tilt resource names derived
from the filenames (nke-auth-dev and spire-nke-services-spiffe-id), the
_controller_resource_deps list that names both, and the resource_deps of two
opt-in providers -- the dsx-identity-exchange mock and dsx-imds-attestation --
that wait on nvke-auth-dev.

Those two matter more than they look. Tilt matches resource_deps by string and
SILENTLY DROPS a name it does not know: with the stale name, the Tiltfile still
loads and `tilt alpha tiltfile-result` still reports no error, but
dsx-identity-exchange-ca comes out depending on ["oidc-upstream-ca-ready"]
alone, having lost its wait on the scaffolding that creates the namespace it
writes a ConfigMap into. That is a race, not a failure, and no lane would have
caught it -- both providers are off by default. Verified by loading the
Tiltfile against a kind cluster with the provider enabled, before and after.

The allowlist entry for this group loses its `nkerbac` alternative, which now
matches nothing, and its comment says why `nke-rbac` is still there: the
ConfigMap's name is a compiled constant in that package, so it needs to become
a chart value before the name itself can move.

Related: #1554, #1496
Signed-off-by: Terry Howe <thowe@nvidia.com>

* docs(chart): document the pins an existing site needs before upgrading

Addresses both CodeRabbit findings on #1769, which are the same finding twice:
the legacy pins existed in the test fixture and in the pull request body, but
not where an operator planning an upgrade would read them.

- nameOverride's doc comment was a plain `#` comment, so helm-docs never
  rendered it and the README's row for the one value that FAILS an upgrade was
  empty. It is now a `# --` comment and reaches the README.
- controllerConfig.name said an install that predates nvke-controller-config
  pins "nvke-controller-config". It pins "nke-controller-config"; a rename in
  #1769 caught the legacy value too. This is the key sentence on the key the
  finding is about, and it was telling operators to pin the new name.
- apiAuth.configMap.name, whose default moved earlier in this branch, gains the
  same note.
- A new "Upgrading an existing site: names and identity" section collects every
  pin in one block, beside the management-namespace section that already
  existed, and says which failure mode each one has: nameOverride is rejected
  by the API server, the rest succeed and quietly leave something behind.
- The README title was still nke-controller after this branch renamed the
  chart.

The section states what the second finding asks for and what the fixture
cannot: chart-identity-assertions.py proves the chart still honours the pins,
not that any site supplies them, so the deployed values of all 41 sites have to
be checked before a chart carrying these defaults is published.

teleport.* is deliberately excluded from the pin block. Those defaults moved to
nvke-* in #1563, in a chart every existing site already runs, and no site ever
pinned them -- so pinning them now would be a behaviour change rather than a
preservation, whatever their own value descriptions say. The section says so.

Related: #1554, #1496, #1769, #1563
Signed-off-by: Terry Howe <thowe@nvidia.com>

* fix: address review feedback

Three findings on the authentication ConfigMap search, all of them consequences
of this branch adding a second name to look for.

A denied read of the greenfield name no longer ends the search. RBAC scoped to
resourceNames denies every name it does not grant, so a site pinned to
nke-auth-config can deny nvke-auth-config while permitting the name it actually
runs -- and with one name that denial was correctly terminal, while with two it
stopped nvkectl before the readable one. Forbidden is now kept and the search
continues; it is returned only if nothing turns out to be readable, so a denied
read still never degrades into "authentication is off" and a bare request the
controller rejects with a confusing 401. Any other error stays terminal.

The regression test reproduces the reviewer's case and fails without the fix.
A second test covers the other half: when no candidate is readable, the
Forbidden is surfaced rather than reported as authentication being off.

The e2e helper searched one name too. On a pinned site RawConfig found nothing,
which does not fail a run -- it quietly turns the authn specs into assertions
about an unauthenticated NVKE and skips the SPIRE one. It now searches both
names, and ConfigMapName stays the name the suite's diagnostics quote.

cli/README.md and cli/docs/user-flow.md named only nvke-auth-config. Both now
name each ConfigMap the CLI looks for and state the narrower condition for
sending no token: neither name found in either namespace. Both also say that an
unreadable ConfigMap is not that condition.

Signed-off-by: Terry Howe <thowe@nvidia.com>

* style(cli): gofumpt the forbidden-reactor helper

golangci-lint's gofumpt wants the closing paren of a split call on its own
line. I checked the new test with gofmt, which accepts it; the gate is
golangci-lint fmt (gci + gofumpt), which does not.

Kept as its own commit rather than squashed into fd51855ea: the review replies
on this pull request cite that SHA, and rewriting it would strand them.

Signed-off-by: Terry Howe <thowe@nvidia.com>

* docs: name the chart nvke-controller in the publication reference

Two rows in artifact-publication.md still said the controller's chart is
nke-controller. This branch moved the published chart to
charts/nvke-controller while deliberately leaving the image at nke-controller,
so a row naming both artifacts with one name is now wrong about the chart.

- the NVKE_GITHUB_PUBLISH table listed "`nke-controller` image and chart"
- the SBOM section listed the chart among "`nke-controller` and `nktp`"

Every other nke-controller in the file is the image and stays.

Reported on the chart-publish row; the SBOM row is the same defect one section
further down.

Signed-off-by: Terry Howe <thowe@nvidia.com>

* fix(e2e): make the legacy auth ConfigMap name a constant

gochecknoglobals is on in controller/test/e2e and rejected the package-level
slice the two-name search was reading:

  internal/authtoken/token.go:41:5: ConfigMapNames is a global variable

LegacyConfigMapName joins ConfigMapName as a const and RawConfig ranges over an
array literal of the two, so there is no package-level variable. Nothing else
referenced the slice.

I had run `make lint` for cli and not for controller/test/e2e, which is a
separate module with its own lint job. Both now pass, as does controller --
the three modules this branch touches Go files in.

Signed-off-by: Terry Howe <thowe@nvidia.com>

* fix: address review feedback

Keeps the authentication mount at /etc/nke/auth, and fixes the same
Forbidden-stops-the-search bug in the e2e helper that was already fixed in the
CLI.

The mount path move was wrong, and my own commit message argued it was safe on
a premise that does not hold. It claimed "nothing outside the pod observes
either" path. An operator's auth.yaml does: jwks.caBundlePath is an absolute
path into that mount, written by whoever configured the issuer, and it lives in
their values or in a ConfigMap they supply. Pinning apiAuth.configMap.name
preserves the ConfigMap's name but not where it is mounted.

Confirmed by rendering the chart with a pre-rename configuration
(caBundlePath: /etc/nke/auth/spire-ca.crt plus the matching extraFiles): the
render SUCCEEDS and emits auth.yaml naming /etc/nke/auth/spire-ca.crt while
mounting the file at /etc/nvke/auth/spire-ca.crt. The guard does not catch it
either -- it only rejects an unlisted file under the current mount, so a
legacy path reads as "a CA outside the mount" and is left alone. An enforcing
controller then cannot load that issuer's CA, which is an authentication outage
on upgrade, arriving silently.

So /etc/nke/auth stays. The other three mounts this branch moved are kept at
/etc/nvke: controller-config, node-agent-client-tls and the e2e mock's
dsx-identity. Those are chart-owned or compiled constants -- checked that
nothing outside the chart names them, and that the only values an operator can
point into a mount are caBundlePath, which names the auth mount, and
profilesDir/runbooksPath, which name a different one this branch never touched.

authtoken.RawConfig had the same defect as cli/internal/auth did: it returned
on a Forbidden read of the greenfield name and never tried the pinned one. It
now keeps the denial, continues, and returns it only when no candidate is
readable -- so a denied read is never reported as authentication being absent.

Docs, all four of them saying something that is no longer true:

- cli/docs/user-flow.md and cli/README.md said the first name that *exists* is
  used; it is the first *readable* one, and they now say why that differs.
- controller/docs/configuring-api-authentication.md said nvke-auth-config is
  the single name fixed in the CLI, and that any read error stops the command.
- controller/test/e2e/README.md said the suite sends no token when
  nvke-auth-config is missing; it sends none only when neither name exists.

Signed-off-by: Terry Howe <thowe@nvidia.com>

---------

Signed-off-by: Terry Howe <thowe@nvidia.com>
2026-10-20 11:46:56 -04:00
Chao 3d73bd3966 fix: allow exact prerelease node-agent upgrades (#1785)
Signed-off-by: Chao Chen <chaoch@nvidia.com>
2026-10-19 13:45:04 -06:00
Davanum Srinivas 647fcdf595 docs: fix what an end-user walk of the published site found (#1747)
* docs: repair links and anchors that break on the published site

Seventeen relative links pointed at repository files outside docs/index.yml, which the site does not serve, and two anchors named a heading that does not exist. Point them at navigation pages or at the files on GitHub.

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

* docs(install): say when to install without --release

The artifacts page says a Release from NVKR's maintained Definition is refused, but the install commands pass --release by default. Name that case where the commands are.

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

* docs: correct statements that contradict the code

The OIDC verify step read a label the controller deletes. Five other pages described the sitespec default, scale-down, config restarts, an error prefix and a reserved prefix differently from the code.

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

* docs(nktp): fix the verification steps and the host-process guide

The management-cluster verification queried the old trace service name and expected ten certificates where the chart default makes 21. The host-process guide named the wrong Collector, one page kept a site-controller phrase, and a design page misspelled pseudocommand.

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

* docs: use the repository callout syntax and unbreak the sitespec table

GitHub alert markers render as literal text on the site, and a paragraph with no blank line before it landed inside the schema table.

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

* docs(nktp): add the registry login and say where the chart versions are

The install command named no version and fails with unauthorized when the registry wants a login.

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

* docs: drop the unused catalog entry from the API layout

Both Catalog operations are x-fern-ignore, so Fern logs the identifier as unknown.

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

* docs: say in one sentence that a config change needs a restart

Wording from the review of #1747: the file is read once at startup, so restart NVKE after you change it.

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

---------

Signed-off-by: Davanum Srinivas <dsrinivas@nvidia.com>
2026-10-19 07:06:59 -04:00
Eric ChapmanandClaude Opus 5.5 f0a043d73e docs: call NVKE's cluster the management cluster, not the site controller (#1744)
Replace "site controller" with "management cluster" (the cluster) or
"management plane" (the NVKE API and controllers) in docs, CLI docs and
help text, examples, and deploy-path comments. Identifiers such as
nke.site-controller.internal, the site-controller e2e lane and the
dashboard UID are unchanged.

Supersedes #1737, which was closed so the launch batch had no ordering
dependency on #1733.

Signed-off-by: echapman13 <echapman@nvidia.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-18 17:37:06 -04:00
Eric ChapmanandClaude Opus 5.5 5340b8f94c docs: make flagged pages public-safe and add a design records folder (#1736)
* docs: make flagged pages public-safe and add a design records folder

Remove internal references, the nonexistent controller UI, stale GA
targets and TODOs from the flagged pages with the smallest accurate
edits. Move the BYO-OS and multi-OIDC proposals to a new docs/design/
folder, remove docs/overview.md (superseded by overview/what-is-nvke.md),
fold upgrade.md's remaining limitation into preview-status, and fix
every inbound link.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: echapman13 <echapman@nvidia.com>

* docs: name agent/v0.3.0-rc.2 as the first release with nvke-agent packages

agent/v0.3.0-rc.1 still ships nke-agent_*.deb; rc.2 is the first to ship
the nvke-agent names the bootstrap pages document.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: echapman13 <echapman@nvidia.com>

---------

Signed-off-by: echapman13 <echapman@nvidia.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-18 17:36:41 -04:00
Vignesh Goutham Ganesh d48c98372f docs: describe multiple API issuers and headless oidc-kubeconfig (#1676)
* docs: describe multiple API issuers and headless oidc-kubeconfig

Callers need the groups issuer and a second issuer written down, and a machine with no browser needs --headless on the generated kubeconfig.

Signed-off-by: Vignesh Goutham Ganesh <viganesh@nvidia.com>

* docs: require audiences on the issuer recipe and drop --headless

The issuer example is not a complete configuration, and generate oidc-kubeconfig has no --headless flag.

Signed-off-by: Vignesh Goutham Ganesh <viganesh@nvidia.com>

---------

Signed-off-by: Vignesh Goutham Ganesh <viganesh@nvidia.com>
2026-10-15 15:53:51 -07:00
Eric ChapmanandClaude Opus 5.5 5c8ebb2b58 docs: remove Calico from the user documentation (#1634)
New clusters use OVN-Kubernetes and Calico's creation path is disabled by
default, so the docs no longer present Calico as a choice. Module READMEs
and the OS image spec still describe the Calico packages that ship.

Signed-off-by: echapman13 <echapman@nvidia.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-14 13:27:32 -07:00
Chao f520e100aa feat(controller)!: converge control-plane node-agent versions (#1353)
* refactor(agent)!: use version and method for agent updates

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

* feat(controller): converge control-plane node-agent versions

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

* test: cover agent convergence and deletion recovery

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

* docs: explain control-plane node-agent updates

Signed-off-by: Chao Chen <chaoch@nvidia.com>
2026-10-14 11:26:08 -07:00
Abhay Krishna c3b79ae463 docs: add multiple OIDC provider support design (#968)
Proposes letting operators register up to five fleet-wide OIDC
providers through the controller chart's oidc.providers value. The
chart renders them, with the shared provider's settings (as
managementOIDCAuth) and the rest of the controller's configuration,
into an nke-controller-config ConfigMap mounted on the controller,
following the nke-auth-config precedent. The controller loads and
validates the file at startup, and Stakater Reloader restarts it when
the ConfigMap changes.

When a cluster is created, NVKE pins the providers onto the cluster's
database row, so every control-plane node, including one that joins
later, renders the same providers whatever the ConfigMap says by then.
Each provider carries CEL rules that reject identities in NVKE's
reserved namespaces. Clusters below Kubernetes 1.34, which cannot read
the v1 AuthenticationConfiguration, get no fleet-wide providers.

Includes a control-flow diagram, a deployment.yaml example, security
considerations, a migration section for existing deployments, and a
future-scope section for a per-cluster provider API.

Signed-off-by: Abhay Krishna Arunachalam <abhaykrishna@nvidia.com>
2026-10-14 10:46:30 -07:00
Michael Shen 8608645c97 fix(controller): bound node-agent readiness probes (#1328)
The node-agent readiness controller previously checked agents serially
using a shared two-minute timeout. A slow agent could therefore occupy
the only worker and delay readiness checks across the fleet.

This change adds a configurable worker pool (default eight), a dedicated
agent RPC timeout (default 30s), and jitter around the two-minute requeue
interval. In addition, probe concurrency and latency metrics were added.

Signed-off-by: Michael Shen <mishen@nvidia.com>
2026-10-13 09:42:26 -07:00
Alexander Greene cacd6476f8 feat(nkx-17929): hide x-fern-ignore fields in Swagger UI
Swagger UI showed the full API specification, including Teleport and
other fields that the public docs leave out. It now shows a filtered
copy. The server still validates requests against the full
specification. When a field is removed, it is also removed from the
required list, so the public schema can still be satisfied.

Signed-off-by: Alex Greene <algreene@nvidia.com>
2026-10-12 16:36:45 -07: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
Chao 6bc0e1c9e8 fix(agent): rename node agent package and contracts to nvke (#1565)
* fix(agent): rename node agent package and contracts to nvke

Signed-off-by: Chao Chen <chaoch@nvidia.com>
2026-10-12 14:14:32 -07:00
Davanum SrinivasandClaude Fable 5.1 17a88127b8 docs: say NVKE and nvkectl where the documents still said NKE and nkectl (#1462)
The mechanical half of the documentation change. The word NKE becomes
NVKE in prose across the Markdown documents, the docs navigation, the
Fern header text, NOTICE, the chart description and the OpenAPI
description text; nkectl becomes nvkectl wherever a document names the
CLI; a lowercase nke that is the product name becomes NVKE, the clone
directory in cd lines becomes nvke, and an identifier in a code span,
such as the dashboards' tag, becomes nvke.

Identifiers stay: NKE_* and NKECluster-style names, every nke-*,
nke.*, nke: and /.../nke persisted name, the "NKE Agent Version"
output line, the Keycloak realm and tenant names in examples, and the
Fern instance URL and /nke paths until the Fern instance is renamed.
The embedded OpenAPI spec is regenerated with the pinned toolchain. The
placeholder server URL in the spec counts as a removed object for the
compatibility gate, so the waiver file records that decision.

Not here: the editorial pass (first-use "NVIDIA Kubernetes Engine
(NVKE)", the glossary, the release-note paragraph listing the persisted
identifiers), which belongs with the new documentation set in #1391;
CHANGELOG.md, which is generated; the CLI's own documents, written with
intent in #1456; release/README.md and the issue templates, from #1460.

Closes #1461

Signed-off-by: Davanum Srinivas <dsrinivas@nvidia.com>
Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
2026-10-10 17:29:16 -04:00
Davanum SrinivasandClaude Fable 5.1 eacf8e6df7 feat(controller): rename the metrics, dashboards and telemetry labels that carried the old product name (#1458)
The 35 metric base names, nke_controller_* and nke_auth_*, become
nvke_controller_* and nvke_auth_* in their registrations, tests, e2e
assertions and documents. A controller emits one family; there is no
dual emission.

The three reference dashboards move to nvke-*-reference.json with uid
equal to the file stem, "Reference - NVKE ..." titles and the nvke tag.
The two that read controller metrics query both families for one
release, {__name__=~"nke_x|nvke_x", ...}, so a panel stays continuous
across the controller upgrade, and their Requirements panel says so.
The health dashboard's namespace regex accepts nvke-controller beside
nke-controller, the namespace a new site gets post-launch.

The benchmark dashboards' uids and tags, the chart's project and team
pod labels and the deploy overlay's tracing service.name take the new
name. Nothing in the NKTP chart reads these series.

Closes #1457

Signed-off-by: Davanum Srinivas <dsrinivas@nvidia.com>
Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
2026-10-10 17:13:24 -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
Aaron PattenandTerry Howe b4e6656ff6 docs: say controller, not CWE, in the published pages (#1405)
* docs: say controller, not CWE, in the published pages

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

* docs: name the NKE controller on first mention and say NICo, not Forge

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

* Update docs/qualification/hardware-lane.md

Co-authored-by: Terry Howe <thowe@nvidia.com>
Signed-off-by: Aaron Patten <apatten@nvidia.com>

* Update docs/architecture.md

Co-authored-by: Terry Howe <thowe@nvidia.com>
Signed-off-by: Aaron Patten <apatten@nvidia.com>

* Update docs/architecture.md

Co-authored-by: Terry Howe <thowe@nvidia.com>
Signed-off-by: Aaron Patten <apatten@nvidia.com>

* Update docs/architecture.md

Co-authored-by: Terry Howe <thowe@nvidia.com>
Signed-off-by: Aaron Patten <apatten@nvidia.com>

* docs: keep Forge naming and call the hardware lane's site the site controller machine

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

---------

Signed-off-by: Aaron Patten <apatten@nvidia.com>
Co-authored-by: Terry Howe <thowe@nvidia.com>
2026-10-09 18:20:49 +00:00
Aaron Patten 84245d2cca docs: give operator commands the nke-controller names new sites use (#1385)
The API authentication and infrastructure provider pages now quote the
namespace, Deployment and label a new site installs with. The restart
command on the infrastructure provider page selected
app.kubernetes.io/name=cloud-workflow-engine, which matches nothing on a
new site, so it restarted nothing without an error.

Each of the three pages, including site telemetry verification, has one
note that tells operators on an existing site to use
cloud-workflow-engine. The authentication page now says where nkectl
looks for the nke-auth-config ConfigMap: nke-controller first, then
cloud-workflow-engine.

Signed-off-by: Aaron Patten <apatten@nvidia.com>
2026-10-09 11:09:18 -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
Dan BudrisandClaude Sonnet 5 45fc961c56 docs(controller): tighten prose style in API auth docs (#1255)
Cut em-dash asides, bold/italics used for emphasis, a self-count, and a
wind-up across the API Authentication section of README.md and the two
linked how-tos. Restructured the AUTH_CONFIG_PATH ConfigMap paragraph in
README.md, which buried its two valid options inside a sentence fragment
describing only the invalid combinations.

Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>
2026-10-05 16:43:36 -06:00
Chao 0825a72019 fix(controller): use canonical node-agent exchange subjects (#1203)
* fix(controller): use canonical node-agent exchange subjects

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

* test(controller): use synthetic exchange tenant

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

---------

Signed-off-by: Chao Chen <chaoch@nvidia.com>
2026-10-02 15:40:00 -07:00
Vignesh Goutham Ganesh eb08697a3c feat: admit OIDC groups on the CWE API (#1140)
Allow a third admission rule beside service accounts and SPIFFE, and
accept HTTP JWKS so a lab issuer without TLS can be configured.
2026-09-30 15:34:41 -07:00
vwilson-nvidia ef2144a5f5 fix(controller): bootstrap node-agent TLS/JWT through files (#1013)
- Generate node-agent arguments with TLS/JWT and the DSX exchange URL in bootstrap files.
- Pass controller files to CAPI and NICo without editing agent commands.
- Validate the exchange URL setting and cover bootstrap combinations with tests.

Signed-off-by: Vivin Wilson <vwilson@nvidia.com>
2026-09-23 16:17:35 -04:00
vwilson-nvidia effe970491 feat(controller): add TLS/JWT node-agent authentication (#807)
- configure deployment-wide JWT verification for node-agent connections
- wrap secure gRPC transports with the NKE authentication record handshake
- inject TLS/JWT agent mode into generic CAPI and Nico bootstrap user data
- add Helm assertions, unit coverage, and an opt-in TCP integration example

Signed-off-by: Vivin Wilson <vwilson@nvidia.com>
2026-09-18 18:06:45 -04:00
Vignesh Goutham Ganesh f5373f358b docs: explain how nkectl authenticates to the CWE API (#600)
Replace the stale NKECTL_DEV_TOKEN path with TokenRequest minting from the
site kubeconfig, and document the RBAC nkectl needs on a real site.
2026-09-09 21:02:06 -07:00
vwilson-nvidia ff8b919b46 refactor(api)!: remove legacy site APIs (#439)
Remove the legacy CWE site and VIP allocation API surface, along with the server and database query layers that backed it.

Update tests, e2e fixtures, Tilt resources, and local helper scripts so cluster creation no longer tries to register default or mock sites before submitting cluster requests.

BREAKING CHANGE: The /sites and /vipAllocations API endpoints are removed.

Signed-off-by: Vivin Wilson <vwilson@nvidia.com>
2026-09-03 10:08:46 -06:00
Dan BudrisandClaude Opus 5 2e9ee38998 docs: say how to create the identity callers authenticate as (#355)
* docs: use extraFiles for the SPIRE CA bundle

#333 added apiAuth.configMap.extraFiles hours after #328 merged, so the guide
still tells a SPIRE adopter that the chart cannot deliver a CA:

  This means you cannot use configMap.create: true with SPIRE. A ConfigMap the
  chart builds holds the config file and nothing else, so there is nowhere to
  put the certificate.

That is no longer true, and controller/README.md at the same commit documents
extraFiles -- so the two shipped documents disagreed on the one question a SPIRE
adopter is asking.

The CA section now leads with the values form, which keeps the whole SPIRE setup
inside the apiAuth block, and keeps the kubectl form for anyone managing the
ConfigMap themselves. The chart-values table gains extraFiles, the caBundlePath
row says where the file usually comes from, and the startup-failure entry in
troubleshooting names the actual cause: a path under /etc/nke/auth has to be
listed in extraFiles.

Verified by rendering the guide's own SPIRE example through the chart: both
files land in the ConfigMap and caBundlePath resolves to the one that is there.
15 bash blocks and 4 YAML blocks parse; chart auth assertions pass.

Part of NKX-15206.

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

* docs: say how to create the identity callers authenticate as

The Kubernetes recipe named nke-clients/nke-client in its admit rule and then
told the reader to run

  kubectl create token nke-client -n nke-clients

without ever creating either. Followed literally, the recipe fails on its last
command, which is also the first point at which the reader finds out.

Adds a step covering the namespace and service account, and the RBAC needed when
something other than a cluster administrator mints the token -- a CI job, or an
application renewing its own. That Role carries resourceNames so the grant is to
the one account rather than to every service account in the namespace.

The remaining steps in that recipe shift by one. The SPIRE recipe is untouched:
its subjects are SPIFFE IDs and come from SPIRE registration entries.

Verified against a live kind cluster rather than written from memory:

  - The Role's rules are byte-identical to the one in deploy/k8s/nke-auth-dev.yaml,
    compared by parsing both rather than by eye.
  - kubectl apply accepts it, and minting for that account returns a JWT whose
    sub is system:serviceaccount:nke-clients:nke-client and whose aud is the
    requested audience -- so it satisfies the admit rule the recipe writes two
    steps earlier.
  - The cluster's iss is https://kubernetes.default.svc.cluster.local, which is
    what the recipe's example configures.
  - That cluster advertises jwks_uri as https://172.18.0.4:6443/openid/v1/jwks,
    a node IP. The recipe's warning not to copy that value is correct, and now
    has a case behind it.

16 bash blocks and 5 YAML blocks parse.

Part of NKX-15206.

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

---------

Signed-off-by: dbudris <dbudris@nvidia.com>
Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-27 19:37:25 +00:00
Dan BudrisandClaude Opus 5 604c8abad1 docs: use extraFiles for the SPIRE CA bundle (#352)
#333 added apiAuth.configMap.extraFiles hours after #328 merged, so the guide
still tells a SPIRE adopter that the chart cannot deliver a CA:

  This means you cannot use configMap.create: true with SPIRE. A ConfigMap the
  chart builds holds the config file and nothing else, so there is nowhere to
  put the certificate.

That is no longer true, and controller/README.md at the same commit documents
extraFiles -- so the two shipped documents disagreed on the one question a SPIRE
adopter is asking.

The CA section now leads with the values form, which keeps the whole SPIRE setup
inside the apiAuth block, and keeps the kubectl form for anyone managing the
ConfigMap themselves. The chart-values table gains extraFiles, the caBundlePath
row says where the file usually comes from, and the startup-failure entry in
troubleshooting names the actual cause: a path under /etc/nke/auth has to be
listed in extraFiles.

Verified by rendering the guide's own SPIRE example through the chart: both
files land in the ConfigMap and caBundlePath resolves to the one that is there.
15 bash blocks and 4 YAML blocks parse; chart auth assertions pass.

Part of NKX-15206.

Signed-off-by: dbudris <dbudris@nvidia.com>
Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-27 12:01:37 -04:00
Terry Howe 24003efacd chore: remove references to internal nvidia.com sites (#318)
* chore: remove references to internal nvidia.com sites

Remove URLs pointing to internal-only NVIDIA infrastructure that public
contributors cannot access: confluence.nvidia.com, nvbugspro.nvidia.com,
gitlab-master.nvidia.com, gitlab-master-pages.nvidia.com,
nvidia.enterprise.slack.com, and docs.google.com internal design docs.

Where a comment still carries useful context the description is kept;
where the URL was the only content the line is dropped.

Signed-off-by: Terry Howe <thowe@nvidia.com>

* chore: remove controller/docs/remote-colossus-tilt.md

References internal infrastructure (GitLab, agent-skills repo) not
accessible to public contributors.

Signed-off-by: Terry Howe <thowe@nvidia.com>

* chore: remove remaining internal nvidia.com references

- Replace my-machine.nvidia.com placeholder with my-machine.example.com
  in nico-vms docs and scripts
- Remove hardcoded dc.local.gha-runners.nvidia.com CI mirror hostname
  from backend-e2e workflow and capd-registry-probe script
- Strip jirasw.nvidia.com URLs from FIXME comments; keep descriptions

Signed-off-by: Terry Howe <thowe@nvidia.com>

* revert: restore internal CI mirror hostname

dc.local.gha-runners.nvidia.com is a Docker Hub mirror available on
NVIDIA's GHA runners. The workflow is gated to github.repository ==
'NVIDIA/nke' so it only runs there, and capd-registry-probe.sh probes
the mirror explicitly — an empty host would break CI.

Signed-off-by: Terry Howe <thowe@nvidia.com>

* Update .github/workflows/backend-e2e.yml

---------

Signed-off-by: Terry Howe <thowe@nvidia.com>
2026-08-27 06:27:23 -06:00
Dan BudrisandClaude Opus 5 6d16f63929 docs: a configuration guide for API authentication (#328)
* docs: a configuration guide for API authentication

The client side was documented and the operator side was not. Someone with their
own cluster had no instructions for authoring an auth config: choosing an
audience, finding their issuer, delivering a CA, writing admission rules, or
moving a running deployment to enforcing without breaking its callers. The only
worked example, deploy/k8s/nke-auth-dev.yaml, is development-only and shaped for
Tilt.

Twelve numbered sections, so it can be referenced by number rather than read
front to back. Two recipes: the cluster's own API server, and SPIRE.

Several rules are documented here for the first time, all taken from the
validation code rather than recalled:

- An issuer may set serviceAccounts or spiffe, never both. Either kind admits on
  a match, so setting both restricts nothing, and the config is rejected.
- An audience may not contain a wildcard, may not equal a configured issuer, and
  may not be a kubernetes.default.svc form. Each would make the audience check a
  cluster-wide no-op.
- pathPrefixes is required, and "/" is rejected, because a trust domain alone
  admits every workload in it.
- No field may carry leading or trailing whitespace; padded values are rejected
  rather than trimmed.

The recurring trap gets said twice, once per recipe: do not copy jwks_uri out of
a discovery document. On a kubeadm cluster it is a node IP and on a site
controller it is a VIP. Use a stable address, and for SPIRE check it appears in
the serving certificate's SANs first.

Section 10 covers permissive to enforcing, and says to read
nke_auth_requests_total rather than the request log — successful GETs are logged
at debug level, so the log undercounts reads.

All 12 bash blocks parse under bash -n, all 8 YAML blocks parse, links resolve.

Part of NKX-15206.

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

* docs: reconcile the configuration guide with the shipped chart

The guide was written against the chart as it stood before #322, and four of
its statements did not match the code even before that.

#322 landed twenty-eight minutes after this branch was first pushed and moved
the central mechanic. Section 9.1 said "the chart mounts this ConfigMap but
does not create it", which controller/README.md now directly contradicts, and
9.2's values block had no `create` or `config` -- so an operator who read the
README, set apiAuth.config, then followed 9.2 would hit the hard render failure
that #322 added. Both paths are now documented as the alternatives they are,
with the GitOps case stated, and 9.4 covers Reloader and the restart that a
configuration change needs.

The SPIRE recipe and a chart-rendered ConfigMap turn out to be mutually
exclusive, which nothing said. configmap-auth.yaml renders exactly one key,
auth.yaml, and has no extension point, so the second-key trick in 8.2 works
only for a ConfigMap you manage yourself. Documented rather than fixed here:
carrying extra keys is a chart change and belongs in its own PR.

Four corrections against the code, none of them caused by #322:

  - clusterIssuerDiscovery defaults to true (values.yaml). The guide framed it
    as something to switch on if your cluster narrowed the default, which
    inverts it -- the chart always binds the role unless you turn it off.
  - METRICS_LISTEN_ADDRESS defaults to 127.0.0.1:9090 in the binary
    (internal/config/config.go). 0.0.0.0:9090 is the chart's value, not the
    default, and the table said otherwise for anyone running outside the chart.
  - The anonymous surface omitted /api/docs without the trailing slash.
    routes.go gives it its own entry because the mux redirect happens
    downstream of the check. README.md had the same omission; both fixed, so
    the two lists agree.
  - 11.1 now says the chart renders the ConfigMap too, not just the two
    environment variables.

Verified rather than recalled: every example in 9.1, 9.2 and the negative case
in 12 was rendered through the real chart with helm template. 9.1 produces a
valid document with exactly one apiVersion, 9.2 emits no ConfigMap and still
carries the Reloader annotation, and config-without-create fails with the
message the troubleshooting section quotes. 13 bash blocks parse under bash -n,
9 YAML blocks parse, both relative links resolve, and hack/chart-auth-
assertions.sh passes.

Part of NKX-15206.

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

* docs: rewrite the configuration guide around the task

The guide was 591 lines and 30 headings to describe a job that is: write a
config, get it into a ConfigMap, set three chart values, watch a counter, flip a
boolean. It opened with roughly 200 lines of field-by-field schema before the
first working example, so anyone with a cluster read four sections of reference
before seeing anything they could copy.

Now 382 lines, recipe first. The two recipes -- the cluster's own API server,
and SPIRE -- each run end to end, from reading your issuer through to the
command a caller runs. Reference moved behind them. Someone who wants the
common case can stop after the first recipe.

Dropped the 1-12 section numbering. It was justified as making the guide
citable by number, which is an author's convenience rather than a reader's:
nobody says "see 6.2". It also made a how-to read like a specification and
turned every future insertion into a renumbering.

Cut, as material that cost a reader more than it gave them:

  - the mux-redirect explanation for why /api/docs is exempt separately from
    /api/docs/, and the same distinction in README.md. Both added yesterday.
    "The Swagger UI" is how a reader thinks about it.
  - METRICS_LISTEN_ADDRESS having one default in the binary and another in the
    chart. Also added yesterday. The guide is for people deploying the chart.
  - a helm-render-failure troubleshooting entry, when the failure already
    prints the reason.
  - the three-row table of rejected audience values, and the kubeadm
    --api-audiences reasoning behind it, for one sentence saying pick something
    unique to this deployment.
  - all ten signing algorithms, for the two that cover most issuers.
  - segment-wise prefix matching with a counter-example, when the example
    above it already shows the behaviour.
  - Reloader, its annotation, and the override precedence, for one line saying
    the chart restarts NKE and here is how to do it yourself.
  - a warning that Kubernetes has a same-named kind in another API group.

Removed the internal vocabulary: hack/ script paths, deploy/k8s/nke-auth-dev.yaml,
internal/auth source references, and the note about GitOps having nowhere to put
a loose manifest, which was our reason for building the feature rather than
anything an operator needs. Namespace is now a variable set once instead of
cloud-workflow-engine repeated through fifteen commands -- it is the release
namespace, not a fixed name.

Two things said plainly that were buried in mechanism. Admission rules exist
because anyone who can create a pod can mint a token for their own service
account, so a valid signature is not sufficient on its own. And a ConfigMap the
chart builds carries the config file and nothing else, so SPIRE -- or any issuer
behind a private CA -- cannot use configMap.create and needs the certificate
delivered another way.

15 bash blocks parse under bash -n, 3 YAML blocks parse, the one relative link
resolves. The chart values table was checked against values.yaml rather than
recalled. Fixed a snippet that never parsed: `helm show values <chart>` reads
the angle bracket as a redirect.

Part of NKX-15206.

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

---------

Signed-off-by: dbudris <dbudris@nvidia.com>
Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-27 06:20:19 -06:00
Dan BudrisandClaude Opus 5 490ad163b7 test(e2e): the authentication specs, and the CI that runs them (#238)
Rebuilt onto the chart pull request now that the transport has merged. The
branch carried eighteen commits: ten stale copies of the chart work and eight of
its own, and the eight contained the port-forward transport that #278 has since
landed on main. Replaying them re-applied work main already had, so this is
assembled directly instead: the current chart branch plus the authentication
content, and nothing else.

What that leaves is the credential and the specs. internal/authtoken mints a
bound service account token through the TokenRequest API and discovers the
audience from the nke-auth-config ConfigMap, so an unauthenticated deployment
sends no token and the suite behaves as before. nke.NewClient presents it on
every call, which is what makes the ordinary specs exercise the shipping
authentication path rather than bypassing it.

Nine specs: no token, wrong audience, an unadmitted identity, the anonymous
surface, two percent-encoding regressions, a SPIRE JWT-SVID, and permissive mode
counting what it would have rejected. The CAPD lane selects fifty of a hundred
and twenty-nine, and NKE_E2E_REQUIRE_AUTHN turns "authentication is not
deployed" from a skip into a failure, without which a broken deployment reads as
a pass.

Assembling by hand rather than by replay caught what replay would have buried:
old copies of Makefile, hack/ci/backend-e2e.sh, the Tiltfile, both READMEs,
tenant_test.go and internal/nke/client.go all predate the forge-vms to nico-vms
rename, and taking them wholesale would have reverted it. Each of those is the
current file with only the authentication delta applied.

Verified: e2e vet and tests clean, controller builds, and the label filters
select the same counts as before the rebuild.

Signed-off-by: dbudris <dbudris@nvidia.com>
Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-26 08:41:25 -06:00