Commit Graph
57 Commits
Author SHA1 Message Date
Jyoti Mahapatra a3cd922847 feat(controller): support cniPlugin none to create a cluster with no CNI (#2551)
Adds the `none` CNI plugin: a cluster created with `cniPlugin: none` is provisioned with no CNI and no kube-proxy, for users who bring their own CNI. This covers the controller end to end: the API enum and validation, the init path, DNS and the node user-data. nvkectl and docs are not part of this PR.

A `none` cluster's nodes stay NotReady until the user installs a CNI, so day-2 controllers that wait on `KubernetesReady` (remediation, scale-down quorum accounting, cert renewal) hold off until then. That is unchanged here.
2026-12-02 15:38:41 -08:00
Davanum Srinivas bf25577b9f feat(controller): accept controlPlaneEndpoint on cluster create (#2515)
* refactor(controller): ask one cluster method at each control-plane endpoint gate

Each gate that scales, upgrades or replaces control-plane nodes tested
the control-plane VIP for an empty string by itself. The gates now call
db.Cluster.HasStableControlPlaneEndpoint, which is true when the cluster
has a VIP.

The gates are the count check at create and scale, the upgrade and
rollout checks of the cluster API, the node delete guard, the
control-plane controller (recycling, remediation, rebalance, stuck
pending nodes) and the node pool controller (surge, NodeSet
replacement).

No behavior changes. A later change adds a second kind of stable
endpoint to the method.

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

* feat(controller): add controlPlaneEndpoint to the cluster API schema

A cluster can name an API server endpoint that NVKE does not manage,
for example a load balancer in front of the API servers. The create
request gets the optional object controlPlaneEndpoint. Its type says
who manages the endpoint, and the block named after the type carries
what that type needs. This change has one type, External, with a host
and an optional port in the external block. The port defaults to 6443.
The cluster response returns the type and the resolved host and port.
The update request has no such property, so the value is fixed at
creation.

The shape is the one of the proposal for a load balancer as the
control plane endpoint, and this change is its first part. The enum
of the type has only External. The other types of the proposal come
later. A new enum value passes the API compatibility check, and a
removed one does not, so the enum lists only what the code does.

The existing descriptions change only where the new field makes them
wrong or incomplete:

- The overview of the Clusters tag and the description of
  controlPlaneVIP say which address is the API server endpoint.
- Seven sentences that say an operation requires controlPlaneVIP now
  name both fields. Each is one changed line.
- The 400 list of the create operation gets the new reasons.
- The desiredNodeCount descriptions of the two node pool requests lose
  their sentence about control-plane pools. The node pool handlers
  refuse each create and each update of a control-plane node pool, so
  no request reaches a rule on that count.

This change is only api/openapi.yaml and the code that make generate
writes from it (models.gen.go, server.gen.go). The handler does not
read the field yet. The next changes store it, check it and use it.

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

* feat(controller): store controlPlaneEndpoint in the clusters table

The clusters table gets three nullable columns for the API server
endpoint that a cluster was created with: control_plane_endpoint_type,
control_plane_endpoint_host and control_plane_endpoint_port. db.Cluster
gets the fields ControlPlaneEndpointType, ControlPlaneEndpointHost and
ControlPlaneEndpointPort. The type says who manages the endpoint. The
one type is External, an endpoint that NVKE does not manage. The host
and the port are the resolved endpoint.

A cluster without the field stores NULL in the three columns, which is
what each existing row has after the migration. An empty type marks
such a row. control_plane_vip does not change.

No handler writes the fields yet and no workflow reads them. The test
proves that the values come back from a read and stay in the row
through an update of the cluster.

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

* feat(controller): count controlPlaneEndpoint as a stable endpoint at each gate

db.Cluster.HasStableControlPlaneEndpoint is now true for a cluster with
an endpoint of the type External, as it is for one with a VIP. Each
gate that scales, upgrades or replaces control-plane nodes asks this
method, so the one line opens them all: scale-up, upgrade and rollout
in the cluster API, node delete, recycling, remediation, rebalance,
stuck pending nodes, surge and NodeSet replacement.

The method reads the stored type and not the host. An empty type is a
cluster without the field, and a type that this controller does not
know is no stable endpoint.

The tests run each gate with such a cluster. Recycling, remediation,
rebalance and stuck pending nodes share one check,
controlPlaneReplacementBlocked, which gets its own test.

The 400 messages and the log warnings of the gates keep their text.
Each of them is given only for a cluster with no VIP and no
controlPlaneEndpoint. allowControlPlaneWithoutVIP keeps its meaning
and its default.

No cluster has the field yet, because the create request does not
store it. A later change adds that, with the count check at create.

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

* feat(controller): check controlPlaneEndpoint on cluster create

The create request is now rejected with 400 when it has both
controlPlaneEndpoint and controlPlaneVIP, when the type is not
External, when the type External has no external block, and when the
host or the port is not valid.

The host is a DNS name or an IPv4 address. A DNS name is lowercase,
has at most 253 characters, no trailing dot and no wildcard. An IPv4
address must be unicast, not loopback and not link-local, and outside
the pod and service CIDRs. The port is a number from 1 to 65535, and
6443 when the request has none.

A host of only digits and dots must be a valid IPv4 address, so that
a mistyped address does not pass as a DNS name and skip the address
rules. A DNS name is not checked against the CIDRs, because NVKE
cannot tell which addresses it resolves to. The host is not trimmed.
NVKE does not resolve or dial the endpoint.

The CIDR rule of controlPlaneVIP moves into a helper that both fields
use. Its messages keep their text, and the checks of controlPlaneVIP
do not change.

The checks come before the change that stores the value, so that no
commit stores a value without them.

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

* feat(controller): use controlPlaneEndpoint for kubeadm init

kubeadm init now takes its controlPlaneEndpoint from one function,
kubeadmControlPlaneEndpoint. For a cluster with an external endpoint
the value is host:port. Without one it is the kube-vip VIP, then the
IP of the initializing node, as before. The value goes into the
ClusterConfiguration and into the request to the node agent, as
before.

NVKE also names the host of an external endpoint in
apiServer.certSANs of the ClusterConfiguration. kubeadm adds the host
of its controlPlaneEndpoint to the API server certificate by itself.
The explicit entry keeps certificate renewal and control-plane joins
correct if that default changes. A cluster without an external
endpoint gets no certSANs entry, so its configuration does not change.

The step fails for a cluster row with an endpoint type that this
controller does not know, and for an external endpoint with no host
or no port. The address goes into each certificate and each
kubeconfig of the cluster, so the step does not guess.

The kube-vip step needs no change and gets no check for the new field.
It returns with no action for a cluster without a VIP, and a cluster
with a controlPlaneEndpoint has no VIP: the create request refuses the
two fields together, and no other request writes either of them to the
cluster row. One test keeps this true: for such a cluster the step
makes no kube-vip call and runs no script on the node.

Each later step reads the endpoint back from what kubeadm wrote: the
join string, admin.conf and the Cluster API endpoint. They need no
change.

No cluster has the field yet. The next change makes the create request
store it.

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

* feat(controller): accept controlPlaneEndpoint on cluster create

The create request now stores controlPlaneEndpoint in the cluster row:
the type, the host and the resolved port, which is 6443 when the
request names none. The cluster response returns the type and the
resolved host and port. The response leaves the field out when the
cluster has none.

The count check at create asks HasStableControlPlaneEndpoint of the
fields that the request would store. So a request with an external
endpoint can ask for more than one control-plane node, as one with a
VIP can.

The tests go through the service and through the HTTP handler with the
OpenAPI validator: at each level requests that are accepted and
requests that are refused, then the bounds that only the schema
checks, and a PATCH with the field, which the schema refuses. One test
checks the JSON form of the field in the response. The full table of
refused values is in the test of the check itself.

This change comes after each part that reads the value, so that no
cluster can have the field before kubeadm init uses it.

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

* docs: describe controlPlaneEndpoint for workload clusters

The pages that state the VIP rule now name controlPlaneEndpoint as the
second way to give a cluster a stable API address: the cluster spec
table and the count rule in the create guide, the API address in the
two access pages, the upgrade rule in the supported platforms, and the
installation plan.

The create guide shows the object with the type External, its host
and its port, and says what the response returns. It says what the
endpoint must do before the request, and that NVKE does not resolve
or call the endpoint when it accepts the request. The access page
says that NVKE does not take a node out of the endpoint before it
restarts the API server or etcd there, so the health check of the
endpoint must do it.

The pages come after the change that stores the value, so that each
sentence is true when it is added.

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

* fix(controller): reject a DNS label over 63 characters in controlPlaneEndpoint

The host check of an external control plane endpoint used
IsDNS1123Subdomain, which checks the whole length and the form of a DNS
name and not the length of each label. So a name with a label of 64
characters passed the check, and DNS has no such name.

The check now also rejects a label of more than 63 characters. The text
of the field in the spec says so, and the generated code follows it.

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

* docs: say that an endpoint health check acts after the failure

The access page said that the endpoint must stop traffic to a node
through its own health check. A health check sees a failure only after
it happens, so a call can fail between the restart of the API server or
of etcd and that check. The page says so now.

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

---------

Signed-off-by: Davanum Srinivas <dsrinivas@nvidia.com>
2026-11-30 20:27:49 -05:00
Abhinav Pandey 407218a442 feat(controller): adopt the cluster the NVKE controller runs (#2415)
* feat(controller): adopt the cluster the controller runs on behind a flag

Add POST /clusters/self-adopt, which records the cluster the controller runs
on as a cluster NVKE manages, without running kubeadm init. The endpoint is
served only when clusterSelfAdoptionEnabled is set in nvke-controller-config
(chart value clusterSelfAdoptionEnabled, default false). Otherwise it answers
400.

The controller reads the cluster with its own service account: the
control-plane Nodes, each with an InternalIP, and the Kubernetes version and
pod and service CIDRs from kube-system/kubeadm-config. The request carries
only what NVKE cannot read: name, NICo site and VPC (orgID optional), CNI
plugin and version, and etcdEncrypted. While the flag is on, the chart grants
that service account list on Nodes and get on kube-system/kubeadm-config.
Self-adopt returns 400 for no control-plane node, a node without an
InternalIP, a kubelet that differs from kubeadm-config, a version that is not
X.Y.Z, no or unsupported pod or service CIDRs, a second adoption, or an
existing Cluster API Cluster of the same name.

The adopted control plane stays with its operator, outside NVKE. Adoption
marks the cluster and its control-plane nodes as adopted, records desiredCount
as their number with no control-plane machine settings, and turns off
recycling, automatic scale-down and rebalancing:

- PATCH /clusters/{id} refuses turning those back on, controlPlaneConfig.nico,
  controlPlaneKubernetesVersion, any desiredCount change and any control-plane
  rollout field.
- DELETE /nodes/{id} on an adopted node returns 409, refused in the handler.
- The node-status sync never marks an adopted node for recycling, so
  control-plane remediation never replaces it.

DELETE /clusters/{id} on an adopted cluster removes only NVKE's records and
leaves the cluster running. It returns 409 while the cluster has node pools,
so their workers are drained and released through the node pool delete first.
TeardownCluster then deletes the Cluster API Cluster and NicoCluster and the
adopted node and cluster rows, and never tears down a node.

An adopted cluster gets OIDCAuthEnabled false, since NVKE cannot configure its
API servers. Its provisioning workflow applies only the Cluster API scaffold:
node-local DNS and the Pod Security namespace labels stay with the operator.

Signed-off-by: Abhinav Pandey <abhinavmpandey08@gmail.com>

* fix(controller): keep maintenance off an adopted cluster and serialize self-adopt

Address review on the self-adopt change.

Keep NVKE from changing an adopted control plane in place:
- PATCH /clusters/{id} refuses turning on enableEtcdEncryption or enableOidc
  for an adopted cluster, alongside the existing control-plane refusals.
- Scheduled certificate renewal skips an adopted cluster.
- stableControlPlane refuses an adopted control plane, which keeps on-demand
  certificate renewal and etcd key rotation off it.

Make "adopts at most one cluster" hold across concurrent requests:
SelfAdoptCluster takes a transaction-scoped advisory lock (LockSelfAdoption)
and checks for an adopted cluster again inside the transaction that records
it, so a second adoption gets a 400. Also fix a stale comment that said an
adopted record cannot be deleted.

Signed-off-by: Abhinav Pandey <abhinavmpandey08@gmail.com>

---------

Signed-off-by: Abhinav Pandey <abhinavmpandey08@gmail.com>
2026-11-30 15:32:32 -08:00
Jyoti Mahapatra 2e7cfb59c0 docs(controller): document and pin that custom CIDRs require an explicit CNI plugin (#2526)
* test: pin that an empty CNI plugin has no default version

Signed-off-by: Jyoti Mahapatra <jyotim@nvidia.com>

* fix(controller): accept custom CIDRs when the CNI plugin is omitted

An omitted cniPlugin is stored as ovn-kubernetes, but the CIDR check saw the raw empty value and required ovn-kubernetes by name. Check the effective plugin instead.

Signed-off-by: Jyoti Mahapatra <jyotim@nvidia.com>

* docs(controller): document that custom CIDRs require an explicit CNI plugin

Revert the effective-plugin check so an omitted cniPlugin keeps being refused custom CIDRs, state the rule in the OpenAPI descriptions, and pin it with a handler row for each side.

Signed-off-by: Jyoti Mahapatra <jyotim@nvidia.com>

* fix(management-engine): tidy go.mod for cedar-go v1.9.3

Signed-off-by: Jyoti Mahapatra <jyotim@nvidia.com>

---------

Signed-off-by: Jyoti Mahapatra <jyotim@nvidia.com>
2026-11-30 20:32:02 +00:00
Meha Mehta 445bde08f9 feat(controller): accept enableCPNodeRecycling on cluster create (#2453)
* feat(controller): accept enableCPNodeRecycling on cluster create

Add enableCPNodeRecycling to CreateClusterRequest and store it on the new cluster. Previously the field could only be set with PATCH, so an operator could not opt in at create.

The e2e nvkectl rows now create with the flag set and check that the controller stored it. The existing patch spec sets the flag to false so that its check is meaningful.

Signed-off-by: Meha Mehta <meham@nvidia.com>

* test(e2e): skip the create-time recycling check on a reused cluster

A reused cluster is not created by the run, so initCluster sends no create request and the flag may already have been patched to false by an earlier run.

Signed-off-by: Meha Mehta <meham@nvidia.com>

* test(e2e): register the create-time recycling check only on fresh runs

A reused cluster was not created by this run, so its create-time flag is unknown. Skipping the spec at run time reported a skip from nvkectl_test.go, which e2e_assert_no_new_skips rejects. Leave the spec out of the tree on reused runs instead.

Signed-off-by: Meha Mehta <meham@nvidia.com>

* test(e2e): read the reuse setting before the spec tree is built

test.cfg is assigned inside the creates-the-cluster spec, which runs after the tree is built, so the guard read an empty ReuseCluster and always registered the create-time check. Load the config file when the tree is built instead.

Signed-off-by: Meha Mehta <meham@nvidia.com>

* test(e2e): patch to the opposite of the stored recycling flag

A reused cluster can already hold the value the patch sets, so an ignored patch still passed. Read the stored value first and patch to the opposite, so the assertion holds on reused clusters too.

Signed-off-by: Meha Mehta <meham@nvidia.com>

---------

Signed-off-by: Meha Mehta <meham@nvidia.com>
2026-11-25 11:35:55 -05:00
Anisha Gupta US c1ef896e22 feat(controller): expose observed node pool counts (#2400)
* feat(controller): expose observed node pool counts (poc)

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

* refactor(controller): keep node pool counts with pool queries

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

* refactor(controller): name compared node set current

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

* refactor(controller): use a generic json equality helper name

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

* refactor(controller): use inner join for node set counts

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

* refactor(controller): use node set names in count aggregation

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

* refactor(controller): consolidate node pool response mapping

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

* docs: keep node pool field definitions in the api reference

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

* refactor(controller): restore single node pool response conversion

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

* test(controller): colocate node pool count tests

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

* test(controller): colocate node pool response count tests

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

* refactor(api): name observed node pool count explicitly

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

* fix(controller): compare template JSON numbers by exact value

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

* refactor(controller): limit JSON comparison to node pool counts

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

* refactor(controller): restore shared pool configuration comparison

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

* refactor(controller): move json equality to shared utils

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

* test(controller): use unambiguous numeric precision fixtures

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

* refactor(controller): simplify node pool count responses

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

* perf(controller): index nodes by node pool

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

---------

Signed-off-by: Anisha Gupta <anisgupta@nvidia.com>
2026-11-23 14:39:40 -05:00
Carl Danley be19c614c1 feat(controller): accept control-plane component extraArgs at cluster create (#2395)
* feat(controller): add control-plane component extraArgs to the create API

Add apiServer, controllerManager and scheduler, each with an extraArgs
map from flag name to value, to CreateClusterControlPlaneConfig and to
the cluster's controlPlaneConfig. Store them in the control-plane
configuration snapshot, which is JSONB, so no migration is needed.

Refs #2386

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

* feat(controller): validate and render control-plane extraArgs

Reject an operator argument for a flag NVKE sets on that component, a
flag name that isn't lowercase words joined by hyphens, a feature-gates
value that doesn't parse, and a gate that contradicts NVKE's. The create
handler runs the check before it writes anything.

Render the arguments into each component's extraArgs in the kubeadm
ClusterConfiguration at init, from the snapshot the init node is pinned
to. feature-gates is merged with NVKE's gates and sorted. Control-plane
nodes that join later read them from kubeadm-config.

A test keeps the list of flags NVKE sets in step with the renderer and
the kubeadm-config rewrites.

Refs #2386

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

* feat(controller): reject AllAlpha and AllBeta in operator feature-gates

Each sets every gate of its stage, including gates a later Kubernetes
version adds, so an upgrade would turn on features nobody chose. The
design review agreed to reject them, through a per-version gate catalog
that was later dropped. Keep that decision without it, and record it in
the design doc and the API description.

Refs #2386

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

* docs(design): describe the flag-name rule for control-plane extraArgs

The Validation section said only that each map is from a non-empty flag
name to a string value. The controller also requires lowercase words
joined by single hyphens, without the leading "--", because components
turn "_" into "-" when they parse flags. Say so, and why.

Refs #2386

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

* chore: allowlist the kubeadm golden bootstrap token in gitleaks

The new extraArgs golden files render the synthetic bootstrap token that
validInitConfig sets, and generic-api-key flags "token: <value>". Allow
that one literal under controller/internal/kubeadmconfig/testdata only,
with condition AND, so a real credential in those files, or the same
literal elsewhere, is still caught.

Refs #2386

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

---------

Signed-off-by: Carl Danley <cdanley@nvidia.com>
2026-11-19 10:33:40 -05:00
patelpayal 405de08095 feat(controller)!: reject a node pool Kubernetes version newer than the control plane (#2324)
* feat(controller)!: reject a node pool Kubernetes version newer than the control plane

Signed-off-by: Payal Patel <payapatel@nvidia.com>

* fix(controller): block a node pool version change while a control-plane upgrade is pending

Signed-off-by: Payal Patel <payapatel@nvidia.com>

* fix(controller): raise ControlPlaneUpgrading when the control-plane version is stored

Signed-off-by: Payal Patel <payapatel@nvidia.com>

---------

Signed-off-by: Payal Patel <payapatel@nvidia.com>
2026-11-16 13:35:08 -08:00
Aaron Patten 7077990998 fix(controller): point control-plane quorum-floor refusal at node recycling (#2344)
* fix(controller): point control-plane quorum-floor refusal at node recycling

The 400 from DELETE /nodes/{id} that refuses to drop a healthy control
plane below three joined nodes told operators to delete the cluster.
During an upgrade that is the wrong advice: the controller replaces
drifted control-plane nodes itself once enableCPNodeRecycling is on.
Say that instead, and match the OpenAPI example.

Closes #1402

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

* test(controller): drop message-text test for quorum-floor refusal

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

---------

Signed-off-by: Aaron Patten <apatten@nvidia.com>
2026-11-16 11:34:45 -05:00
Aaron Patten 2a12d95f2d feat(controller): let a node pool update set its NVLink logical partition (#2147)
* feat(controller): let a node pool update set its NVLink logical partition

PATCH /api/nodePools/{id} now accepts nico.nvLinkLogicalPartitionID. It sets
or replaces the pool's NVLink logical partition; the all-zero UUID is
rejected, so the partition cannot be cleared. Nodes the pool creates after
the update attach to the new partition. A partition change does not create a
new node set, so no existing node is replaced.

A NicoMachine that already exists keeps the partition it was created with
when its create is retried, because CAPNICo rejects a partition change once
the instance exists.

The NICo provider guide shows how to attach a pool's existing nodes by
updating their NICo instances directly.

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

* docs(nico): set the NICo token and check each instance after an NVLink update

Read the NICo API path and token from the nico-credentials Secret, list pool
machines that have no instance yet, and add a step that confirms each instance
reports the partition on every GPU.

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

* fix(controller): create a node set when a pool's NVLink partition changes

Treat the NVLink logical partition like the other editable node
configuration: a change creates a new current node set, and each node gets
the partition of its own node set instead of the pool's live value. Nodes
created after the change attach to the new partition; existing nodes stay in
the earlier node set until they are replaced or patched in NICo.

A retried create renders from the same node set, so the separate retry guard
is no longer needed and is removed.

Node sets backfilled when the nico payload columns were added never carried
the partition. A migration copies each pool's partition into its node sets
that lack it, so the upgrade creates no node sets and new nodes keep their
partition. Before this change the partition was fixed at creation, so the
pool's value is the one every node set was created with.

The node set API reports the partition, and the NICo provider guide describes
the node set and recycling behavior.

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

* test(nico): render a node's NVLink partition from its node set across retries

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

* docs(nico): keep the NICo token off the curl command line in the NVLink procedure

Read the Authorization header from a file only the operator can read, build
the request body once and reject a GPU count below 1, print the response body
of a failed update and say which failures a retry can fix.

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

* docs: move the NVLink partition procedure to its own operate page

Changing a node pool's NVLink partition and attaching its existing nodes is an
operational task, not part of configuring the NICo provider at install. Give it
a how-to page in the Operate section that also shows the pool update itself,
and link to it from the NICo identifiers table.

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

* docs: stop on a failed pool update and skip attached instances

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

---------

Signed-off-by: Aaron Patten <apatten@nvidia.com>
2026-11-10 10:21:46 -07:00
patelpayal 09b688a521 fix(controller): keep a node pool's maxSurge when a PATCH omits it (#2110)
UpdateNodePoolRequest.maxSurge declared default: 0. The OpenAPI request
validator writes schema defaults into the request body, so a PATCH that
did not send maxSurge reached the handler with maxSurge: 0 and reset the
stored value. Remove the default from the update schema; omitted fields
are left unchanged, as the PATCH semantics in openapi.yaml state.

Signed-off-by: Payal Patel <payapatel@nvidia.com>
2026-11-04 12:11:57 -08:00
Meha Mehta 1a6d5efbe0 feat(controller): rebalance the control plane onto more-preferred instance types (#2074)
* feat(controller): rebalance the control plane onto more-preferred instance types

Teach the control-plane reconciler to migrate members onto more-preferred
instance types at steady state. When a joined member runs on a less-preferred
type, the step surges one capped, more-preferred replacement, then sheds the old
node through the shared control-plane delete path (quorum floor applied) once the
replacement joins. It drives both halves of the surge-then-shed itself, so it is
independent of the automatic scale-down toggle. It is the lowest-priority
control-plane step: it acts only at steady state when nothing else is in flight,
and yields to upgrades and rollouts by abandoning an in-flight surge rather than
blocking them.

Abandon a surge and record a backoff only on a real capacity shortfall: when the
provider never allocated an instance within the surge timeout. A surge that did
allocate an instance found capacity and is an ordinary provisioning node, bounded
by the node provisioning timeout (NODE_PROVISIONING_TIMEOUT, which does not yet
recycle control-plane nodes), not by this step. The surge timeout is a dedicated
constant, separate from the provisioning timeout, governing only the
not-yet-allocated capacity-wait phase, and re-probing after a capacity
abandonment is rate-limited to once per backoff interval so a cluster with no
preferred capacity re-probes slowly instead of churning a surge every timeout.

Surge completion never strands a surplus node: the marker clears only when a node
was actually shed or the control plane is back at its desired count, with
explicit handling for the no-victim (undo-surge) and quorum-floor-refused cases,
and an in-flight unrelated delete never clears the marker.

Teardown skips control-plane graceful shutdown for a node that never joined, so a
failed surge tears down cleanly instead of looping against an agent that never
existed; the etcd member removal still runs and is a no-op when the member is
absent.

Surface the surge on the node API as a new optional, control-plane-only condition
controlPlanePreferredReplacement, True while the node is a preferred replacement
and cleared to False once it becomes an ordinary member.

The step is provider-neutral: it surges via the ControlPlaneScaleDownRanker seam
and bounds the fallback via the ControlPlaneRebalanceCapper seam; a provider with
no ordered preference implements neither and the step is a no-op for it. Covered
by table tests.

Signed-off-by: Meha Mehta <meham@nvidia.com>

* test(e2e): add control-plane instance-type rebalance spec

Add a nico-vms e2e spec that drives one steady-state control-plane
rebalance round: it puts a more-preferred instance type at the front of
the NICo instanceTypePreference, then asserts the controller surges one
more-preferred replacement, joins it, and sheds a less-preferred node
through the serialized delete path, settling back at the desired count
with a single node moved to the preferred type and the surge marker
cleared.

The spec ranks on the NICo instanceTypePreference, which only the
nico-vms control-plane provider carries, so it skips on other backends.
It is bounded to a single round by disabling rebalancing once the surge
is in flight, which also exercises the resolve-when-disabled path. It
carries the "rebalance" label, which is in no CI lane, so it runs only
when selected explicitly.

Signed-off-by: Meha Mehta <meham@nvidia.com>

* fix(controller): skip rebalance below the fault-tolerant floor

A control plane whose desiredCount is below MinFaultTolerantControlPlaneNodes
can never shed the node a rebalance surge adds: the quorum floor refuses the
shed, so the control plane would sit one node above desired forever. Return
before surging when desiredCount is below the floor.

Also correct the withRebalanceReplacement doc comment: clearRebalanceMarker
clears the marker on join but keeps the node's capped snapshot; it does not
re-pin to the cluster's current config.

Signed-off-by: Meha Mehta <meham@nvidia.com>

---------

Signed-off-by: Meha Mehta <meham@nvidia.com>
2026-11-03 19:44:59 +00:00
Meha Mehta 1dc3b677aa feat(controller): auto scale down control plane on desired-count decrease (#1902)
* feat(controller): auto scale down the control plane on desired-count decrease

Shed surplus control-plane nodes when a cluster's controlPlaneConfig.desiredCount
is decreased. The reconciler records a delete as intent and the serialized delete
path tears nodes down one at a time, never below the fault-tolerant quorum floor
and never while a rollout is in progress -- including the window where a surge
node exists but the recycling condition has not latched yet.

Victim selection is provider-ranked: the least-preferred node is shed first via
the ControlPlaneScaleDownRanker capability (Nico ranks by instance-type
preference), then oldest, then lowest ID; a provider that expresses no preference
falls back to age. A reflection-driven test guards the provider union so a new
provider cannot silently lose its ranking.

Automatic scale-down is on by default. An operator can set
controlPlaneConfig.autoScaleDownDisabled to switch it off per cluster -- for
example to guard against an accidental or automation-driven desiredCount decrease
-- mirroring the node-pool autoProvisionDisabled opt-out. It is stored as a
cluster column (cp_auto_scale_down_disabled) like cp_max_surge: operational,
outside the append-only config snapshot, and not rollout-triggering.

Signed-off-by: Meha Mehta <meham@nvidia.com>

* fix(controller): count joined etcd members at the scale-down quorum floor

The record-time floor (countSurvivingJoinedControlPlane) counts every joined control-plane node toward quorum regardless of health, but the scale-down pre-check counted only the healthy clean-joined subset via scaleDownEligible. A joined-but-unhealthy node is still an etcd member, so the two floors could disagree and the pre-check could hold at the floor in a case the authoritative delete path would allow.

Count joined members in the removable set instead, mirroring the delete-path floor. The healthy-joined victim guard is kept, matching ensureControlPlaneQuorumFloor, which exempts a not-yet-joined or unhealthy victim so removing a dead member is never blocked.

Signed-off-by: Meha Mehta <meham@nvidia.com>

---------

Signed-off-by: Meha Mehta <meham@nvidia.com>
2026-10-28 10:22:35 -04:00
Tjark Rasche 9336f06eb4 feat(encryption): add recoverable owned etcd key rotation (#1376)
* feat(encryption): add recoverable owned etcd key rotation

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

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

Closes #1344

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Three guide corrections from review:

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

* docs(agent): say what defaultReloadPollInterval polls

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Addresses review threads r4335392969 and r4335393460.

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

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

Review fixes for PR #1376:

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

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

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

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

---------

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

* test(agent): report failing notices generator assertions

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

* fix(controller): escalate stranded accepted renewal cycles

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

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

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

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

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

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

---------

Signed-off-by: Tjark Gunnar Rasche <trasche@nvidia.com>
2026-10-26 14:57:18 +00:00
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
Jun Shun Zhang 229df84386 feat(controller): allow dev control planes without a VIP (#1893)
* feat(controller): allow dev control planes without a VIP

Closes #1892

Signed-off-by: Steven Zhang <stevenzhang@nvidia.com>

* docs: clarify no-VIP development guidance

Signed-off-by: Steven Zhang <stevenzhang@nvidia.com>

* docs: document accepted no-VIP rollout behavior

Signed-off-by: Steven Zhang <stevenzhang@nvidia.com>

* test(e2e): fit CAPD control planes to local memory

Signed-off-by: Steven Zhang <stevenzhang@nvidia.com>

---------

Signed-off-by: Steven Zhang <stevenzhang@nvidia.com>
2026-10-22 18:52:16 +00: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
Giuseppe Laguteta 6aa5166b3c feat(launchlayer): support external security group IDs (#1831)
Signed-off-by: Giuseppe Laguteta <glaguteta@nvidia.com>
2026-10-20 11:03:18 -07: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
vwilson-nvidia 17f1f606e0 feat(controller): support create-only Machine metadata (#1708)
- Add Machine labels and annotations to node pools and control-plane configuration
- Persist metadata and apply it when creating Machines
- Validate reserved domains with separate configurable allowlists
- Add tests and documentation; validate lifecycle behavior on Tilt with mock NICo

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

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

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

* chore(qualify): qualify the 2.4 OVN stream

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

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

* ci: free disk before the package reproducibility builds

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

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

---------

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

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

Signed-off-by: Noah Kontur <nkontur@nvidia.com>
Co-authored-by: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-16 09:11:48 -04:00
Miancheng Lin 3317737e1e refactor(api): rename the OS profile surface to releases (#1612)
* refactor(api): rename the OS profile surface to releases

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

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

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

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

The os_profile Prometheus label is deliberately unchanged.

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

* docs: follow the OS profile rename

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

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

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

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

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

---------

Signed-off-by: Miancheng Lin <mianchengl@nvidia.com>
2026-10-15 11:56:35 -07:00
vwilson-nvidia 814a635320 docs(api): hide configProfile from public API documentation (#1660)
- Hide all six configProfile properties using Fern annotations
- Prefix existing field descriptions with Deprecated:
- Remove public examples and prose while preserving API compatibility

Signed-off-by: Vivin Wilson <vwilson@nvidia.com>
2026-10-15 14:31:04 -04:00
pbikki fadaa3483e feat(controller): validate node pool labels and taints, with a configurable label allowlist (#1615)
* chore: validate node labels and taints

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

* feat(controller): make the node label allowlist configurable

Labels under kubernetes.io and k8s.io are rejected unless listed in
nodeMetadataAllowlistedLabelKeys in nke-controller-config (chart value
nodeMetadata.allowlistedLabelKeys, empty by default). Internal nke/nvke
domains and the control-plane role key are always reserved, and the
controller fails to start if the allowlist names them.

Rejection errors name the reserved domain the key falls under.

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

* docs(controller): clarify node label allowlist

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

* fix(controller): align reserved node metadata domains and pass name-check

Reserve nvke.nvidia.com, nke.nvidia.com and nke.io, dropping nvke.io.
The OpenAPI descriptions now list all three and mark the nke domains as
legacy. Allowlist the bare nke.io token in name-check: the controller
names it only to reserve it.

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

* fix(controller): address review on node metadata validation

Report the first invalid node label in sorted key order so repeated requests name the same key. Document the allowlist exclusions and startup validation in the chart values and README, and state why control-plane pools reject taints.

Regenerate the embedded OpenAPI spec in server.gen.go, which was stale after the rebase, and fix a label test that the new Calico gate rejected first.

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

---------

Signed-off-by: pbikki-nv <50849668+pbikki@users.noreply.github.com>
2026-10-14 13:25:14 -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
Davanum SrinivasandClaude Fable 5.1 17a88127b8 docs: say NVKE and nvkectl where the documents still said NKE and nkectl (#1462)
The mechanical half of the documentation change. The word NKE becomes
NVKE in prose across the Markdown documents, the docs navigation, the
Fern header text, NOTICE, the chart description and the OpenAPI
description text; nkectl becomes nvkectl wherever a document names the
CLI; a lowercase nke that is the product name becomes NVKE, the clone
directory in cd lines becomes nvke, and an identifier in a code span,
such as the dashboards' tag, becomes nvke.

Identifiers stay: NKE_* and NKECluster-style names, every nke-*,
nke.*, nke: and /.../nke persisted name, the "NKE Agent Version"
output line, the Keycloak realm and tenant names in examples, and the
Fern instance URL and /nke paths until the Fern instance is renamed.
The embedded OpenAPI spec is regenerated with the pinned toolchain. The
placeholder server URL in the spec counts as a removed object for the
compatibility gate, so the waiver file records that decision.

Not here: the editorial pass (first-use "NVIDIA Kubernetes Engine
(NVKE)", the glossary, the release-note paragraph listing the persisted
identifiers), which belongs with the new documentation set in #1391;
CHANGELOG.md, which is generated; the CLI's own documents, written with
intent in #1456; release/README.md and the issue templates, from #1460.

Closes #1461

Signed-off-by: Davanum Srinivas <dsrinivas@nvidia.com>
Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
2026-10-10 17:29:16 -04:00
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
pbikki 97c6dee071 feat(controller)!: add node labels and taints to the API schema (#1306)
Support adding nodelabels and taints in API. This change covers the OpenAPI schema, the generated API types, the database schema and migration, and the create and read handlers that store and return the values. Stored labels and taints are not applied to Kubernetes nodes, which matches current behavior. A follow-up MR will apply them. Shipping the schema now lets API consumers, including nkectl, adopt the new fields.

BREAKING CHANGE:

- nodeLabels changes from a list of key=value strings to an object of keys and values on control-plane and node-pool create and read.
- nodeLabels is removed from PATCH UpdateClusterControlPlaneConfig rejects unknown fields, so a patch that still sends controlPlaneConfig.nodeLabels returns 400. The same applies to a node-pool patch that sends nodeLabels or nodeTaints.
2026-10-08 17:00:49 -05:00
Alexander Greene 92a3039bae feat: default CNI to ovn-kubernetes (#1303)
* feat: default omitted CNI to ovn-kubernetes

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

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

* fix: build OVN packages outside the gitignored bin directory

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

---------

Signed-off-by: Alex Greene <algreene@nvidia.com>
2026-10-08 16:45:49 -04:00
srekhi93andClaude Sonnet 5.5 082ecd90dd feat(controller): make configProfile optional on nico control planes (#1343)
Update the OpenAPI descriptions for nico control planes and node pools to match
the validation change: configProfile is optional, and an empty value clears it
on a node pool. Regenerate the Go models and server. Also drop configProfile from
a stale comment about PATCH required fields.

Signed-off-by: Sahiba Rekhi <176530844+srekhi93@users.noreply.github.com>
Co-authored-by: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-08 14:36:37 -05:00
vwilson-nvidia abeacbeb0d refactor(controller)!: remove node pool configuration history (#1317)
- Remove the node pool config history endpoint and generated API types.
- Stop writing node pool audit workflows to the outbox.
- Remove the unused Temporal workflow and history handler.

BREAKING CHANGE: The node pool config history endpoint is no longer available.

Signed-off-by: Vivin Wilson <vwilson@nvidia.com>
2026-10-07 15:37:41 -06:00
Jun Shun Zhang 582740ef7e feat(controller): require kube-vip for control-plane changes (#1149)
* feat(controller): require kube-vip for control-plane changes

Signed-off-by: Steven Zhang <stevenzhang@nvidia.com>

* fix(controller): block control-plane NodeSet replacement without VIP

Allow CLI control-plane VIPs to match declared node IPs. Keep IPv4,
routable-unicast, pod CIDR, and service CIDR validation. Cover the first
and another declared node IP in validation, generated site specs, and
controller request forwarding tests.

Update documentation with the remaining kube-vip address cleanup and
bootstrap routing constraints. Configuration acceptance does not prove
bootstrap or networking works.

Validation: CLI fmt, lint, and test; CLI preflight with race tests and
license header checks.

Signed-off-by: Steven Zhang <stevenzhang@nvidia.com>

---------

Signed-off-by: Steven Zhang <stevenzhang@nvidia.com>
2026-10-07 15:18:31 +00:00
vwilson-nvidia e231a67156 feat(api)!: remove node workflow history endpoint (#1300)
- Remove the history route, handler, schemas, and generated API code.
- Remove the unused Temporal UI URL from configuration and the version response.
- Update related tests and configuration references.

BREAKING CHANGE: GET /api/nodes/{nodeID}/history and the temporalUIURL field in GET /api/version are removed.

Signed-off-by: Vivin Wilson <vwilson@nvidia.com>
2026-10-06 21:04:33 +00:00
vwilson-nvidia c5fd790b07 refactor(api)!: remove CNI plugin catalog endpoint (#1241)
- Remove the catalog route, handler, and generated API surface.
- Restrict cluster creation CNI values to calico and ovn-kubernetes.
- Preserve shared CNI validation and update API descriptions.

BREAKING CHANGE: GET /cniPlugins is no longer available.

Signed-off-by: Vivin Wilson <vwilson@nvidia.com>
2026-10-06 13:53:20 -04:00
Davanum Srinivas 2a7c3fb2cc docs(api): generate the REST API Reference from openapi.yaml (#1172)
* chore(api): lint openapi.yaml and mark the internal surface for Fern

Fern builds the REST API Reference tab of the documentation site from
controller/api/openapi.yaml, and the docs team is about to move the prose
of the "NKE REST API Reference" into that file. This is the tooling that
has to be in place first.

Lint gate. `make -C controller/api lint` now also runs `lint-spec`, which
lints openapi.yaml with vacuum against openapi-lint.yaml. vacuum is a
Spectral-compatible linter written in Go, so `go run` pins it the way
generate.go pins gofumpt, with no install step; the version lives in
make/tool-versions.mk with the other tools. Errors fail the gate: every
example matches its schema, no component is unused, operationIds are
unique. Warnings measure the prose the spec still lacks (16 operations
and 40 properties without a description, 31 schemas, no tags) and fail
nothing yet; each is raised to error once the prose port lands, so that
coverage cannot regress afterwards. Rules the API breaks on purpose
(camelCase paths and properties, a DELETE with a body, extensions beside
`$ref`) are off, with the reason beside each.

The one error it found is fixed here: the `nodePools` example on
CreateClusterRequest named a `namePrefix` field that does not exist and
had neither `name` nor `nodeNamePrefix`, both required.

Internal surface. The `infra` provider, `teleportEnabled`, the legacy
`controlPlane` node-pool flag, the `/osProfiles` and `/configProfiles`
endpoints, and the schemas only they reach now carry `x-fern-ignore:
true`. Fern leaves them out of the published reference; Swagger UI at
/api/docs/ and the generated Go are unchanged. `x-fern-audiences` was the
first choice and does not fit: `fern ir --audience public` returns an
empty API unless every element is tagged, so a new endpoint would vanish
from the customer docs by default. The ignore marker is opt-out, and the
IR confirms it removes exactly the listed items.

The two "exactly one of `nico` or `infra`" sentences move from the schema
descriptions onto the `infra` properties, so the published reference,
which does not show `infra`, no longer refers to it. Only comments change
in the generated Go.

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

* fix(api): keep `infra` out of the text the customer reference shows

The previous commit moved the "exactly one of `nico` or `infra`" sentences
onto the `infra` properties and said the published reference no longer
refers to `infra`. That was wrong on two counts, found by rendering the
spec with Redoc and dumping Fern's intermediate representation.

A description written beside a `$ref` is read by Fern and ignored by
Redoc, Swagger UI and oapi-codegen, which show the referenced schema's
description instead. So is `x-go-type-skip-optional-pointer` beside a
`$ref`: the generated field was a pointer all along. And six schema
descriptions that Fern does show still named `infra`: the control-plane
create and update configs, the node pool update request, and the three
NICo provider schemas.

Those six no longer mention the other provider. The exclusivity rule now
lives on the Infra* schemas, which the published reference omits and
Swagger UI shows. The four `nico` and `infra` properties touched before
wrap their `$ref` in `allOf`, so every reader applies the description, and
drop the pointer extension that was never in effect; the generated Go
changes only in comments. no-$ref-siblings moves from off to warn, with
an accurate note, so the docs port can work the remaining 28 down.

Verified: Fern IR has 0 docs strings mentioning `infra`; Redoc shows the
new `nico` text and none of the old sentences; make -C controller/api
lint passes with 0 errors.

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

* docs(api): port the REST API Reference prose into openapi.yaml

The docs team wrote "NKE REST API Reference (Alpha) - Customer Edition"
by hand. This moves its language into the spec, so the reference is
generated from the file the code is generated from. The text is taken
as written; claims the code contradicts are corrected in the commits
that follow, each with its evidence, so the review can see both.

What moved: the info block (title, version, and the conventions: base
URL, authentication, errors, asynchronous operations, PATCH merge
semantics, lists, unauthenticated endpoints); tags carrying the concept
text (infrastructure provider, Kubernetes versions, networking, control
plane, OS releases); a summary, a description and the documented 400
and 409 rules for each of the 22 operations; request examples for the
five writes and response examples for the error cases the PDF shows;
path and query parameter text; and a description for every schema and
property.

Structure is unchanged: no required list, enum, pattern or bound moved,
no schema was renamed, and the health endpoints stay out of `paths`.
They are described in the info block instead, because the generated
router would mount them under /api. Every property whose `$ref` had
sibling keys now wraps the `$ref` in `allOf`: Redoc, Swagger UI and
oapi-codegen ignore the siblings and Fern reads them, so this is the
only form all four render. The `x-order` and
`x-go-type-skip-optional-pointer` keys beside those `$ref`s are dropped,
since neither ever applied there. The generated Go changes only in
comments; struct fields keep their order.

vacuum reports no warnings left. Its coverage rules are raised to
errors in a later commit.

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

* docs(api): configProfile is required, the PDF left it out

The PDF never mentions `nico.configProfile`, and its create examples omit
it. The server requires it: a NICo node pool without one is rejected
("nico.configProfile is required when creating a nico node pool",
controller/internal/server/node_pools.go:298), and so is a control plane
("controlPlaneConfig.nico.configProfile is required for a nico cluster
control plane", cluster_control_plane_config.go:206 and :239). Every
example in the PDF would have failed with 400.

The field is now described as required on the node pool and control-plane
create schemas, the two create operations list it among their 400 causes,
and the three request examples carry it.

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

* docs(api): describe OS profiles as the controller resolves them today

The PDF describes `osProfile` as the name of a release in an Operator
curated catalog of MachineImage, ClusterRelease and NodePoolRelease
entries, managed with nkectl. Those kinds exist as CRDs in
management-engine/ (#1085, 2026-09-29), but nothing consumes them yet:
management-engine/README.md says lifecycle reconciliation and the public
API are not implemented, and the controller still reads OS profiles from
its profiles directory (controller/internal/server/os_profiles.go:35),
supplied by the Operator as described in controller/profiles/README.md.

The reference now says what the API does today: `osProfile` and
`configProfile` name profiles the Operator supplies to the management
plane, and changing `osProfile` rolls the affected nodes. The catalog
text returns when the controller resolves names against it. Example
names follow the example bundle in controller/profiles/example.

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

* docs(api): use the server's real error messages in the examples

Three error examples in the PDF are paraphrases. The server says:
"cluster update rejected: <op> in progress since <time>"
(controller/internal/server/clusters.go:67), "Cannot create node pool
when parent cluster is deleting" (node_pools.go:173), and for a
control-plane delete that would breach the minimum, the sentence in
controller/internal/nodes/control_plane_delete_request.go:57.

ClusterConditions also listed `upgrading` as required, a property the
schema does not define. The PDF's required list (provisioning,
provisioned, deleting) is the correct one. Nothing in the generated Go
refers to it, so only the spec changes.

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

* chore(api): make the OpenAPI prose coverage rules errors

With the REST API Reference prose in the spec, vacuum reports nothing.
The coverage rules that were warnings so the gate could land first now
fail the gate: every operation, parameter, schema and property has a
description, and no description sits beside a bare `$ref`.

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

* docs(api): quote the node-name pattern so renderers do not eat the angle brackets

Redoc rendered "Node names are <cluster>-<prefix>-<NNNN>" as "Node names are --":
markdown treats the angle brackets as HTML tags. Backticks keep them.

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

* docs: make fern check pass and pin the Fern CLI

`fern check` could not run: fern/docs.yml named a `components` directory
that does not exist in the repository, so the checker failed to
initialize. With that line gone it ran, and reported three broken links,
all pointing at repository directories the documentation site cannot
serve. They now point at the directories on GitHub.

fern/fern.config.json pinned the CLI to `latest`; it now pins the version
CI runs, which make/tool-versions.mk carries as FERN_VERSION. Related:

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

* ci(api): render the REST API Reference with Redocly and check the docs site

`make -C controller/api docs` renders openapi.yaml into one self-contained
HTML page with Redocly. It bundles first, because `build-docs` applies no
decorators, and redocly.yaml's `remove-x-internal` decorator is pointed at
`x-fern-ignore`, so the page drops the same surface the Fern site drops.
The output lands in controller/.local/, which git ignores. Node is
required; npx fetches the pinned CLI.

The new `API docs` workflow is advisory: it builds that page on every pull
request that touches the spec or the docs and uploads it as the
`api-reference` artifact, runs `fern check`, and on main publishes the
Fern site when FERN_TOKEN is set. The secret is not configured yet, so
that step is skipped and says so. Publishing needs a secret, which the
workflow design guide keeps out of the required gate; that is why this is
not a merge-gate member.

Both CLIs are pinned in make/tool-versions.mk. The runner's preinstalled
Node is used rather than a new pinned setup action.

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

* fix(api): keep request-schema $ref properties bare

Wrapping a request property's `$ref` in `allOf` changed the 400 body.
kin-openapi reports a failure inside an `allOf` as a raw schema error,
"Error at \"/controlPlaneConfig\": Doesn't match schema \"not\"" followed
by a dump of the schema, instead of the one-line "request body has an
error: ..." message, and the middleware passes it through whole.
TestOpenAPIValidator_CreateRequiresExactlyOneProvider caught it: the
control-plane cases no longer carried the request-body prefix the test
uses to tell a schema rejection from a handler rejection.

The fifteen `$ref` properties in request schemas are bare again, with
their prose on the referenced schemas, which every renderer shows. The
response schemas keep the `allOf` form; nothing validates responses.
The sibling rule is an error, with the five deliberate `x-fern-ignore`
siblings on the `infra` properties listed in openapi-lint-ignore.yaml.
The generated Go changes only in comments.

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

* build(api): regenerate with the Go toolchain api/go.mod declares

generate-check failed on the pull request while passing locally and on
the Linux box. The embedded copy of openapi.yaml in server.gen.go is
gzip-compressed, and compress/flate output differs between Go releases:
the workspace asks for Go 1.27.1, so a developer regenerating in the
workspace produces one blob, while generate-check.yml installs the
1.26.5 that controller/api/go.mod declares and produces another.

`make -C controller generate-api` now runs the generator with GOWORK=off,
since the api module is self-contained, and GOTOOLCHAIN pinned to the
version api/go.mod declares, so every developer regenerates the bytes
the gate expects. server.gen.go is regenerated that way here; only the
embedded blob changes.

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

* docs: render the tag descriptions in the Fern API tab

controller/api/openapi.yaml now carries the concept text on its tags.
`tag-description-pages: true` makes Fern render each tag description as
the intro of its section in the REST API Reference, so that text ships
with the reference instead of only in Swagger UI.

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

* ci(api): publish a Fern preview of the site for pull requests

The `API docs` workflow now publishes a Fern preview, API Reference tab
included, on every pull request and manual run that has FERN_TOKEN, and
writes the preview URL to the job summary and as a notice. A stable id,
pr-<number>, makes a later push overwrite the same preview, and a cleanup
job deletes it when the pull request closes.

FERN_TOKEN is an organization secret, but GitHub withholds secrets from
`pull_request` runs of fork pull requests, so those runs say why no
preview was published instead. Push the branch to this repository and
dispatch the workflow to preview a fork pull request.

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

* docs(api): give Fern an absolute server and order the reference sections

The spec's only server was the relative `/api`, which is right for the
embedded Swagger UI and the request validator but left Fern rendering
request examples against `https:/https://api/...`. A second server with
the placeholder host the PDF uses, `https://nke.acme.example/api`, now
carries the examples; the relative one stays first, so Swagger UI's
default and the validator's routing are unchanged, and is marked
`x-fern-ignore`, so Fern and the Redocly page show only the absolute one.
The validator still accepts requests on any host through the relative
server; the server tests cover it.

In docs/index.yml the API tab is flattened, so the path no longer repeats
`rest-api-reference`, and the sections are laid out in reading order,
Clusters first, instead of in order of first appearance, which put the
one-endpoint Catalog section at the top.

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

* docs: do not repeat rest-api-reference in the API tab's URL

The tab slug and the api item's slug were both derived from the same
title, so every reference page lived under
/nke/rest-api-reference/rest-api-reference/. skip-slug on the tab keeps
one segment.

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

* docs: skip the api item's slug, not the tab's

skip-slug on the tab left the path unchanged on the preview; the
duplicated segment comes from the api item, so skip that one.

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

---------

Signed-off-by: Davanum Srinivas <dsrinivas@nvidia.com>
2026-10-02 08:28:37 -04:00
Meha Mehta 1a6c583246 fix(controller): drop misleading ControlPlaneConfig teleportEnabled default (#1043)
The ControlPlaneConfig read schema declared teleportEnabled `default: true`,
which contradicted both its sibling read schemas (Cluster, NodePool, NodeSet
all default to false) and the actual server behavior. The effective default is
env-driven (DEFAULT_CP_POOL_ENABLED / DEFAULT_CLUSTER_ENABLED /
DEFAULT_WORKER_POOL_ENABLED), all of which default to false and are not set by
the shipped chart, so an omitted teleportEnabled resolves to false, not true.

Drop the `default: true` from ControlPlaneConfig so the read model no longer
advertises a default the server will not honor. No Go type change (the field is
already *bool omitempty); only the embedded spec in server.gen.go is
regenerated.
2026-09-28 12:19:32 -04:00
vwilson-nvidia 8e8023f5af feat(controller)!: configure SPIRE attestation at deployment (#850)
- remove SPIRE attestation selection from cluster and node-pool APIs
- add deployment-wide Helm configuration with TPM as the default
- use controller configuration for CAPI bootstrap and join-token creation
- add chart assertions for the deployment contract

BREAKING CHANGE: Cluster and node-pool API requests no longer accept
spireAttestationMethod. Configure nodeAgent.spireAttestationMethod in
controller Helm values instead.

Signed-off-by: Vivin Wilson <vwilson@nvidia.com>
2026-09-21 13:28:29 -04:00
Abhay Krishna 3931c23c10 feat(controller): serialize control-plane deletes (#471) 2026-09-17 09:51:52 -07:00
vwilson-nvidia 6112ced7f6 fix(controller): protect claimed pending nodes from scale-down (#693)
- Add a provisioningClaimed node condition that provisioning workflows set before provider readiness.

- Exclude claimed pending nodes from node set scale-down deletion.

- Backfill the new condition for existing nodes and expose it through the node API.

- Cover workflow claiming, scale-down selection, CAPI wait behavior, and API mapping with tests.
2026-09-15 11:38:31 -04:00
Meha Mehta c56c0edb58 feat(api): control-plane rollout status, config snapshot IDs, and config history (#691)
Add a read-only API surface for control-plane-controller rollout state so
operators and tooling can see, per cluster and per node, which control-plane
config each node is pinned to, what the cluster desires, and whether a rollout
is pending or in flight.

- Per-node controlPlaneRollout on GET /nodes and GET /nodes/{id}: pending,
  actionable, a field-agnostic changes list (field/from/to), and
  pinnedConfigurationID / desiredConfigurationID snapshot references, populated
  only for control-plane-controller-managed nodes. Clients render drift from
  changes and resolve the full pinned/desired snapshots via configHistory.
- Cluster rollout summary on GET /clusters/{id}/control-plane (.status.rollout):
  managedNodeCount, upToDateNodeCount, pendingNodeCount, inProgressNodeCount,
  inProgress, recyclingEnabled. The three counts are mutually exclusive and sum
  to managedNodeCount; a node is upToDate only when it has converged and is
  kubernetesReady, so a freshly recycled but not-yet-Ready node is counted as
  inProgress rather than overstating converged capacity.
- New controlPlaneRolloutRequired node condition: for
  control-plane-controller-managed nodes, True when the node's pinned config has
  drifted from the cluster's desired config and it needs a roll (False when up to
  date), carrying lastTransitionTime so consumers can tell how long a node has
  needed a roll. Stored in the existing JSONB conditions column (no migration).
- New GET /clusters/{id}/control-plane/configHistory: ordered config-snapshot
  history with per-field diffs, isCurrent, changeReason and createdBy;
  changedFields always serializes as an array, never null.

Introduces db.ComputeControlPlaneRolloutChanges (OS profile, config profile,
Kubernetes version) as the single source of truth for whether a control-plane
node needs rollout and what changed, so the reported state, the changes list, and
the controlPlaneRolloutRequired condition cannot drift from what the
control-plane controller acts on. The only persistence-layer addition is a
read-only ListControlPlaneConfigurationsByCluster query against the existing
control_plane_configurations table. Generated api/*.gen.go is regenerated from
api/openapi.yaml.
2026-09-14 15:57:39 -07:00
vwilson-nvidiaandTerry Howe 63cc445669 revert(api): remove infrastructure provider discovery endpoint (#680)
* revert(api): remove infrastructure provider discovery endpoint

Remove the provider discovery endpoint from the controller API while keeping the supported infrastructure provider configuration for provider admission policy.

The generated API client, server, and model files are regenerated from the updated OpenAPI spec.

* style: format controller server wiring

---------

Co-authored-by: Terry Howe <thowe@nvidia.com>
2026-09-11 13:59:08 -06:00
Chao 59936c13d9 refactor(api): remove etcd safety override fields (#589)
* refactor(api)!: remove etcd safety override fields

Remove allowQuorumLoss and allowSingleVoter from DeleteNode and delete their controller, workflow, chart, and E2E wiring. Keep the legacy fallback aligned with the typed RPC by permitting only its 2-to-1 single-voter transition.

BREAKING CHANGE: DeleteNodeRequest no longer accepts allowQuorumLoss or allowSingleVoter.

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

* fix(e2e): route local entrypoint pulls through mirror

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

---------

Signed-off-by: Chao Chen <chaoch@nvidia.com>
2026-09-09 14:54:15 -07:00
vwilson-nvidia 08b9aa8dfe feat(api): add cluster provider discovery endpoint (#563)
* feat(api): add cluster provider discovery endpoint

Add GET /api/clusterProviders so clients can discover the provider payload keys advertised by a CWE deployment.

The endpoint reflects SupportedInfraProviders from controller config, using the SUPPORTED_INFRA_PROVIDERS env var name chosen by the provider-policy work. It is discovery-only and does not add admission validation.

Signed-off-by: Vivin Wilson <vwilson@nvidia.com>

* test(os-image): skip GNU sed check on non-GNU hosts

Signed-off-by: Vivin Wilson <vwilson@nvidia.com>

* fix(api): rename provider discovery endpoint

Signed-off-by: Vivin Wilson <vwilson@nvidia.com>

---------

Signed-off-by: Vivin Wilson <vwilson@nvidia.com>
2026-09-08 20:39:14 -04:00
Miancheng Lin b6a25000fa refactor(restapi)!: nest provider fields under nico and infra payload (#246) 2026-09-04 12:28:43 -06:00
vwilson-nvidia ff8b919b46 refactor(api)!: remove legacy site APIs (#439)
Remove the legacy CWE site and VIP allocation API surface, along with the server and database query layers that backed it.

Update tests, e2e fixtures, Tilt resources, and local helper scripts so cluster creation no longer tries to register default or mock sites before submitting cluster requests.

BREAKING CHANGE: The /sites and /vipAllocations API endpoints are removed.

Signed-off-by: Vivin Wilson <vwilson@nvidia.com>
2026-09-03 10:08:46 -06:00
Meha Mehta 1bcf4f5f67 feat(api): expose control-plane read APIs and use them in e2e (#370)
Add read-only control-plane surfaces to the CWE API:
- a controlPlane indicator on the node read model
- a controlPlane filter on GET /nodes (true returns control-plane nodes, false returns workers)
- a read-only GET /clusters/{clusterID}/control-plane resource returning the
  persisted control-plane config plus aggregate runtime status (node counts,
  Kubernetes version, and the upgrade/recycling conditions)

Route the control-plane e2e helpers through these surfaces instead of the
NodePoolID == nil heuristic: AssertControlPlaneNodesReady reads the cluster
control-plane resource aggregate status, and ControlPlaneNodeNames and
ControlPlaneNodeIDs use the ListNodes controlPlane filter, so the new APIs are
exercised through the existing cp-controller lifecycle.
2026-08-28 11:29:01 -06:00