mirror of
https://github.com/dsx-ai-factory/nvke.git
synced 2026-12-07 04:35:58 +08:00
* 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>