Commit Graph
85 Commits
Author SHA1 Message Date
Ryan Bever b4e7ea79b9 refactor(controller): move kubelet client CSR approval into kubeletcsr (#2421)
Keep the client CSR controller and its certificate-request helpers out of the bootstrap package so serving approval can share them. Bootstrap identity and authorization keep their own condition helpers.

Signed-off-by: Ryan Bever <rbever@nvidia.com>
2026-11-23 10:02:53 -05: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
Ryan Bever c044392984 feat(controller): approve kubelet client CSRs for bootstrap identities (#2320)
* feat(controller): approve kubelet client CSRs for bootstrap identities

Add a management-cluster controller that approves the initial kubelet client
CSR for a Machine when the CSR matches the Machine's bootstrap identity and
expected node name. The controller reads tenant clusters through ClusterCache,
limited to Clusters NVKE manages, and reports the outcome in the
nvke.nvidia.com/KubeletClientCertificateIssued condition.

The controller runs only when controllers.bootstrap.enabled is set. The chart
grants approve on the kube-apiserver-client-kubelet signer inside that block.

Signed-off-by: Ryan Bever <rbever@nvidia.com>

* fix(controller): approve a kubelet client CSR retry after an earlier certificate is issued

Kubelet abandons a CSR after 15 minutes and creates a new one. Stopping approval once any certificate is issued leaves that retry unapproved until the ignored CSR is garbage collected.

Signed-off-by: Ryan Bever <rbever@nvidia.com>

---------

Signed-off-by: Ryan Bever <rbever@nvidia.com>
2026-11-16 17:21:05 -07:00
Miancheng Lin d03bd02584 refactor(controller): own the release CRDs in controller/k8s-apis (#2305)
The NVKE controller and nvkectl no longer import MachineImage, ClusterRelease
and NodePoolRelease from management-engine. They are defined in a new module,
controller/k8s-apis/v1, which generates their CRDs, tests them, and ships them
through the nvke-crds chart, so the controller owns its release APIs end to
end and no longer depends on management-engine's Go types.

The API group is unchanged, so stored objects, RBAC and fixtures keep working.

Signed-off-by: Miancheng Lin <mianchengl@nvidia.com>
2026-11-13 12:19:29 -08:00
Mohammad MaraqaandMohammad Maraqa 5c51b3e758 fix(controller): skip Machine SPIRE registration when SPIFFE is disabled (#2234)
Signed-off-by: Mohammad Maraqa <Mohammad-Maraqa@users.noreply.github.com>
Co-authored-by: Mohammad Maraqa <Mohammad-Maraqa@users.noreply.github.com>
2026-11-12 14:10:18 -08:00
Ryan Bever 24f9faf1c5 refactor(controller): read bootstrap RBAC through ClusterCache (#2295)
* refactor(controller): read bootstrap RBAC through ClusterCache

The bootstrap authorization controller now gets its tenant client from
ClusterCache instead of TenantClientProvider. ClusterCache connects to
the same <cluster>-kubeconfig Secret that Cluster API uses, so this
controller no longer depends on the controller's node-agent or
kubeconfig fallback path.

The cache is created only when bootstrap controllers are enabled. Its
ClusterFilter is IsNVKEManagedCluster, which moves from the capi
package's unexported helper to an exported function so both controllers
share it.

The controller watches the cache's cluster source, so it reconciles
when a workload connection opens or closes. The 30-second RequeueAfter
on a missing connection is removed. When the cache is not connected,
the controller still sets WaitingForTenantAccess on the selected
Machines and returns.

The NICo provider ID controller and the Temporal activities still use
TenantClientProvider.

Signed-off-by: Ryan Bever <rbever@nvidia.com>

* work-sync

Signed-off-by: Ryan Bever <rbever@nvidia.com>

---------

Signed-off-by: Ryan Bever <rbever@nvidia.com>
2026-11-12 14:19:14 -07:00
Dan Budris 551e1cebbe feat(controller): authorize API requests by role (#2125)
Add an apiAuthz section to nvke-controller-config. When enabled, the
controller loads a LocalBundle from authorizer.localBundle.dir and asks
it whether the caller may call each API operation. The action is the
operation's operationId and the resource is the request path. The API
has no tenants, so the bundle is loaded with RoleOnly.

- Enforcing mode refuses with 403 before the handler runs. Permissive
  mode logs and counts the decision and serves the request.
- The controller reloads the bundle every 10 seconds. A failed reload
  keeps the live bundle and counts
  nvke_authz_bundle_reload_failures_total.
- nvke_authz_decisions_total counts decisions by outcome and action, and
  nvke_authz_enabled reports the mode.
- Startup refuses authorization with authentication off, and enforcing
  authorization behind permissive authentication.

The chart renders apiAuthz off: it mounts no bundle.

Signed-off-by: dbudris <dbudris@nvidia.com>
2026-11-10 17:36:53 +00:00
Ryan Bever ab0154a7bc feat(controller): authorize SPIFFE bootstrap identities (#2130)
Add a controller that grants labeled, joining Machines the tenant RBAC required by kubeadm. Reconcile six kubeadm bindings from resolved SPIFFE identities and remove subjects after each Machine receives a node reference.

Gate the controller's tenant permissions on the bootstrap controller setting, report synchronization through Machine conditions, and cover the behavior with unit and chart assertions. CSR approval remains separate.

Signed-off-by: Ryan Bever <rbever@nvidia.com>
2026-11-05 07:23:44 -07:00
Ryan Bever 80d0daf05a feat(controller): add SPIRE NICo TPM bootstrap identity controller (#2108)
* feat(controller): add SPIRE NICo TPM bootstrap identity controller

Signed-off-by: Ryan Bever <rbever@nvidia.com>

* fix(controller): accept machine owners across CAPI versions

Parse controller owner API versions and match the Cluster API group instead of requiring the controller’s current version. Reject malformed or unrelated owner references.

Signed-off-by: Ryan Bever <rbever@nvidia.com>

* fix(controller): reconcile deleted NicoMachines

Signed-off-by: Ryan Bever <rbever@nvidia.com>

* fix(controller): clean up unresolved TPM identities

Signed-off-by: Ryan Bever <rbever@nvidia.com>

---------

Signed-off-by: Ryan Bever <rbever@nvidia.com>
2026-11-04 17:48:17 +00:00
Abhay Krishna bcea532293 refactor(capi): read node identity from Machines (#2088)
machine-spire-entry, nico-spiffe and launchlayer-spiffe live in the
capi package, whose controllers are meant to reconcile Kubernetes
state only, but each looked its node up in Postgres: to learn whether
the node uses TLS-JWT, which SPIRE attestation method it was pinned
to, and whether SPIFFE is on.

Publish that on the Machine instead. MachineAnnotations now writes
spire-attestation-method and spiffe-enabled beside agent-connection,
and the API refuses both from operator-supplied metadata. The three
controllers read these annotations and wait while one is missing; the
shared Machine predicate wakes them when one changes.

A new machine-annotations controller copies the three annotations
from the node record onto Machines created before they were written,
and only onto a Machine whose host-id names the node, so existing
clusters converge after an upgrade.

The SPIFFE ID format moves to spiffe.NodeAgentID, which
db.Node.GetSpiffeID now calls, and the LaunchLayer agent path is
exposed as launchlayer.DSXImdsAgentPath.

Signed-off-by: Abhay Krishna Arunachalam <abhaykrishna@nvidia.com>
2026-11-03 11:21:19 -08:00
Ryan Bever 0079021b6c feat(controller): add bootstrap controller configuration (#2086)
Signed-off-by: Ryan Bever <rbever@nvidia.com>
2026-11-03 10:14:23 -07:00
Tjark Rasche ecadd2bec4 fix(controller): skip CAPI clusters NVKE does not manage in nico provider ID controller (#2016)
* fix(controller): skip CAPI clusters NVKE does not manage in nico provider ID controller

The nico provider ID controller watches every NicoMachine and resolved a
tenant client for its CAPI Cluster unconditionally. The DB-backed tenant
client provider looks the cluster up in NVKE's database, so a CAPNICo
cluster created outside NVKE failed with "no cluster row found" on every
reconcile. Check the managed-by label against the configured value first
and skip foreign clusters without error or requeue. NVKE-labelled clusters
still surface a missing cluster row as an error.

Fixes #1994

AI assistance was used to write this change.

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

* fix(controller): treat an empty managed-by value as matching no cluster

With managedByLabelValue empty, an unlabeled CAPI Cluster read the
managed-by label as "" and passed the ownership check. Require the label
to be present and the configured value to be non-empty.

AI assistance was used to write this change.

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

---------

Signed-off-by: Tjark Gunnar Rasche <trasche@nvidia.com>
2026-10-29 15:57:42 +01:00
Ryan Bever fba45dba31 fix(controller): clean up CAPI CRD startup handling (#1955)
* fix(controller): clean up CAPI CRD startup handling

Fail startup when the required CAPI Machine CRD is absent and register Machine-dependent controllers unconditionally after the check.
Keep LaunchLayer optional based on its CRD. Require the NicoMachine CRD when NICo controllers are enabled, and skip its discovery when they are disabled.

Signed-off-by: Ryan Bever <rbever@nvidia.com>

* fix(cli): disable NICo controllers for provisioned bootstrap

Configure the controller chart's NICo controller setting from the selected bootstrap infrastructure provider.
Provisioned sites now disable NICo controllers and avoid requiring the NicoMachine CRD, while NICo sites explicitly enable them. Extend the existing deployment test to verify both provider settings.

Signed-off-by: Ryan Bever <rbever@nvidia.com>

* Review comments

Signed-off-by: Ryan Bever <rbever@nvidia.com>

---------

Signed-off-by: Ryan Bever <rbever@nvidia.com>
2026-10-27 14:44:52 -06: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
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
Abhinav Pandey 32c6d96c7b feat(controller): add an API to point a cluster's nodes at a SPIRE server (#1802)
PATCH /clusters/{clusterID}/spire-server validates the address and port,
stores them in the new clusters.spire_server column, takes the
spire_server_update UpdateInProgress lock and enqueues the
UpdateSpireServer workflow through the workflow outbox, in one
transaction. Repeating the request for the same server while it runs
returns 202 without enqueuing again; any other running operation, or an
update to a different server, returns 409.

The workflow calls the node agent's ReconfigureSpireAgent on every
SPIFFE-enabled node in parallel, then releases the lock and records the
failed nodes in UpdateFailed.

GET /clusters/{clusterID}/spire-server returns the requested server and
each node's SPIRE agent status, read live from the node agents with
bounded concurrency and a per-node timeout. The API server now receives
the node agent client for this.

Signed-off-by: Abhinav Pandey <abhinavmpandey08@gmail.com>
2026-10-21 11:28:24 -07:00
Miancheng Lin 9cd7d0199d feat(controller): exit at startup when the release CRDs are missing (#1230)
* feat(controller): exit at startup when the release CRDs are missing

The worker checks that MachineImage, ClusterRelease and NodePoolRelease are
installed before it serves anything, and exits 1 naming the kind that is not.
There is no retry: every path that starts CWE installs the CRDs first.

A release that a cluster selects but the site has not applied is not gated. It
fails at provisioning time, as it did before.

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

* fix(controller): use the NVKE name for the CRD probe

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

---------

Signed-off-by: Miancheng Lin <mianchengl@nvidia.com>
2026-10-19 16:02:04 +00:00
Meet VadariaandClaude Opus 5.5 47478ebe8f feat: native LaunchLayer provider integration (#1543)
* feat(db): add LaunchLayer provider type and typed payload structs

Per NKX-14085: native typed LaunchLayer integration, mirroring NICo's
existing db-layer pattern exactly. Adds db.ProviderTypeLaunchLayer,
LaunchLayerClusterProvider, LaunchLayerNodePoolProvider (reused for
NodeSet, matching NicoNodePoolProvider's reuse), LaunchLayerControlPlaneProvider,
and LaunchLayerNodeProvider, each with the standard XProvider()/SetX()
accessor pair and clone helper. Extends every ResolveProviderType()
switch with the new case, and every existing SetNico/SetCapi setter to
null out the new LaunchLayer field too.

New migration adds the launch_layer jsonb column to clusters,
node_pools, node_sets, and nodes — control_plane_configurations needs
no migration since its config column is already a single jsonb blob
that can hold a new key without a DDL change.

First of several commits implementing full LaunchLayer provider
support (OpenAPI schema, internal/server wiring, the capability-client
implementations, RBAC, and Tilt dev wiring follow).

Signed-off-by: Meet Vadaria <mvadaria@nvidia.com>

* feat(api): add LaunchLayer OpenAPI schema sections

Per NKX-14085: mirrors NICo's schema pattern exactly — LaunchLayerClusterProvider,
LaunchLayerNodePoolProvider (+Update), LaunchLayerNodeSetProvider (read-only),
LaunchLayerControlPlaneProvider (+Update), LaunchLayerNodeProvider (read-only),
plus the LaunchLayerClusterOwner/LaunchLayerSecurityGroup(Refs) nested shapes
CAPLL's own cluster-level schema needs. Wires a launchLayer sibling field into
the same ~10 container schemas nico is wired into, and extends every
not:anyOf provider-exclusivity block from 2-provider to 3-provider logic
(forbid every pair, plus forbid none on create-time schemas).

make generate / make api-compat-check both pass clean — purely additive,
no breaking change.

Signed-off-by: Meet Vadaria <mvadaria@nvidia.com>

* feat(clients): implement the LaunchLayer capability client

Per NKX-14085: new internal/clients/launchlayer package implementing all
9 ProviderClient capabilities, matching the existing capi/nico shape
exactly (Client struct{} + New(), one file per capability). Registers a
case db.ProviderTypeLaunchLayer in all 9 factory switches.

CAPLL's own Go module (github.com/NVIDIA/cluster-api-provider-launchlayer)
only resolves through this environment's internal proxy, not the real
public proxy.golang.org — unlike cluster-api-provider-nico, which already
made that transition. Per this repo's own "no internal dependency" rule,
LaunchLayerCluster/LaunchLayerMachine manifests are built as plain JSON
objects instead of importing CAPLL's typed API, the same approach the
capi client already uses for a caller-supplied manifest, applied here to
a controller-constructed one.

Notable design points, each confirmed against the actual CAPLL repo
(pulled fresh) rather than assumed:
- CreateMachine calls deps.CreateSpireJoinToken/NodeAgentBootstrapFiles
  the same way the CAPI client does, not NICo's no-SPIRE path — CAPLL is
  a pure bootstrap-Secret pass-through (docs/profile-args.md), so SPIRE
  material has to already be baked into the cloud-init payload.
- TryAdvanceStuckMachine and ResolveNodePoolUpgrade are no-ops, matching
  the CAPI client — CAPLL has no rotation/release-catalog concept.
- UsesFMDSBGPPeerASN is always false — the VPC-prefix compatibility
  signal it reports on is a NICo-only concept.
- ValidateNodePoolPayload/ValidateControlPlaneConfigPayload enforce
  instanceType required + hostOSProfile/vmProfile mutual exclusivity,
  matching #1387's content-validation pattern.

Signed-off-by: Meet Vadaria <mvadaria@nvidia.com>

* feat(server): wire LaunchLayer into cluster/node-pool/control-plane dispatch

Per NKX-14085: adds a third case to every provider-dispatch switch in
internal/server — the request-shape-to-client-call mapping that #1387
established stays in server, not internal/clients. Covers:

- clusters.go: create-time dispatch + field-presence validation
  (validateCreateLaunchLayerClusterProvider), the cluster->db and
  db->api conversions, the update-time mismatched-provider gate
  (generalized from a 2-way nico/infra check to 3-way), and the
  cluster-level control-plane instanceTypePreference-style update path
  (a no-op for LaunchLayer, since every field is immutable per CAPLL).
- node_pools.go: create/update dispatch, field-presence validation,
  db<->api conversions for NodePool. validateUpdatedNodePool's
  clusterIsCAPIBacked() boolean dispatch is generalized to a proper
  3-way switch — it was implicitly treating "not CAPI" as "Nico",
  which would have silently run NICo's disk-selection-strategy check
  against LaunchLayer node pools.
- cluster_control_plane_config.go: the parallel control-plane-config
  dispatch, field-presence validation, and the "merged spec" validator.
- node_sets.go / nodes.go: read-response conversions for NodeSet/Node.

config.go: new InfraProviderLaunchLayer constant, added to the
SUPPORTED_INFRA_PROVIDERS allowlist.

Full test suite passes with zero regressions — confirms the
clusterIsCAPIBacked generalization didn't change NICo/CAPI behavior.

Signed-off-by: Meet Vadaria <mvadaria@nvidia.com>

* feat(chart): grant RBAC for the LaunchLayer CRDs

Per NKX-14085: adds launchlayerclusters/launchlayermachines/
launchlayermachinetemplates to the capi ClusterRole, matching the
existing nicoclusters/nicomachines entries — the controller creates
and reads these objects directly (ClusterScaffold/MachineMaterialization),
the same way it does for NICo's CRDs. Also adds the three CRD names to
the apiextensions.k8s.io existence-check rule.

helm lint / helm template both verified clean.

Signed-off-by: Meet Vadaria <mvadaria@nvidia.com>

* feat(clients): add a 10th capability for the hard-reboot annotation key

Per NKX-14085: the hard-reboot path (applyCAPIMachineRebootAnnotation)
unconditionally wrote NVKE's own nke.nvidia.com/reboot annotation onto
the generic CAPI Machine object. That works for NICo because CAPNico's
--reboot-annotation flag is deployed configured to that same key — but
CAPLL watches a hardcoded infrastructure.cluster.x-k8s.io/reboot-requested
key with no configurable override (confirmed by reading CAPLL's own
controllers/instance_lifecycle.go), so the same unconditional write
would silently never trigger a LaunchLayer reboot.

New RebootAnnotationProvider capability (10th on ProviderClient,
registered the same way as the other 9) resolves the right key per
provider. CAPI/NICo keep today's key unchanged — this is a new
dispatch point, not a behavior change for them, confirmed by the full
test suite passing with zero regressions. Added a dedicated test
proving a LaunchLayer-backed node gets CAPLL's key, not NVKE's.

Signed-off-by: Meet Vadaria <mvadaria@nvidia.com>

* fix(controllerconfig): recognize launchLayer as a supported infra provider

The chart-mounted controller config validator still only accepted
"nico" and "infra" for supportedInfraProviders, so a deployment that
enables the LaunchLayer provider fails config validation at startup.

Signed-off-by: Meet Vadaria <mvadaria@nvidia.com>

* fix(tilt): fix nico dev-loop install script against current kind/helm

kind load docker-image fails against this node image's containerd 2.3.x
("unknown containerd config version: 4 (supported versions: 2 and 3)"):
kind parses `containerd config dump`'s live, migrated schema version,
which containerd 2.3.x reports as 4 even though the on-disk config file
still says 2. Load the image through ctr directly instead, the same
mechanism kind uses internally, skipping its version check.

helm upgrade/install also no longer takes --server-side=false on the
Helm build pinned here; drop it.

Signed-off-by: Meet Vadaria <mvadaria@nvidia.com>

* feat(tilt): add local Tilt dev-environment wiring for the launchlayer provider

Mirrors hack/nico-provider/'s shape: a new hack/launchlayer-provider/
Tiltfile plus an install-capll.sh script that builds the CAPLL manager
and fake-API images from a local cluster-api-provider-launchlayer
checkout, deploys the chart and the 3-service fake LaunchLayer API
(VPC, Compute, security groups) into the shared kind cluster, and
wires the provider into the root Tiltfile's provider-plugin system and
supportedInfraProviders list.

Verified end-to-end against a live Tilt session: a LaunchLayerCluster
and control-plane LaunchLayerMachine provision against the fake API
and reach Ready/Provisioned, and the new mutual-exclusivity and
content validators correctly reject malformed requests.

Signed-off-by: Meet Vadaria <mvadaria@nvidia.com>

* fix(api): waive the structural api-compat break in the Update not-blocks

Forbidding a third provider pair on UpdateClusterControlPlaneConfig and
UpdateNodePoolRequest needs their bare `not: {required: [...]}` turned
into `not: {anyOf: [...]}}`. The structural differ reads that as the
original `required` property being removed, but no request valid under
the old schema becomes invalid: every pair it forbade is still
forbidden, and the new pairs only involve the brand new `launchLayer`
field, which no existing client could have been sending.

Tried keeping `not.required` untouched and adding the new pairs via a
sibling `allOf` instead (logically equivalent by De Morgan's), since
that avoids the compat break without a waiver. It breaks
oapi-codegen's generated type for both schemas into an untyped
interface{}, so it is not viable here.

Signed-off-by: Meet Vadaria <mvadaria@nvidia.com>

* fix(chart): split nico and LaunchLayer RBAC into their own files

A deployment that enables only one typed provider was still getting
ClusterRole permissions for the other's CRDs and for LaunchLayer's,
since capi.rbac.create granted all of them unconditionally. Split
rbac-capi.yaml's nico and launchLayer rules into their own
ClusterRole/ClusterRoleBinding pairs, each independently gated by a
new capi.rbac.nico / capi.rbac.launchLayer value (both default true,
so capi.rbac.create=true keeps granting everything it did before
unless a deployment opts a provider out).

rbac-capi.yaml keeps the provider-agnostic CAPI rules (machines,
clusters, the finalizers subresource) and the provisioned-provider
rules, which this change leaves alone.

Signed-off-by: Meet Vadaria <mvadaria@nvidia.com>

* revert: drop the unneeded kind-load ctr workaround

The "unknown containerd config version: 4" failure was my local kind
CLI (v0.29.0) being too old for this node image's containerd 2.3.x,
not a repo-level incompatibility -- confirmed by testing plain `kind
load docker-image` again after upgrading to kind v0.33.0, which loads
cleanly with no workaround. Revert both scripts to the plain kind-load
call; keep the --server-side removal from the same earlier commit,
since that one is a real mismatch against the Helm build pinned here
and is unrelated to the kind version.

Signed-off-by: Meet Vadaria <mvadaria@nvidia.com>

* fix: close three LaunchLayer gaps the lint exhaustiveness checks caught

- internal/kube/tenant_client.go: ClientForDBCluster had no case for
  db.ProviderTypeLaunchLayer and fell into the "unsupported provider
  type" default, so any code path needing a LaunchLayer cluster's
  tenant client would have failed outright. LaunchLayer clusters have
  no pre-tenant-access legacy path to fall back to, so this always
  goes through clientFromTenantAccessSecret, same as CAPI.
- internal/server/clusters.go: createInitialNodePools copied Nico and
  Infra from each initial node pool's config into the create request
  it builds, but not LaunchLayer -- a LaunchLayer cluster created with
  initial node pools would have silently dropped their launchLayer
  payload.
- internal/server/node_pools.go: validateUpdatedNodePool's switch
  routed anything that wasn't CAPI or LaunchLayer to Nico's validator
  through its default case, rather than naming Nico explicitly -- the
  same implicit-default pattern already generalized elsewhere this
  epic. A genuinely unknown future provider type would have silently
  gotten Nico's validation instead of being rejected.

Also extracted UpdateCluster's controlPlaneConfig provider-match
rejection into validateUpdateControlPlaneConfigProviderMatch: adding
the LaunchLayer branch pushed the function to cyclomatic complexity 49
/ maintainability index 19 (confirmed this function was lint-clean on
main before this branch's changes), well past this repo's linters.

Signed-off-by: Meet Vadaria <mvadaria@nvidia.com>

* style(clients): fix golangci-lint findings in the launchlayer package

- goconst: the "name" JSON-manifest key appeared 3 times across
  scaffold.go/machine.go; extracted nameKey.
- grouper: two ungrouped single const declarations.

No behavior change -- caught by CI's lint job, not run locally before
this fix since make lint was never run as part of local verification
during implementation.

Signed-off-by: Meet Vadaria <mvadaria@nvidia.com>

* fix(api): add missing property descriptions and fix exhaustruct in test/e2e

The controller/api lint job runs the openapi-lint spec linter in
addition to golangci-lint; it failed with 15
property-description-present violations across the LaunchLayer
schemas (securityGroups, securityGroupRefs' two fields, and all four
fields each on LaunchLayerNodePoolProviderUpdate,
LaunchLayerNodeSetProvider and LaunchLayerControlPlaneProvider --
descriptions existed on the base Create-variant schema but were never
copied onto its Update/NodeSet/ControlPlane siblings).

test/e2e is a separate Go module with its own golangci-lint job;
nodePoolRequest had the same Nico/Infra-but-not-LaunchLayer gap
internal/server/clusters.go's createInitialNodePools had, caught by
exhaustruct in that module's own lint run rather than controller's.

Neither of these ran as part of local verification during
implementation -- make lint only covers the controller module, not
controller/api or test/e2e, which are separate Go modules with their
own golangci-lint jobs in CI.

Signed-off-by: Meet Vadaria <mvadaria@nvidia.com>

* fix(name-check): allowlist the embedded swagger blob's incidental hits

oapi-codegen embeds the full OpenAPI spec in controller/api/server.gen.go
as a gzipped, base64-encoded blob for /openapi.yaml to serve at
runtime. Adding descriptions to the LaunchLayer schema in this PR
reflowed that blob's bytes and happened to produce a 3-character,
case-insensitive "nke" token inside it by chance -- not a name
reference, and not something any future spec edit is guaranteed to
avoid either.

Signed-off-by: Meet Vadaria <mvadaria@nvidia.com>

* fix(api): make LaunchLayer node-pool fields fixed at creation, like NICo

LaunchLayerNodePoolProviderUpdate exposed all 5 of its properties
(instanceType, hostOSProfile, vmProfile, fulfillmentStrategy,
securityGroupRefs) while its own description called all 5 "fixed at
creation" -- a contract the server never enforced. Updating any of
them silently persisted and could trigger a replacement node set with
the changed creation-fixed settings (code-review finding, "Major").

NICo already solves this same problem for its own fixed-at-creation
fields (instanceTypeID, partitions, sshKeyGroupIDs) by not exposing
them in NicoNodePoolProviderUpdate at all, rather than conditionally
allowing them up to some point and rejecting them after. Match that
precedent instead of building new Compute-submission-state tracking
NVKE has nowhere else: LaunchLayerNodePoolProviderUpdate now carries
no properties, same shape LaunchLayerControlPlaneProviderUpdate
already had. node_pools.go's applier becomes a no-op for launchLayer,
matching the existing no-op already written for the control-plane
side. Fixed both Update schemas' descriptions to drop the "once a
Compute request has been submitted" conditional language that was
never enforced.

Also added the missing LaunchLayer case to
nodePoolReplacementConfigChanged (code-review finding, "Minor"): its
switch fell through to the "assume changed" default for LaunchLayer,
so an unrelated field change (e.g. maxSurge alone) on a LaunchLayer
node pool could incorrectly be treated as needing a replacement node
set, which NodePoolNeedsNewNodeSet and validateControlPlaneRollout
could then act on.

Signed-off-by: Meet Vadaria <mvadaria@nvidia.com>

* fix(temporal): mark the reboot-annotation provider lookup non-retryable

clients.GetRebootAnnotationProvider returns a deterministic error for
an unsupported cluster.ProviderType -- a pure in-memory switch, no I/O
and no transient cause. The activity returned it unwrapped, so
Temporal's default retry policy would retry it indefinitely, unable
to ever succeed (code-review finding, "Minor"). a.GetCluster's own
error is left alone: it already wraps a "not found" error as
non-retryable internally.

Signed-off-by: Meet Vadaria <mvadaria@nvidia.com>

* fix(name-check): drop the now-dead server.gen.go allowlist entry

The schema edit in the previous commit reflowed server.gen.go's
embedded swagger blob again, and this time it does not contain an
incidental "nke" token -- so the entry added for the last reflow now
matches nothing and fails the check as dead, per name-check.py's own
design (an allowlist entry must match a real, current hit; it cannot
stand as a guard against a hypothetical future one). If a later
openapi.yaml edit reflows the blob into containing a hit again, that
needs its own fresh entry at that time, not a reinstatement of this one.

Signed-off-by: Meet Vadaria <mvadaria@nvidia.com>

* fix(clients): remove SPIRE join-token attestation from LaunchLayer

deps.CreateSpireJoinToken already only mints a token when a node is
specifically configured for join-token attestation (code-review
comment), so this wasn't creating tokens unconditionally. But CAPLL
is the production-target provider here, unlike CAPI (dev/test-only),
so leaving join-token attestation reachable for it even as a
configurable option is the real risk, not just whether it's the
active default.

CreateMachine no longer calls deps.CreateSpireJoinToken at all.
renderBootstrapUserData rejects a node configured for join-token
attestation outright, with a LaunchLayer-specific error, instead of
silently proceeding to render a SPIRE agent config with no join_token
value and no NodeAttestor plugin at all -- which is what would have
happened just from removing the template's join-token branches
without this guard. The template itself drops the join_token stanza
and its NodeAttestor, so there is no path to one reachable even if
the guard were ever bypassed.

Tested all three attestation methods (tpm, dsxImds, and the
join-token rejection) against the actual rendered template output,
plus the existing SPIFFE-disabled no-op path.

Signed-off-by: Meet Vadaria <mvadaria@nvidia.com>

* fix(launchlayer): register SPIRE identity and node identity for LaunchLayer machines

Nothing wrote nke.nvidia.com/spire-agent-spiffe-id-path onto a
LaunchLayer-backed Machine, so on a SPIFFE-enabled site
MachineSpireEntryController never created its ClusterStaticEntry and the
node agent could never authenticate. LaunchLayerSpiffeController now
writes it before join. The path is the dsx_imds agent ID DSX gives a
LaunchLayer bare-metal instance,
/spire/agent/dsx_imds/tenant/<orgID>/bm/<instanceID>, built by the
LaunchLayer client's new SpireAgentPathProvider capability from
LaunchLayerCluster.status.vpc.orgID and LaunchLayerMachine.status.instanceID,
so the controller holds only the watch and Machine wiring. A test drives
a SPIFFE-enabled LaunchLayer Machine through both controllers to its
ClusterStaticEntry.

A SPIFFE-enabled LaunchLayer node can attest only through dsxImds: the
Compute API reports no TPM endorsement key, and join-token is not
offered for this provider. The new NodeAgentProfileValidator capability
holds that rule in the LaunchLayer client. Cluster creation rejects a
LaunchLayer cluster with 400 on a deployment whose node-agent profile
the rule refuses, instead of accepting a cluster whose nodes never join.
CreateMachine checks the node's own pinned profile again, now before
anything is applied, and returns ErrUnsupportedMachineConfig, which the
activity marks non-retryable, so a rejected node no longer retries
forever leaving an orphan LaunchLayerMachine.

The post-ready identity readback wrote every provider's instance IDs into
node.Nico. It now goes through NewNodeProvider.ApplyObservedNodeIdentity,
so a LaunchLayer node records instance, machine and rack IDs in its
launchLayer payload, and the provider clients read their own status
fields. NICo and CAPI behaviour is unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Meet Vadaria <mvadaria@nvidia.com>

* fix(server): reject a launchLayer payload on NICo and CAPI pool updates

UpdateNodePoolRequest promises a 400 for a provider payload that does not
match the pool's cluster, but the NICo and CAPI branches never checked
launchLayer, so PATCH {"launchLayer":{}} on such a pool succeeded and
changed nothing.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Meet Vadaria <mvadaria@nvidia.com>

* fix(hack): keep --server-side=false on the CAPNICo Helm installs

Dropping it switched the CAPNICo installs to server-side apply under the
pinned Helm 4.2.4, for the NICo e2e lane and Tilt, where the later
kubectl patch of the manager args can conflict on a rerun. The change
was unrelated to LaunchLayer; this restores main's version of the script.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Meet Vadaria <mvadaria@nvidia.com>

* docs: document the LaunchLayer provider and how to enable it

The Clusters tag and the infrastructure-providers page still said NICo
was the only provider, while the API reference and chart RBAC present
launchLayer. Both now describe it, and the page covers enabling it:
supportedInfraProviders, capi.rbac.launchLayer, and dsxImds attestation
on a SPIFFE-enabled deployment. The supportedInfraProviders comment
names launchLayer, and the chart README gains the capi.rbac.nico and
capi.rbac.launchLayer rows with the updated capi.rbac.create and
supportedInfraProviders descriptions. The controller
README gains a LaunchLayer Tilt section. The node-pool schema says "at
most one" of hostOSProfile and vmProfile, matching the validator, and
the control-plane provider is "Fixed at creation."

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Meet Vadaria <mvadaria@nvidia.com>

* fix: guard a nil LaunchLayer pool update and document capi.rbac.create

validateUpdateLaunchLayerNodePoolRequest dereferenced a nil update body,
which the surrounding update path treats as a no-op. The generated HTTP
handler never passes nil, but the validator now matches its callers.

The LaunchLayer RBAC renders only when capi.rbac.create and
capi.rbac.launchLayer are both true, and capi.rbac.create defaults to
false, so the enabling steps now list it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Meet Vadaria <mvadaria@nvidia.com>

* fix(server): close LaunchLayer validation gaps

Several LaunchLayer requests were accepted with 201 and only failed later,
inside CAPLL or at node join, where nothing reports the cause back to the
caller.

Node-pool create and a control-plane desiredCount increase now run the same
node-agent profile check as cluster create, through one shared function. A
cluster created while SPIFFE was off could otherwise gain pools or
control-plane nodes after SPIFFE was enabled with tpm or joinToken, and
every one of those nodes would fail to join.

Cluster create now rejects security groups that CAPLL's CRD would refuse:
the name pattern and length are in the schema, and the server checks that
networkType is set exactly for VIRTUALIZED groups, that names are unique,
and that a VIRTUALIZED group is not placed in a BARE_METAL VPC. Without
this, ApplyCAPIClusterResources gets 422 and the provisioning workflow
retries forever. securityGroupRefs on node pools and the control plane
must name one of the cluster's groups, and cloudProviderEnabled true is
rejected because NVKE runs no cloud controller manager to set the Node's
provider ID.

The schema now marks siteID and instanceType as required, which the server
already enforced, and corrects descriptions that claimed NVKE applies
CAPLL's vpcType default or that some fields stay mutable. No published API
tag contains a LaunchLayer schema, so this is not a breaking change.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Meet Vadaria <mvadaria@nvidia.com>

* fix(launchlayer): register the SPIFFE controller by CRD, skip it without SPIFFE, apply in order

LaunchLayerSpiffeController was registered only while supportedInfraProviders
listed launchLayer. That list gates admission of new clusters; removing
launchLayer from it to stop new clusters also stopped the controller, so
scale-ups and replacements on existing SPIFFE clusters never got an agent
path and never joined. The controller now runs whenever the Machine and
LaunchLayerMachine CRDs are installed.

SpireAgentPath ignored node.SpiffeEnabled. With SPIFFE off and the method
left at dsxImds it still wrote a path and requeued every 30 seconds while
the organization was pending. It now supplies no path without SPIFFE.

CreateMachine built the CAPI Machine after applying the LaunchLayerMachine
and the bootstrap Secret, so a build error left both behind and was
retried, contrary to its comment. Every object is now built before the
first apply.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Meet Vadaria <mvadaria@nvidia.com>

* docs: correct LaunchLayer enablement and Tilt setup

The site guide and chart docs described a LaunchLayer setup that does not
work as written.

nodeAgent.spireAttestationMethod applies to every provider's new nodes, and
NICo accepts any method, so the guide's "nico,launchLayer" example would pin
a TPM-attested NICo site's new nodes to dsxImds; they would fail only when
they attest. The guide and the supportedInfraProviders value now say so,
and tell operators to append launchLayer to the existing value rather than
replace it.

The guide also omitted settings the deployment needs: operatorTenant and
endpoint with dsxImds, the SPIRE server's dsx_imds node attestor and the
node-side agent plugin and checksum, tenantAccess.enabled (LaunchLayer
reaches the tenant API only through that Secret), and keeping
capi.rbac.launchLayer true while CAPLL's CRDs exist, now that the
LaunchLayer SPIFFE controller is registered by CRD. capi.rbac.nico=false
likewise requires the NICo controllers to be off. The "Order Matters"
section now names CAPLL and the fourth CRD-gated controller.

The controller README's LaunchLayer Tilt example set only the attestation
method, which the chart refuses to render without operatorTenant; it now
enables the dsx-imds-attestation provider, which sets everything. The
Tiltfile header lists the launchlayer provider, the capnico-crds fixture
no longer claims the chart grants NICo RBAC unconditionally, and the chart
provider assertions cover a nico,infra,launchLayer value and both RBAC
toggles.

The four LaunchLayer waivers now record controller/api/v0.0.45, the newest
published API tag.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Meet Vadaria <mvadaria@nvidia.com>

* docs: describe NICo as the default provider, not the only one

The API reference, the site guide and the chart describe LaunchLayer as a
supported provider that a deployment accepts once its operator enables
it, but five other places still said NICo is the only infrastructure
provider: the preview-status limitations, the NICo provider page, the
installation plan, the supported-platforms table and the docs glossary.
They now say NICo is the default and LaunchLayer is supported once
enabled, linking to the LaunchLayer enabling section.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Meet Vadaria <mvadaria@nvidia.com>

* refactor(launchlayer): adopt the nvke.nvidia.com keys

#1713 moved NVKE's label and annotation keys into internal/keys: they are
written under nvke.nvidia.com and read under either domain. The rebase
onto it left this branch on the removed constants.

LaunchLayerSpiffeController reads host-id and the SPIRE agent path with
Value and writes the path with String(), as NicoSpiffeController does.

The reboot key had become a list on main (both domains, so CAPNICo keeps
reacting while its --reboot-annotation names the legacy key), while this
branch's RebootAnnotationProvider returned one key. It now returns
HardRebootAnnotationKeys: both domains for NICo and CAPI, which keeps
main's behaviour, and CAPLL's one fixed key for LaunchLayer. The
activity writes each key to request a reboot and drops them to clear it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Meet Vadaria <mvadaria@nvidia.com>

* feat(launchlayer): implement TenantAPIAccess and NodeMachineIDLabel

#1684 added both capabilities to ProviderClient with CAPI and NICo
implementations, so GetProviderClient failed with "unsupported provider
type" for every LaunchLayer cluster, not only at tenant access and node
labelling.

LaunchLayer reaches the tenant API through the published tenant-access
Secret (it has no node-agent fallback), and its machine-ID label is the
physical machine ID CAPLL records, empty on virtual machines.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Meet Vadaria <mvadaria@nvidia.com>

* refactor(clients): compose every capability in ProviderClient

ProviderClient composes every settled capability, as the #1684 review
pointed out, but NodeAgentProfileValidator and SpireAgentPathProvider
were outside it. GetProviderClient now resolves both, and its test checks
every capability for CAPI, NICo and LaunchLayer.

The reboot-annotation activity and LaunchLayerSpiffeController have the
cluster in scope, so they resolve the root client instead of calling a
single factory. The API validators keep their factory calls, as main's
other validators do.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Meet Vadaria <mvadaria@nvidia.com>

* fix(launchlayer): reject vmProfile and check pool scale-up for node-agent profile

A SPIFFE-enabled LaunchLayer node attests through DSX IMDS, which
identifies bare-metal instances only. A vmProfile node got a /bm/ agent
path it could never attest to and hung. ValidateNodeAgentProfile now
takes the node pool and rejects vmProfile unless external mTLS carries
the node-agent connection without an SVID. NICo and CAPI ignore the pool.

The check runs on every path that adds nodes:
- node-pool create and cluster create (each initial pool)
- the control plane at cluster create and scale-up, through the pool
  ControlPlaneConfigNodeProvider builds from its spec
- node-pool scale-up through desiredNodeCount, which was not checked
  before
- CreateMachine, for a node created outside the API

An unknown provider in a control-plane update now gets "unsupported
cluster provider" instead of "please provide " with an empty name.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Meet Vadaria <mvadaria@nvidia.com>

* refactor(launchlayer): drop checks the API and NVKE already guarantee

buildInfraMachine re-checked instanceType, which the schema and the
node-pool and control-plane validators already require. readStatusString
checked the group and kind of infrastructure references NVKE writes
itself, on a controller that only runs for LaunchLayer clusters.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Meet Vadaria <mvadaria@nvidia.com>

* chore: satisfy interfacebloat and wastedassign

ProviderClient has one accessor per settled capability, so it grows past
the linter's 10 as capabilities move into it; it carries a reasoned
nolint like the agent client. The provider-match switch now returns on an
unknown provider, so its empty initial values were never read.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Meet Vadaria <mvadaria@nvidia.com>

---------

Signed-off-by: Meet Vadaria <mvadaria@nvidia.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-19 17:59:43 +02:00
pbikki 7845898d0e feat(controller): apply node pool labels and taints to nodes (#1672)
* feat(controller): add ApplyNodeMetadata activity for node pool labels and taints

Signed-off-by: pbikki-nv <50849668+pbikki@users.noreply.github.com>

* feat(controller): apply node pool labels and taints during node join

Signed-off-by: pbikki-nv <50849668+pbikki@users.noreply.github.com>

* feat(controller): backfill config-profile labels into stored node labels

Add a one-time migration that copies each referenced config profile's
labels into node_pools.node_labels and control-plane configurations'
node_labels, reading profiles from the controller's mounted profiles
directory. migrations.Migrate now takes the profiles directory, and the
worker passes cfg.ProfilesDir

Signed-off-by: pbikki-nv <50849668+pbikki@users.noreply.github.com>

* feat(controller): stop applying labels from config profiles

Config-profile labels are now stored on node pools and control-plane configurations and applied by ApplyNodeMetadata.

Signed-off-by: pbikki-nv <50849668+pbikki@users.noreply.github.com>

* chore(controller): drop config profile labels from profile parsing and docs

Signed-off-by: pbikki-nv <50849668+pbikki@users.noreply.github.com>

* docs: describe how node labels and taints are applied

Signed-off-by: pbikki-nv <50849668+pbikki@users.noreply.github.com>

* test(e2e): check node pool and control-plane labels and taints on tenant nodes

Signed-off-by: pbikki-nv <50849668+pbikki@users.noreply.github.com>

* chore(api): regenerate server code after rebase

Signed-off-by: pbikki-nv <50849668+pbikki@users.noreply.github.com>

* fix(controller): fail the label backfill until config profiles are mounted

Signed-off-by: pbikki-nv <50849668+pbikki@users.noreply.github.com>

* chore(controller): remove metadata validation in workflow

same validation exists at API boundary. For workflow, rely on the Kubernetes API to reject invalid node labels and taints. Add notes about migrations dependecny on cfg field

Signed-off-by: pbikki-nv <50849668+pbikki@users.noreply.github.com>

* docs(api): reword the configProfile description

Signed-off-by: pbikki-nv <50849668+pbikki@users.noreply.github.com>

---------

Signed-off-by: pbikki-nv <50849668+pbikki@users.noreply.github.com>
2026-10-16 23:03:42 -04:00
Terry Howe 6e8871aa40 feat!: make the management namespace configurable and default it to nvke-system (#1698)
* feat(controller): make the management namespace configurable

The shared management-plane namespace was the compile-time constant
constants.NamespaceNVKESystem. It is now the nke-controller-config key
managementNamespace, read through config.Config.ManagementNamespaceOrDefault
and threaded to what addresses that namespace: the tenant-access publish and
Secret-reconcile paths, the nke-rbac read, the CAPI cluster and machine
activities, failure-domain discovery, the Teleport token controller, the OIDC
rollout operation and the Secret cache the manager builds.

An unset key resolves to nke-system, which is what a config.yaml written before
the key existed decodes to, so a controller upgrade alone never moves a site.
The old constant is renamed LegacyManagementNamespace to say which of the two
it is.

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

* feat(chart): default the management namespace to nvke-system

nvkeSystemNamespace.name is new and defaults to nvke-system. One helper,
controller.managementNamespace, feeds the Namespace object, the nke-rbac
ConfigMap, the Role and RoleBinding scoped to it and the managementNamespace
key the controller reads, so the grant and the namespace it covers cannot
drift apart.

This moves the default a new install gets. The old namespace is not also read,
so a site installed before the value existed must pin nvkeSystemNamespace.name
to nke-system before it upgrades; the chart README says so and
chart-identity-assertions.py now renders that pin and asserts every object and
the controller config land on it.

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

* feat(cli): read kubeconfig Secrets from a configurable namespace

nvkectl get kubeconfig reads nvke-system and then nke-system, so it finds the
Secret whether or not the site has pinned the old management namespace, and
--namespace names one outright. The error from a miss names the last namespace
searched rather than reporting only the first.

The bootstrap engine installs the chart with default values, so its own
constant moves to nvke-system with the chart default.

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

* chore: move the greenfield deploy, e2e and docs to nvke-system

The base-config Namespace manifests, Tilt, the e2e lanes, the CI helper scripts
and the user-facing docs all name the management namespace. They describe a new
install, so they follow the chart default. Nothing here is read by a site that
has pinned nke-system.

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

* fix: address review feedback

fix: address CI failures
Signed-off-by: Terry Howe <thowe@nvidia.com>

* fix: address CI failures

The CLI falls back from nvke-system to nke-system and its not-found error names the last namespace tried, so the smoke test accepts either.

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

---------

Signed-off-by: Terry Howe <thowe@nvidia.com>
2026-10-16 20:23:38 -04:00
Eric Staples 5c095369f5 refactor(controller)!: remove control-plane controller flag and node-pool control plane path (#1608)
* refactor(controller)!: remove control-plane controller flag and node-pool control plane path

Control planes are always provisioned by the control-plane controller.
Remove PROVISION_CONTROL_PLANE_WITH_CONTROL_PLANE_CONTROLLER, the flag-off
node-pool provisioning branches, and the e2e plumbing that toggled it. Run the
control-plane migration unconditionally on worker boot.

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

* refactor(controller): remove unused NodePoolUpgradeConfig provider capability

The control-plane reconciler no longer resolves node-pool upgrades, so the
capability, its capi and nico implementations, and the factory that
GetProviderClient ran on every resolve have no callers.

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

* refactor(controller): count surge nodes from the in-memory control plane

reconcileNodesNeedingRollout re-listed the cluster's control-plane nodes to
count controller-managed ones, duplicating the list readControlPlane already
loaded for the same reconcile.

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

* fix(controller): guard nil controlPlaneConfig before reading desiredCount

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

* docs(controller): tighten MigrateControlPlaneToController doc comment

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

* fix(controller): skip clusters with no snapshot source in the migration leftover check

A non-deleting cluster with no configuration_id whose only control-plane
pools are deleting cannot be snapshotted, so its pooled nodes stayed pooled
and tripped the fail-closed check, blocking worker startup.

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

* test(controller): cover MigrateControlPlaneToController against Postgres

The re-parent, deprecated-generation and cleanup SQL is Postgres-only and had
no coverage. The test runs it on a fresh database named by
NVKE_TEST_POSTGRES_DSN and skips when that is unset.

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

* fix(controller): warn for each cluster the control-plane migration skips

A non-deleting cluster with pooled control-plane nodes, no configuration snapshot and no active control-plane pool has nothing to migrate from, so the leftover check skips it. Log a warning per skipped cluster with its ID, name and pooled node count so the skip is visible.

MigrateControlPlaneToController now takes a logger.

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

* test(controller): use the nvke name in control-plane test fixtures

name-check rejects the legacy product name in new lines.

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

---------

Signed-off-by: Eric Staples <estaples@nvidia.com>
2026-10-14 18:38:29 -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
Alexander Greene 3038cf917c feat(controller): gate new Calico clusters (#1599) 2026-10-14 07:19:24 -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
Davanum SrinivasandClaude Fable 5.1 6029bf16ab chore: say NVKE in the comments and display text that still said NKE (#1470)
* chore: say NVKE in the comments that still said NKE

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

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

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

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

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

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

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

---------

Signed-off-by: Davanum Srinivas <dsrinivas@nvidia.com>
Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
2026-10-10 18:28:35 -04:00
Davanum SrinivasandClaude Fable 5.1 4409efc29b build: move the Go module paths and repository URLs to dsx-ai-factory/nvke (#1449)
The repository was renamed from dsx-ai-factory/nke to dsx-ai-factory/nvke
on 2026-10-10. Its id is unchanged, so guards, rulesets, environments and
the OIDC subject carried over, and GitHub redirects the old URLs. The
tree still named the old repository where the name is a contract rather
than a URL: the module lines of the 12 Go modules and about 1,700 import
lines, the proto go_package (embedded in node_agent.pb.go, regenerated
here), both THIRD_PARTY_NOTICES.md files (regenerated), the lint
local-prefix and depguard entries, ldflags, the go-licenses ignore lists,
the documented repository URLs and gh commands, and the
ghcr.io/dsx-ai-factory/nke image paths in workflows, the chart default
and the e2e defaults.

Only the organisation and repository segments change. Directories,
identifiers, binary, image, chart, package, label, namespace and
environment variable names, the CODEOWNERS team slugs and CHANGELOG.md
stay as they are.

Closes #1448

Signed-off-by: Davanum Srinivas <dsrinivas@nvidia.com>
Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
2026-10-10 16:03:26 -04:00
Abhay Krishna d91db50b78 feat(controller): pin fleet-wide OIDC providers at cluster creation (#1426)
Signed-off-by: Abhay Krishna Arunachalam <abhaykrishna@nvidia.com>
2026-10-09 15:42:09 -07:00
Aaron Patten 48f5cab857 chore(controller): say controller, not CWE, in comments and log text (#1393)
Signed-off-by: Aaron Patten <apatten@nvidia.com>
2026-10-09 09:49:33 -06:00
Abhay Krishna 97cc189dec feat(controller)!: mount nke-controller-config and load it at startup (#1325)
BREAKING CHANGE: The chart refuses an env entry for a setting
nke-controller-config carries. Set it through its chart value instead.

Signed-off-by: Abhay Krishna Arunachalam <abhaykrishna@nvidia.com>
2026-10-08 13:22:34 -07:00
Miancheng Lin 0f709ef431 feat(controller): resolve OS profiles from the releases and provide them locally (#1165)
* feat(controller): resolve OS profiles from the releases

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

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

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

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

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

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

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

---------

Signed-off-by: Miancheng Lin <mianchengl@nvidia.com>
2026-10-08 13:06:31 -07:00
Anisha Gupta USandClaude Sonnet 5.5 911174fb9c feat(controller): propagate request trace context through the Temporal outbox (#1030)
* feat(controller): trace API requests through the Temporal outbox

Signed-off-by: Anisha Gupta <anisgupta@nvidia.com>

* fix(controller): classify context errors in tracing outcomes

Record raw and wrapped context.Canceled/DeadlineExceeded activity returns as
canceled/timed_out instead of failed, and share the worker options between
NewWorker and the tracing smoke test so the test exercises the production
interceptor wiring. Mark go.opentelemetry.io/otel/trace as a direct dependency.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>

* fix(controller): let the tracing smoke test resolve public modules

The workspace no longer commits a vendor tree, so running the test with
GOPROXY=off failed at setup in CI with "module lookup disabled".

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>

* refactor(controller): correlate by trace ID instead of a separate operation ID

Every API request already starts or continues its own trace, and no client
(nkectl included) propagates one trace across several requests, so the
server-generated operation ID duplicated the trace ID. Drop it, along with the
Temporal context propagator and logger wrappers that carried it, and key the
smoke test, CI summary and README on trace_id.

Without the request copy the old middleware made, otelhttp now sees the mux
route and names the span "POST /api/clusters".

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>

* refactor(controller): restore outbox trace context once per entry

Restore each entry's trace context once at the top of the batch loop and reuse
it for dispatch, the mark-processed call and both error logs, instead of
restoring it four times.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>

* test(controller): move the tracing e2e test into e2e and drop the POC naming

Run the trace-propagation test with the shared e2e framework (PostgreSQL and a
Temporal dev server, no Docker) next to the gofail suite, so it runs in the
existing Gofail E2E gate lane through `make e2e-gofail`. Add `make e2e-tracing`
for running it alone. The test creates its own database because CI shares one
PostgreSQL server across the e2e suites.

Drop the Jaeger/compose runner, the demo README, and the dedicated CI job; the
test asserts on an in-memory span recorder, so no collector is needed.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>

* test(controller): cover outbox trace propagation and outcome logging with unit tests

Add unit tests, in the style of the surrounding packages, for:
- the outbox processor: each entry continues its own request's trace, legacy
  rows without a trace context still dispatch, a failed start is recorded on the
  dispatch span and leaves the entry pending, and an already-started workflow is
  marked processed;
- OutcomeInterceptor, through Temporal's in-process test environment: success,
  a retried activity, a permanent failure, and continue-as-new;
- CreateWorkflowOutboxEntry storing the request's trace context, and rows
  without one still loading;
- the request log fields and X-Trace-ID header through NewServer;
- NormalizeLogAttr key mapping.

MockTx gains the two outbox methods the processor calls.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>

* fix(controller): address review feedback on outcome levels, dispatch span, and HTTP outcome

- Log a canceled workflow or activity attempt at Warn instead of Error, so a
  worker shutdown or a user cancelling does not trip error-level alerting;
  failed and timed_out stay at Error.
- Run the outbox mark-processed write under the outbox.dispatch span, so its SQL
  and logs carry the dispatch span rather than the request span. Both steps now
  live in dispatchEntry, which also records a mark failure on the span.
- Report an HTTP 4xx as outcome=rejected and only a 5xx as failed, so client
  errors do not mix with real failures in dashboards.
- Assert in the e2e test that a log line never carries a duplicate trace_id or
  span_id key.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>

---------

Signed-off-by: Anisha Gupta <anisgupta@nvidia.com>
Co-authored-by: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-06 17:42:36 -04: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
Eric Staples 4140aa2cc7 feat(controller): spread control-plane machines across failure domains (#358)
* feat(controller): spread control-plane machines across failure domains

Select least-used CAPI failure domains through an extensible strategy and serialize placement per cluster so concurrent provisioning stays balanced.

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

* refactor(controller): rename failure-domain strategy to selection

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

* fix(controller): count observed failure-domain placement

Cluster API v1beta2 splits the request from the observation: the Machine
controller copies InfraMachine status.failureDomain into
Machine.status.failureDomain, and CapNICo now fills that in from the label on
the NICo Machine it was actually assigned
(NVIDIA/cluster-api-provider-nico#99). Spread accounting reads the observed
domain first, so a machine placed before any request, or one whose label drifted
after placement, still counts against the domain it occupies.

A deleting machine releases its NICo machine, so it no longer counts. Including
it pushed the replacement out of the domain the replacement should refill.

Point the tests at nke-system: CAPI objects moved to the shared namespace (#227)
while this branch was open.

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

* feat(controller): enable NICo failure-domain discovery

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

* fix(controller): refine failure-domain selection

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

* refactor(controller): persist failure-domain selections

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

* refactor(controller): clarify failure-domain lifecycle

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

* refactor(controller): make failure-domain placement a single writer

Placement now happens in one step with one owner, instead of being threaded
through the reconcile as mutable state.

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

* Remove failureDomainErr from reconciler struct
Move defferred info log to applyFailureDomains caller

* Add comments

* Rewrite the patch logic for clarity

* Collapse failure domain logic in the reconciler to a single failureDomain pointer

* Move tests to align with tested helper funcs

* refactor(controller): assign failure domains at node creation

Persist each control-plane node's failure-domain decision in its initial database row and share one allocator across desired-count and upgrade-surge creation. Defer only creation or backfill work that actually needs unavailable domain information while allowing unrelated reconciliation to continue.

Keep discovery, migration backfill, and new placement within the serialized control-plane reconcile so allocation uses one consistent view. Retain the scheduler guard for pre-existing nullable rows until their decisions have been backfilled.

* refactor(controller): assign failure domains at node creation

Persist each control-plane node's failure-domain decision in its initial database row and share one allocator across desired-count and upgrade-surge creation. Defer only creation or backfill work that actually needs unavailable domain information while allowing unrelated reconciliation to continue.

Keep discovery, migration backfill, and new placement within the serialized control-plane reconcile so allocation uses one consistent view. Retain the scheduler guard for pre-existing nullable rows until their decisions have been backfilled.

* fix(controller): use configured field manager for CAPI machines

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

* refactor(controller): simplify control-plane failure-domain placement

Fail reconciliation when failure-domain discovery fails so the full database transaction retries instead of selectively deferring placement.

Seed least-used counts from CAPI Machine observations and persisted node requests without backfilling legacy rows. Allow pending nodes without a stored domain through the scheduler, and treat an empty request as no explicit domain for legacy surge nodes.

* refactor(controller): store node failure domains as non-null strings

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

---------

Signed-off-by: Eric Staples <estaples@nvidia.com>
2026-10-01 20:49:19 +00:00
vwilson-nvidia 37cd328428 feat(controller): pin node agent security profile per node (#1093)
- Persist each node's SPIRE attestation method, external mTLS, and TLS/JWT settings at creation.
- Use the pinned profile for bootstrap, reconciliation, and agent connections.
- Support mixed TPM and DSX IMDS nodes in the local Tilt setup.

Signed-off-by: Vivin Wilson <vwilson@nvidia.com>
2026-09-29 20:35:08 +00:00
John Griffith 533d4cb6e9 refactor(controller): dial node agents through one shared transport (#1018)
* refactor(controller): dial node agents through one shared transport

The rollout subsystem carried its own copy of the node-agent dial, with a
comment saying as much: dialNodeAgent "replicates
internal/agent.NodeAgentClient.getGRPCConnection". The copy only knew about
SPIFFE mTLS and the insecure tier-0 fallback, so it was already blind to
external mTLS (#826) and to the TLS/JWT authentication record (#955).

That is not a cosmetic duplication. An agent running with TLS/JWT writes an
authentication record onto the connection before HTTP/2 starts. A dial path
that does not read the record sees those bytes as a corrupt HTTP/2 preface,
so every rollout against such a node fails at the handshake. Turning on
either deployment-wide transport today breaks rollouts while leaving the
rest of the controller working.

Extract the dial into agent.Transport, which owns the TLS/JWT verifier and
the external client certificate, and have NodeAgentClient wrap one.
cmd/worker builds a single transport and passes it to both the client and
the rollout adapters, so there is one authenticated path to an agent and
adding a transport cannot leave a caller behind.

No behaviour changes for the existing SPIFFE and insecure paths.

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

* fix(controller): build the external mTLS integration test against Transport

The dialing fields moved from NodeAgentClient onto Transport, but the
external mTLS integration test still set them on the client, so the
package failed to compile under -tags=integration. Construct the
transport the test needs instead.

Leaving Transport.logger nil matches NewTransport, which only populates
it when TLS/JWT is enabled.

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

---------

Signed-off-by: jgriffith <jgriffith@nvidia.com>
2026-09-29 11:27:14 -06:00
vwilson-nvidia 68457cf8af feat(controller): add DSX IMDS SPIRE attestation (#974)
- configure node-agent SPIRE attestation at deployment time
- render DSX IMDS plugin settings in CAPI bootstrap data
- reconcile Nico SPIFFE entries using primary DPU machine IDs
- group node-agent transport and attestation configuration

Signed-off-by: Vivin Wilson <vwilson@nvidia.com>
2026-09-28 15:29:18 -04:00
Jayson Du b341d97b1e feat(deploy): replace the composition generator with three hand-authored deploy paths (#812)
* feat(composition): install the CAPD e2e lane from a generated SBOM deploy path

Signed-off-by: Jayson Du <jaydu@nvidia.com>

* refactor(build): retire nke-stack.sh install and its phase helpers

Signed-off-by: Jayson Du <jaydu@nvidia.com>

* feat(deploy): hand-author the capd-e2e deploy path, one release per component

Signed-off-by: Jayson Du <jaydu@nvidia.com>

* feat(build): per-item values and a spire chart materialiser

Signed-off-by: Jayson Du <jaydu@nvidia.com>

* refactor(build): drop the umbrella's registry half, which nothing invoked

Signed-off-by: Jayson Du <jaydu@nvidia.com>

* feat(ci): install the CAPD e2e lane from deploy/capd-e2e

Signed-off-by: Jayson Du <jaydu@nvidia.com>

* refactor(composition): drop the capd-e2e target, now hand-authored under deploy/

Signed-off-by: Jayson Du <jaydu@nvidia.com>

* refactor(build): retire nke-stack.sh, keeping only the spire materialiser

Signed-off-by: Jayson Du <jaydu@nvidia.com>

* fix(ci): create the staging root before copying into it, and drop the spire release override

Signed-off-by: Jayson Du <jaydu@nvidia.com>

* refactor: delete the generation layer

Signed-off-by: Jayson Du <jaydu@nvidia.com>

* fix(deploy): follow the controller chart's rename to nke-controller

Signed-off-by: Jayson Du <jaydu@nvidia.com>

* feat(deploy): add the capnico-e2e deploy path

Signed-off-by: Jayson Du <jaydu@nvidia.com>

* feat(deploy): make CAPNICo an item of the capnico-e2e deploy path

Signed-off-by: Jayson Du <jaydu@nvidia.com>

* feat(build): render template items against a BootstrapConfig

Signed-off-by: Jayson Du <jaydu@nvidia.com>

* feat(ci): let deploy-sbom.sh drive capnico-e2e as well as capd-e2e

Signed-off-by: Jayson Du <jaydu@nvidia.com>

* feat(deploy): carry CAPNICo's CRDs, and patch the CAPI controllers after spire

Signed-off-by: Jayson Du <jaydu@nvidia.com>

* docs(site-bootstrap): add .Nico to the BootstrapConfig reference

Signed-off-by: Jayson Du <jaydu@nvidia.com>

* feat(ci): run capnico-e2e from its deploy path, with CAPNICo outside it

Signed-off-by: Jayson Du <jaydu@nvidia.com>

* feat(ci): default the NICo lane to its deploy path

Signed-off-by: Jayson Du <jaydu@nvidia.com>

* fix(deploy): drop the Helm ownership metadata from capnico-system

Signed-off-by: Jayson Du <jaydu@nvidia.com>

* fix(ci): run the E2E lanes when the deploy path changes

Signed-off-by: Jayson Du <jaydu@nvidia.com>

* fix(deploy): accept both provider blocks on the capnico-e2e lane

Signed-off-by: Jayson Du <jaydu@nvidia.com>

* feat(deploy): add the capnico-forge deploy path, proven on az61

Signed-off-by: Jayson Du <jaydu@nvidia.com>

* refactor(deploy): install spire from the published chart, drop spire-chart.sh

Signed-off-by: Jayson Du <jaydu@nvidia.com>

* fix(deploy): stop the SPIRE webhook race failing every e2e lane

Signed-off-by: Jayson Du <jaydu@nvidia.com>

* docs(build): mark the three SBOM scripts transitional, tracked in #873

Signed-off-by: Jayson Du <jaydu@nvidia.com>

* build: add licence headers to the two SBOM python scripts

Signed-off-by: Jayson Du <jaydu@nvidia.com>

* refactor(deploy): move the deploy paths under controller/deploy

Signed-off-by: Jayson Du <jaydu@nvidia.com>

* feat(deploy): pin the controller image and the postgres digest on capnico-forge

Signed-off-by: Jayson Du <jaydu@nvidia.com>

* docs(deploy): describe the reference run without naming the site

Signed-off-by: Jayson Du <jaydu@nvidia.com>

* fix(ci): pass the SPIRE attestation method #850 made required

Signed-off-by: Jayson Du <jaydu@nvidia.com>

* docs(deploy): drop references to internal repos, docs and scripts

Signed-off-by: Jayson Du <jaydu@nvidia.com>

* fix(deploy): accept both provider blocks on the site path too

Signed-off-by: Jayson Du <jaydu@nvidia.com>

* refactor(deploy): rename capnico-forge to nke-sbom

Signed-off-by: Jayson Du <jaydu@nvidia.com>

* docs(deploy): say NICo site rather than naming the backend

Signed-off-by: Jayson Du <jaydu@nvidia.com>

* fix(deploy): pin the controller image to a build past the SPIRE change

The nke-sbom path pinned ghcr.io/dsx-ai-factory/nke/controller:v0.1.1-rc.6,
which predates #850 by nine days. #850 removed
infra.spireAttestationMethod from the cluster and node-pool APIs and moved
the choice to nodeAgent.spireAttestationMethod in this chart's own values,
so a site controller running any image built before it rejects this
checkout's nkectl with

  400 Bad Request: infra.spireAttestationMethod is required

at "creating the site cluster".

GHCR cannot supply a fix today: it publishes release tags only, and no
release has been cut past #850 -- its newest, rc.8, is revision 4c5dc9bc
from 2026-09-20, 43 commits short. NVCR publishes one build per commit,
so the pin moves there until a GHCR release catches up.

The tag is this branch's merge base with main, which means the CWE binary,
this chart and the nkectl built from this checkout all come from one
commit rather than three.

Verified on a live site controller: all ten items deploy and CWE reports
1/1 Running on this image.

---------

Signed-off-by: Jayson Du <jaydu@nvidia.com>
2026-09-23 14:44:52 -07:00
srekhi93andClaude Sonnet 5 641994b5d7 feat(chart): expose compiled-in field managers and managed-by identities as values (#1009)
Three SSA field managers (FieldManagerCWE, FieldManagerCWERebootMachine,
FieldManagerCWEMachineHealthIssue), the nke.nvidia.com/managed-by label
value, the Teleport ownership label value, and the Teleport TPM token
name prefix were Go constants, unreachable from Helm. Each becomes a
chart value -> env var -> config.Config field, defaulting to today's
literal so an unset value is today's behavior exactly:

  identity.fieldManagerName                    (was FieldManagerCWE)
  identity.fieldManagerRebootMachineName        (was FieldManagerCWERebootMachine)
  identity.fieldManagerMachineHealthIssueName   (was FieldManagerCWEMachineHealthIssue)
  identity.managedByLabelValue                  (was constants.LabelValueNkeManagedBy)
  teleport.managedByLabelValue                  (was teleport.LabelManagedByValue)
  teleport.tokenNamePrefix                      (was teleport.TPMTokenNamePrefix)

FieldManagerNicoTpmSpiffe and FieldManagerMachineSpireEntry are not
CWE-branded and stay fixed constants; out of scope.

Every call site that patched with FieldManagerCWE or stamped the
managed-by/Teleport labels now reads from config.Config (threaded
through *Activities.cfg, or an explicit parameter for the handful of
free functions -- ApplyClusterScaffold, SetSecretOwnership,
clusterIDForKubeconfigSecret, OwnershipLabels/MergeLabels/IsOwnedByCWE,
TPMTokenName -- that didn't already carry it).

The teleport.enabled-gated env block is unaffected; the two new
Teleport env vars are set unconditionally, since node userdata builds
a TPM token name and ownership label regardless of that flag, which
only gates this controller's own Teleport API client.

Metric identifiers (the other half of NKX-16642's original scope) are
not touched here: PR #970 (NKX-16653, merged 2026-09-22) already
hard-renamed all 32 metrics to nke_controller_* unconditionally, for
every site including existing ones -- a different design than this
value-driven approach, already landed, and out of scope to revert.

Verified: go build/vet/test/lint clean across the controller module;
helm lint, chart-identity-check, and chart-rbac-check pass; a legacy
render's new env vars carry exactly today's literal values (new lines
only -- no existing line changed); a greenfield override
(identity.fieldManagerName=nke-controller, etc.) renders correctly.

Part of NKX-16642.

Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>
2026-09-23 13:21:20 -04:00
Davanum Srinivas 2ab60c7f6b refactor: move the module path to github.com/dsx-ai-factory/nke (#896)
* refactor: move the module path to github.com/dsx-ai-factory/nke

All nine modules still declared github.com/NVIDIA/nke after the org
move, so the two documented consumer go get lines resolved only through
GitHub's org-rename redirect.

1391 occurrences across 593 files, plus two lines in vendor/modules.txt.
Replaced by exact string, never by pattern: github.com/NVIDIA/nke is
never a prefix of anything else here, and the three other NVIDIA modules
this repository depends on -- ncx-infra-controller-rest,
infra-controller, and a bare github.com/NVIDIA/ in a GOPRIVATE pattern
-- are untouched.

The generated proto could not be renamed by substitution and was
regenerated. node_agent.pb.go embeds go_package in a length-prefixed
descriptor, so the length byte changes with the string: 0x2d to 0x35.
check-protos caught it. THIRD_PARTY_NOTICES.md for the root and agent
were regenerated too.

Verified: GOPROXY=off make build links all six binaries,
work-check-offline reports vendor consistent with every module, and
agent, cli, controller, controller/api, controller/nico-sim,
controller/hack/capd-reboot-controller, os-image and
cluster-api-provider-provisioned all pass through make.

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

* fix: catch up two things the module-path rename missed

workspace: controller/go.mod's require block and vendor/modules.txt
still had the two local requires (agent, controller/api) at their old
sort position. Ran make work-sync to re-sort both under their new
github.com/dsx-ai-factory/nke path.

lint: cli/.golangci.yml and os-image/.golangci.yml pin gci's local
group to prefix(github.com/NVIDIA/), which no longer matches the
renamed local imports -- gci moved them into the third-party group
and flagged every file that imports across modules. Repointed both at
prefix(github.com/dsx-ai-factory/nke), the same scope goimports uses
in controller/.golangci.yml. No source file needed reformatting: the
import order was already correct for a config that recognized the new
path.

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

---------

Signed-off-by: Davanum Srinivas <dsrinivas@nvidia.com>
2026-09-20 16:52:23 -04:00
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
Meha Mehta fe5e8d0194 feat(controller): migrate node-pool control planes to the control-plane controller at boot (#824)
* feat(controller): migrate node-pool control planes to the CP controller at boot

When a site opts in via PROVISION_CONTROL_PLANE_WITH_CONTROL_PLANE_CONTROLLER,
re-parent its legacy node-pool-managed control-plane nodes onto the control-plane
controller during worker startup, then delete the emptied control-plane node
pools and node sets.

The sweep runs after schema migrations and before the controllers and the
Temporal worker start, so nothing is mutating node ownership while it is
rewritten. It is a no-op when the flag is off (and, unlike a bun migration,
nothing is recorded, so a later flag flip runs it on the next boot). The whole
sweep is one transaction and fails closed: if any non-deleting cluster cannot be
fully migrated, the worker refuses to start rather than serve a half-migrated
fleet.

This is a temporary transition helper to be removed once every site has been
migrated and the flag is on by default.

* feat(controller): migrate deprecated control-plane node generations too

Instead of refusing to migrate while a control-plane rolling upgrade is in
flight, mint a per-generation configuration snapshot for each deprecated node
set (the cluster's current snapshot with the generation's os_profile,
config_profile and kubernetes_version overlaid) and pin its nodes to it. The
control-plane controller then still sees those nodes as needing rollout and
finishes the upgrade once CP node recycling is enabled, instead of the sweep
refusing to run until the control plane converged.
2026-09-18 14:24:57 -06:00
Davanum Srinivas 5eec722cc5 build(controller): update CAPNICo to v0.0.45 under dsx-ai-factory (#728)
* build(controller): update CAPNICo to v0.0.45 under dsx-ai-factory

controller/go.mod pinned github.com/NVIDIA/cluster-api-provider-nico
v0.0.44-rc.2, the last version under the old path. It still built, but
only through GitHub's post-transfer redirect. Upstream's own path became
github.com/dsx-ai-factory/cluster-api-provider-nico at v0.0.45-rc.1.
Dependabot cannot rename a module path, so this bump is manual.

Renames the import path in all 19 consuming Go files, re-vendors the
workspace, and refreshes the CAPNICo CRD test fixtures to match v0.0.45.
Also fixes the Makefile and CI references that used the old path,
including two that were not a plain text swap: the GOMODCACHE path in
controller/Makefile used Go's module-cache escaping for the old
uppercase org, and the GOPRIVATE/insteadOf git rewrite in
go-work-check.yml and dependabot-fixup.yml was scoped to it.

controller: make fmt, lint, test all pass. Root: GOPROXY=off make build
links all six binaries from vendor with no network.

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

* build: regenerate THIRD_PARTY_NOTICES.md for the CAPNICo bump

The dependency cascade from the capnico v0.0.45 bump (etcd, protobuf,
controller-runtime, k8s.io/*, go-openapi/swag) changed licensed content
in all four redistributed binaries' notices files. make notices in each.

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

---------

Signed-off-by: Davanum Srinivas <dsrinivas@nvidia.com>
2026-09-12 22:29:56 -04:00
Guillermo Gaston 2196b8ce49 feat(controller): extend dbreconcile (#694)
Adds new features to the database controller library:

- Kubernetes object watches with namespace and label filtering.
- Owner label helpers for mapping Kubernetes objects to database records.
- A declarative AddController API.
- Worker count and reconcile timeout options.
- Reusable controller test utilities and an example.
- Controller-runtime leader election with the required RBAC.

Signed-off-by: Guillermo Gaston <ggastonloren@nvidia.com>
2026-09-11 20:23:30 +00:00
Terry Howe 5066d81d1c fix(db): stop the Node/Cluster/NodePool/NodeSet BeforeUpdate hooks from silently no-oping (#690)
Node.BeforeUpdate (and the same pattern on Cluster, NodePool, NodeSet)
implemented BeforeUpdate() error, but bun.BeforeUpdateHook requires
BeforeUpdate(context.Context, *bun.UpdateQuery) error. The mismatched
signature meant Bun never invoked the hook, so UpdatedAt stayed frozen
at insert time on every subsequent update, masking how often rows were
actually being rewritten.

Bun invokes BeforeUpdate on the table's zero-value instance rather than
the model being persisted, so mutating a receiver field silently does
nothing either way; the timestamp is now set directly in each Update*
query function instead, where the real model pointer is in scope.

Also give the previously-silent tenant node-health reconciler
(internal/controllers/tenant/nodestatus) a logger, so a future
investigation into unexpected node write volume doesn't have to fall
back on live pg_stat_activity captures to see what it's doing.

Signed-off-by: Terry Howe <thowe@nvidia.com>
2026-09-11 12:27:11 -06:00
Dan BudrisandClaude Sonnet 5 f3da0950a0 feat(controller): add nke_auth_enabled config-state metric (#688)
nke_auth_requests_total answers "how much traffic" but not "is auth
on" -- its series only exist once a request has actually been
evaluated, so a quiet deployment is indistinguishable from a
disabled one from the metric alone. This adds nke_auth_enabled, a
gauge set once at startup from AUTH_CONFIG_PATH/PERMISSIVE_MODE
(off, permissive, or enforcing), independent of traffic.

Signed-off-by: dbudris <dbudris@nvidia.com>
Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>
2026-09-11 14:13:05 -04:00
Jayson Du 0d79f01946 feat(deploy): deploy the management plane from an nke-stack umbrella chart (#630)
Adds a recipe-driven umbrella chart for the NKE management plane, and an
opt-in CAPD e2e lane that deploys from it instead of Tilt.

A composition under controller/deploy/composition declares what ships together:
a registry of component chart coordinates, per-component values, and dependsOn
edges. controller/cmd/composition-gen renders generated/nke-stack from it, and
`make composition-check` fails when the two drift. Install phases are a
topological sort of the dependency graph rather than a hand-written list, so
there is nothing for an ordering to drift from. build/nke-stack.sh builds,
packages, publishes and installs the result; the registry is a parameter, never
baked into the committed chart.

Eight components: cert-manager, postgresql, prometheus-operator-crds,
kube-prometheus-stack, spire-crds, spire, temporal and the controller. The set
matches the AICR bundle, including its local postgresql component -- the
Bitnami chart was dropped because helm resolves chart dependencies at package
time over plain HTTPS, so every build hit Docker Hub's anonymous rate limit and
429s killed two e2e runs before the deploy started. The in-repo chart wraps the
official postgres image pinned by digest, which is pulled by containerd through
the runner's mirror instead.

The recurring hazard is identity derived from the helm release name. Tilt
installs each component as its own release, so release-derived names match what
is hardcoded against them; under one umbrella every subchart inherits the
umbrella's release and each of those names moves. That accounts for
postgresql's and temporal's fullnameOverride, the release-scoped selectors on
the SPIRE NodePorts, SPIRE_SERVER_API_ADDRESS (which the chart never renders,
so CWE fell back to a Go default wrong in both name and port), and
NKE_E2E_SPIRE_RELEASE in the suite, which had the server ConfigMap and pod
selector hardcoded to Tilt's release.

Also applies the PodSecurity levels the spire namespaces need. Nothing was
applying them: the upstream chart's Namespace templates live in spire-lib,
which this composition does not render. Invisible under kind, which does not
enforce Pod Security, and fatal on a cluster that does.

The lane is opt-in via the use-nke-stack workflow input and off by default, so
the Tilt path stays the default and is byte-identical. Test scaffolding the
Tilt providers used to supply -- the CAPD RBAC for CWE, capd-reboot-controller
and the BGP container -- is applied explicitly rather than added to the chart.

Verified: the full CAPD suite passes against the umbrella, 11 specs on the
cp-controller leg and 52 on the node-pool leg, with no failures.
2026-09-09 21:12:26 -04:00
Jonathan MeierandCodex 8f97edbd3e feat(controller): make NICo controllers configurable (#610)
Add a Helm and environment switch that prevents NICo CRD discovery and controller registration when CWE manages provisioned infrastructure only.

Co-authored-by: Codex <codex@openai.com>
2026-09-09 18:32:44 -04:00