Skip to content

[17.0-stable] pkg/kube: port cluster-init.sh to Go daemon - #7058

Open
rucoder wants to merge 71 commits into
lf-edge:17.0-stablefrom
rucoder:rucoder/17.0-kube-init
Open

rucoder wants to merge 71 commits into
lf-edge:17.0-stablefrom
rucoder:rucoder/17.0-kube-init

Conversation

@rucoder

@rucoder rucoder commented Nov 6, 2026 •

Copy link
Copy Markdown
Contributor

Description

Backport kube-init, the Go daemon that replaced cluster-init.sh on master (#5971), to 17.0-stable. 17.0-stable still runs the shell version. Every kube fix on master since #5971 lands in kube-init, so each one has had to be rewritten in shell to reach 17.0: #6584, #6727, #6753, #6832, #6886, #6887 and #6917 all were. 17.0 also misses the kube-init fixes nobody rewrote. With kube-init on 17.0-stable, master's kube fixes cherry-pick as they are.

Backport of #6116, #5971, #6309, #6449, #6456, #6499, #6507, #6542, #6590, #6599, #6614, #6652, #6665, #6702, #6704, #6755, #6771, #6794, #6796, #6860, #6861, #6897, #6934

This is a single PR. The earlier plan (#7055 and a re-vendoring PR first) is dropped together with #6697, which is not being backported: kube-init does not use cnirpc or anything #6697 added.

What it contains, in order:

  1. eve-k: disable apiserver watch cache on multi-node clusters #6116, disable the apiserver watch cache on multi-node clusters. kube-init stages that manifest, so it goes first.
  2. pkg/kube: port cluster-init.sh to Go daemon #5971, the daemon itself, and the master fixes to it that 17.0-stable has no version of: eve-k: add cluster tie-breaker support to evetest, fix pkg/kube kubeclient regression #6309, kube-init: fix eve-k VNC proxy regressions from the bash rewrite #6456, kube-init: raise the k3s start deadlines to 30 minutes #6599, kube-init: address the k8s node by its normalized name when re-applying labels #6704, eve-k: fix app deployment on arm64 #6861, Longhorn fixes: Node CR spec.name on recreate and disk-status readiness gate #6860, kube-init: bound API calls and the Longhorn pod exec with timeouts #6897, kube: expire events after 1h, drop the 72h backlog #6934, plus the dependency bumps build(deps): bump google.golang.org/grpc from 1.82.1 to 1.83.1 in /pkg/kube/kube-init #6449, build(deps): bump google.golang.org/grpc from 1.83.1 to 1.83.2 in /pkg/kube/kube-init #6499, build(deps): bump github.com/containerd/containerd/v2 from 2.2.5 to 2.2.8 in /pkg/kube/kube-init #6507, build(deps): bump github.com/containerd/containerd/v2 from 2.2.8 to 2.2.9 in /eve-tools/bpftrace-compiler #6652 and build(deps): bump github.com/moby/sys/user from 0.4.0 to 0.4.1 in /pkg/kube/kube-init #6755.
  3. The kube-init half of master PRs whose shell or pillar half is already on 17.0-stable: mgmtproxy: require proxy-auth token, TLS, and a destination policy on the cni0 listener #6542 (on 17.0 as [17.0-stable] mgmtproxy: require proxy-auth token, TLS, and a destination policy on the cni0 listener #6584), evetest: port scans; fix the exposure they found on EVE and EVE-k #6665 ([17.0-stable] evetest: port scans; fix the exposure they found on EVE and EVE-k #6753), kube-init: recycle controller pods after a single→cluster datastore migration #6702 ([17.0-stable] kube-init: recycle controller pods after a single→cluster datastore migration #6917), kube-init: fix the SR-IOV device plugin gate and the system-pod readiness livelock #6590 ([17.0-stable] kube-init: fix the SR-IOV device plugin gate and the system-pod readiness livelock #6886), Fix CDI HTTP DataVolume imports through the mgmtproxy cni0 TLS proxy #6794 ([17.0-stable] Fix CDI HTTP DataVolume imports through the mgmtproxy cni0 TLS proxy #6887), kube: clear the retired pod subnet when a node joins #6614 ([17.0-stable] kube: clear the retired pod subnet when a node joins #6727), dom0-ztools: confine containerd to ctrd_max_vcpus #6771 ([17.0-stable] dom0-ztools: confine containerd to ctrd_max_vcpus #6832). Where the 17.0 version already has a commit's pillar or shell part, the commit here carries only its kube-init files: the mgmtproxy cni0 listener (mgmtproxy: require proxy-auth token, TLS, and a destination policy on the cni0 listener #6542), the cluster status server authentication (evetest: port scans; fix the exposure they found on EVE and EVE-k #6665), holding app volume creation until controllers are recycled (kube-init: recycle controller pods after a single→cluster datastore migration #6702) and the CDI bump (Fix CDI HTTP DataVolume imports through the mgmtproxy cni0 TLS proxy #6794).
  4. The rest of those PRs, so they come over whole:
  5. eve-k: fix VM failover held back by the stats lease and a false portmap overlap #6796's two zedkube commits, added on review so they are not forgotten. [17.0-stable] zedrouter: ignore portmaps on Switch NIs in the overlap check #6797 backported only its zedrouter commit, because these two needed the backup-DNID series (eve-k: let a healthy peer act for a downed node's designated app (backup DNID) #6505), which reached 17.0-stable later in [17.0-stable] eve-k: let a healthy peer act for a downed node's designated app (backup DNID) #6867. They apply cleanly here:
    • the VMIRS replica reset follows the 60s eve-app-op lease instead of the 300s stats lease, so failover is not held back for up to five minutes when the dead node was the stats leader.
    • the failover branch runs only when a pod is terminating.
  6. 17.0-only commits:

Not included:

tools/bump-and-commit.sh finds no package hash to update.

Backported commits

Cherry-picked with -x from master, grouped by master PR:

#6116

  • 27496ff pkg/kube: disable apiserver watch cache on multi-node clusters

#5971

  • 66f1559 pkg/kube/kube-init: vendor k8s.io v0.34.1 and containerd v2.2.5
  • f89ab6b pkg/kube/kube-init/state: markers, atomic writes, reboot
  • a96859d pkg/kube/kube-init/state: /var/lib snapshot and rollback
  • c6521d1 pkg/kube/kube-init/prereqs: kernel modules, cgroup, iSCSI, vault + containerd wait
  • 8803295 pkg/kube/kube-init/prereqs: lend the control plane idle CPUs on first boot
  • 9f3cf92 pkg/kube/kube-init/k3s: config drop-ins, supervisor, readiness, node-password, install
  • 6e6aabe pkg/kube/kube-init/update: k3s and cluster-component upgrade flow
  • c9144fa pkg/kube/kube-init/kubeclient: process-wide client-go bundle with Default()
  • 3745588 pkg/kube/kube-init/kubectlx: typed client-go and containerd convenience layer
  • 9a5dbe0 pkg/kube/kube-init/deploy: Component API, work-queue scheduler, BestEffort retry loop
  • 64570bd pkg/kube/kube-init/pubsubclient: shared pillar pubsub subscription manager
  • d0c1251 pkg/kube/kube-init: pubsub subscriptions and lifecycle publication
  • 335af07 pkg/kube/kube-init/images: image tarball import into containerd
  • 856c364 pkg/kube/kube-init/mgmtproxy: cni0 anchor IP + CDI ImportProxy + containerd env
  • 794a58a pkg/kube/kube-init/clustermode: single↔HA transitions, master leases, startup stagger
  • 3355cc4 pkg/kube/kube-init/monitor: RUNNING-state watchers
  • ee13ef0 pkg/kube/kube-init/tiebreaker: three-node HA tie-breaker configuration
  • e3cef7c pkg/kube/kube-init/components: Multus, KubeVirt, CDI, Longhorn, descheduler, RBAC, SR-IOV, kube-vip
  • 8d45ff2 pkg/kube/kube-init/vnc: VNC proxy with caller-PID watchdog
  • 9abf8cc pkg/kube/kube-init: FSM entry point
  • 933cef7 pkg/kube/kube-init/cmd/k3s-sctl: operator CLI for the control socket
  • 7487742 pkg/kube: Dockerfile entrypoint, k3s-control wrapper, kubevip-delete helper
  • c0cfc4b pkg/kube: retire shell library files replaced by the Go daemon
  • 3b3e9aa pkg/kube: kubevirt-features.yaml declare empty arrays for permittedHostDevices
  • 84b63ae images: pre-load KubeVirt v1.7.3, not v1.6.0
  • a0dd81e kube-init: one declaration per component version
  • 6f72bdd kube-init: migrate the legacy K3sBase marker after /var/lib is mounted
  • 259f9de kube-init: finish an update the k3s step left open
  • ec4c168 kube-init: guard the multus CRD-before-instance precondition
  • e946941 kube-init: fix yetus spelling and comment nits
  • 83b1382 kube-init: fix external-boot-image tarball path
  • a7cdcba Makefile: build kube-init binary + linuxkit package
  • d1b6f47 .spdxignore: skip pkg/kube/kube-init/vendor from SPDX scan
  • 3ef0d4a Makefile: run the kube-init tests in make test

#6309

  • 30cbb56 pkg/kube: rebuild the kubeclient when the k3s kubeconfig changes

#6449

  • 350e8ed build(deps): bump google.golang.org/grpc in /pkg/kube/kube-init

#6456

  • 7fdde36 kube-init: fix eve-k VNC proxy regressions from the bash rewrite

#6499

  • 3b31222 build(deps): bump google.golang.org/grpc in /pkg/kube/kube-init

#6507

  • 741f541 build(deps): bump github.com/containerd/containerd/v2

#6590

  • 25c86e8 kube-init: only deploy the SR-IOV device plugin when network VFs exist
  • 7314b4c kube-init: stop one wedged system pod from pinning the node out of RUNNING

#6542

  • 5a86d93 kube-init: route the k3s binary download through mgmtproxy
  • c7daf10 kube-init: route kubectlx manifest fetches through mgmtproxy
  • 5327945 mgmtproxy: require proxy-auth token, TLS, and a destination policy on the cni0 listener

#6599

  • f8b3509 kube-init: raise the k3s start deadlines to 30 minutes

#6614

  • adb213c kube: clear the retired pod subnet when a node joins

#6652

  • 327e998 Bump containerd/v2 to 2.2.9 in kube-init

#6665

  • 042622f zedkube: authenticate the cluster status server
  • 7fddaf2 kube: keep servicelb and traefik disabled

#6704

  • 5e153e0 kube-init: address the k8s node by its normalized name when re-applying labels

#6755

  • a4cbd44 build(deps): bump github.com/moby/sys/user in /pkg/kube/kube-init

#6771

  • d0f8eb9 kube-init: widen containerd's cpuset for the first boot

#6794

  • c5248c8 pkg/kube: bump CDI v1.57.1 -> v1.66.1

#6796 (zedrouter commit already on 17.0-stable via #6797)

  • 902a643 zedkube: gate the VMIRS replica reset on the eve-app-op lease
  • 007a6ed zedkube: start a failover only when a pod is terminating

#6861

  • 6a33fb4 kube-init: deploy CDI on arm64
  • e700961 domainmgr: don't wait for KubeVirt on non-amd64
  • 1e3232b volumemgr: keep the image of a native container on eve-k

#6702

  • c8414b0 kube-init: recycle controller pods after a single→cluster datastore migration
  • a407274 kube-init, pillar: hold app volume creation until controllers are recycled

#6860

  • 07070ee kube-init: set spec.name when recreating a missing Longhorn Node object
  • 638874a kubeapi: gate Longhorn readiness on recorded disk status

#6897

  • a32ead2 kube-init: bound kubeclient API calls with a request timeout
  • ed0b52e kube-init: put a deadline on the Longhorn pod exec

#6934

  • 01073b8 kube: expire Kubernetes events after 1h
  • 6babf29 kube: drop events left from the 72h event-ttl

17.0-only commits, not cherry-picks:

  • pkg/kube: retire the 17.0-only helpers kube-init replaces
  • pillar: point the kube-side contract comments at kube-init
  • kube-init: declare go 1.25.0 like the other EVE modules
  • kube-init: pin pillar at a 17.0-stable commit

How to test and validate this PR

Automated, in CI: make test now runs kube-init's unit tests, and the eve-k build compiles the daemon.

Done locally:

  • make pkg/kube and make pkg/pillar build.
  • kube-init unit tests pass under -race (the command make test runs). The pillar unit tests for kubeapi, volumemgr, domainmgr and zedkube pass, including the new Longhorn disk-status and native-container tests and eve-k: fix VM failover held back by the stats lease and a false portmap overlap #6796's TestIsDecisionNodeFollowsAppOpLease.
  • go vet -tags k ./... on pillar is clean.
  • mini-yetus: clean apart from two revive warnings on lines that are unchanged from master and 17.0-stable.
  • tools/bump-and-commit.sh finds no package hash to update.

Still to do on eve-k hardware (amd64 and arm64):

  1. Fresh install, single node: k3s, KubeVirt, CDI and Longhorn come up and the node reaches RUNNING; deploy a VM app and a native container app.
  2. Upgrade a node running a 17.0-stable build (with cluster-init.sh) to this build: kube-init takes over the existing k3s state without reinstalling, and the apps keep running.
  3. Three-node cluster: form the cluster, convert a single node to a cluster member, fail over an app, and reboot a node.
  4. arm64: a native container app deploys and survives a reboot (eve-k: fix app deployment on arm64 #6861).

Changelog notes

eve-k: cluster bring-up and update now run in the Go kube-init daemon instead of cluster-init.sh, as on master. It brings the fixes made to kube-init on master since, plus Longhorn readiness and arm64 app deployment fixes.

Fixed VM app failover on eve-k clusters being delayed by up to five minutes when the failed node was the cluster's stats leader.

Checklist

  • I've provided a proper description
  • I've added the proper documentation (kube-init's README comes with pkg/kube: port cluster-init.sh to Go daemon #5971; nothing new)
  • I've tested my PR on amd64 device
  • I've tested my PR on arm64 device
  • I've written the test verification instructions
  • I've set the proper labels to this PR

// https://github.com/lf-edge/eve/pull/5971.
httpsClient := &http.Client{
Transport: &http.Transport{
TLSClientConfig: &tls.Config{InsecureSkipVerify: true}, //nolint:gosec // lgtm[go/disabled-certificate-check]
@codecov

codecov Bot commented Nov 6, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 24.36%. Comparing base (c6776e7) to head (4604861).
⚠️ Report is 2 commits behind head on 17.0-stable.

Additional details and impacted files
@@               Coverage Diff               @@
##           17.0-stable    #7058      +/-   ##
===============================================
+ Coverage        23.73%   24.36%   +0.63%     
===============================================
  Files              517      528      +11     
  Lines            95847    97461    +1614     
===============================================
+ Hits             22747    23748    +1001     
- Misses           71164    71816     +652     
+ Partials          1936     1897      -39     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@rene rene left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Kicking off tests....

@eriknordmark eriknordmark left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Half of #6796 (pillar, not kube-init) never reached 17.0-stable since it depended on this go daemon. It makes sense to add those commits in this PR to avoid it getting forgotten (since it looks like it has already been backported).

@rucoder

rucoder commented Nov 16, 2026

Copy link
Copy Markdown
Contributor Author

Half of #6796 (pillar, not kube-init) never reached 17.0-stable since it depended on this go daemon. It makes sense to add those commits in this PR to avoid it getting forgotten (since it looks like it has already been backported).

@eriknordmark good catch! I added missing commits to the PR

@milan-zededa

Copy link
Copy Markdown
Contributor

@rucoder Please rebase on the latest upstream/17.0-stable so that we can trigger evetests.
We already have the baseline to compare against: https://lf-edge.github.io/eve/test/17.0-stable/

@rucoder
rucoder force-pushed the rucoder/17.0-kube-init branch from 126494d to ee47d97 Compare November 19, 2026 09:18
@rucoder

rucoder commented Nov 19, 2026

Copy link
Copy Markdown
Contributor Author

@rucoder Please rebase on the latest upstream/17.0-stable so that we can trigger evetests. We already have the baseline to compare against: https://lf-edge.github.io/eve/test/17.0-stable/

@milan-zededa done!

@milan-zededa

This comment has been minimized.

@milan-zededa milan-zededa left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All eve-k tests passed, with the exception of TestVMAppPurgeDuringFailover, which is a known issue that remains unresolved: #6610

Test results: https://github.com/lf-edge/eve/actions/runs/44537571141

All other eve-kvm test failures are known, already documented in the 17.0-stable nightly ledger, and unrelated to this PR.

So, from a testing perspective, we're good to proceed with the merge.

@eriknordmark eriknordmark left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@eriknordmark

Copy link
Copy Markdown
Contributor

We'll ignore the two yetus -1 votes. Both issues are already present in master, and keeping this port identical to master is more important than diverging to silence them.

  • golangcilint: pkg/kube/kube-init/.golangci.yml lists typecheck under linters.disable, which golangci-lint 2.11.4 rejects (can't load config: typecheck is not a linter, it cannot be enabled or disabled). Master has the same file and the same error in its base scans. It counts as "new" here only because 17.0-stable has no kube-init module.
  • revive: pkg/kube/kube-init/deploy/deploy.go:425:2 (context-as-argument) is in master's identical deploy.go too.

@github-actions

This comment has been minimized.

@eriknordmark

Copy link
Copy Markdown
Contributor

Correction to the TestClusterPVCRedownload analysis above (run 44593997184): its root cause and its attribution to this PR are not supported by the logs.

  • Not new code. acceptclustercontenttree.go, pvcadoptprobe.go and the refs == 0 branch are on 17.0-stable since 5513e0f. This PR adds only the native-container guard from eve-k: fix app deployment on arm64 #6861 (already on master), which did not fire: edge-dev1's log has no "is a native container" line.
  • The DOWNLOADING tree is vm2-image (ea416565), not vm1's. edge-dev1's ContentTreeStatus dump shows both trees with the same SHA256 and IsLocal=true: vm1-image is REMOTELOADED (125), as intended; vm2-image is DOWNLOADING (103). At 21:08:21 volumemgr ran reevaluateBackupDNIDContent on vm2-image ("node 6c9eec1b-… unhealthy for 13m0s, past threshold 10m0s") and re-drove it as local, so it downloads from the blocked datastore. That is the backup-DNID takeover, not contentTreeSatisfiedByPVCs mishandling replicated volumes.
  • Why the test fails. Its lookup (pvcredownload_test.go:361-367, ContentSha256 == sha && IsLocal) returns the first match, here vm2's tree. The comment above it still assumes edge-dev1 keeps vm2's tree non-local.
  • Not specific to this PR. The test fails at the same line in 5 of the last 10 master nightlies (state LOADED: vm1's blobs are already in CAS, so the PVC-accept path never runs) and passed in 4 of 4 17.0-stable nightlies. Why this run differs from those 17.0-stable runs is not established. One difference is timing: vm1 came online 14.1 min after the cluster reformed, past the 10 min takeover threshold, against 9.4-9.8 min in the 17.0-stable runs.

@milan-zededa

milan-zededa commented Nov 21, 2026 •

Copy link
Copy Markdown
Contributor

I cancelled the re-run of the evetest workflow (run 44593997184, attempt 2): its TestPortScanSuite, TestAppsSuite and TestUpgradeSuite jobs had hung for over 4 hours, holding three runners and broker sessions without creating any device.

Each of them deadlocked right after skipping its first subtest listed in EVETEST_SKIP:

=== RUN   TestPortScanSuite/TestExternalPortScanKVM
    harness.go:592: Skipping "TestExternalPortScanKVM": listed in EVETEST_SKIP
--- SKIP: TestPortScanSuite/TestExternalPortScanKVM (0.00s)

That is a bug in the evetest harness, fixed in 17.0-stable by c6776e7 ("evetest: fix deadlock when a suite subtest is skipped by EVETEST_SKIP", #7180). This PR's branch predates the fix, and the tests run the evetest code of the PR, so any run of it hangs the same way whenever a suite subtest is skipped. Re-running this old run would hang again.

If you wish to run evetest on this PR again, please rebase it onto the current 17.0-stable first, then comment /evetest.

europaul and others added 5 commits November 23, 2026 21:39
During the single-node to multi-node transition, and on any later leader
election such as a node failover, k3s restarts and the embedded etcd
reforms. A transiently-behind kube-apiserver watch cache can then serve a
reconnecting informer a successful but incomplete watch stream, silently
dropping a window of events with no "410 Gone" to force a re-list. CoreDNS
runs its kubernetes informer with resync disabled (resyncPeriod = 0), so the
lost Service events are never backfilled: Services created in that window
stay permanently NXDOMAIN, which breaks CDI upload and app volume deployment
on the freshly formed cluster.

Serving LIST/WATCH straight from etcd removes the stale-serve path: a
reconnect either resumes cleanly or gets an honest 410 that forces a
re-list. Ship a config.yaml.d drop-in that appends watch-cache=false to
kube-apiserver-arg (the "+" suffix appends rather than replacing the base
args), installed by cluster-init.sh only in edge-node-cluster mode so
single-node keeps the cache. Edge clusters are small, so the cache buys
little; the control-plane cost was benchmarked and found negligible at
realistic load.

Signed-off-by: Paul Gaiduk <paulg@zededa.com>
(cherry picked from commit 27496ff)
Direct deps kube-init's typed client-go and containerd usage
relies on:

  k8s.io/api                    v0.34.1
  k8s.io/apimachinery           v0.34.1
  k8s.io/apiextensions-apiserver v0.34.1
  k8s.io/client-go              v12.0.0+incompatible (aliased to v0.34.1
                                                     via replace)
  github.com/containerd/containerd/v2   v2.2.5
  github.com/containerd/errdefs         v1.0.0

k8s.io/kube-openapi's own go.mod aliases v0.31.0 as its module
version, but the repo never publishes that as a tag — the pseudo
below is what actually exists on the repo and is what our replace
directive points at.

Signed-off-by: Mikhail Malyshev <mike.malyshev@gmail.com>
(cherry picked from commit 66f1559)
The primitives kube-init's FSM writes to persistent storage:

 - Marker: typed filesystem-path values (LonghornInitialized,
   NativeKubernetesMode, MultusInitialized, …). IsMarked / Mark /
   Unmark route through AtomicWriteFile so partial writes never
   leave a half-marker.
 - AtomicWriteFile: temp-file + rename atop the destination, with
   an fsync in between so the on-disk state matches the return
   value even across a crash.
 - Reboot: the daemon's controlled reboot path. Writes a marker
   naming the reason before invoking the reboot binary so the
   next boot can consult the reason without racing the boot
   sequence.
 - K3sKubeconfig / ContainerdSocket / SealedDirName: canonical
   paths every subsystem shares. Constants (not vars) so a
   subsystem cannot accidentally rewrite them at test time.
 - ToK8sName: kubernetes-node-name transform (lowercased device
   UUID). Load-bearing for cross-subsystem consistency — the
   FSM's node-uuid label, monitor's reapply, tiebreaker's
   node-lookup, and Longhorn's node-object all agree on this
   spelling.

The /var/lib snapshot itself lives in its own commit; what is here are
the primitives it is built on.

state also carries the operator wait items: a named point the FSM will
block at until released, used to hold a node mid-transition while it is
inspected.

Signed-off-by: Mikhail Malyshev <mike.malyshev@gmail.com>
(cherry picked from commit f89ab6b)
A node that joins an HA cluster has its /var/lib overwritten with
cluster-mode state: different certs, a different node identity and a
different datastore. Converting it back to a standalone node is
therefore not a reconfiguration but a restore, so each node captures its
pre-cluster /var/lib during its own first boot, while it is still
standalone, and the conversion puts that tree back.

What is captured is node identity, not the whole tree: server/tls,
server/cred, the cluster token and agent/. Everything else under
/var/lib is re-derivable — the unpacked k3s bundle, CNI binaries and k3s
binaries alone account for ~419MB of a ~443MB tree and are reproduced by
the install path. kubelet/ is deliberately excluded: restoring it is
worse than not, since a stale cpu_manager_state breaks kubelet on the
next boot.

The datastore is the one file written continuously, so it cannot be
copied byte-for-byte underneath a live writer. It is captured with
SQLite's VACUUM INTO, which produces a single self-contained,
online-consistent file, so the snapshot is taken with k3s running and
nothing has to be stopped or quiesced to get a usable copy. Note this is
kine/SQLite rather than etcd: server/db/etcd/ is a vestigial stub on a
single-node server, so `k3s etcd-snapshot` does not apply.

Restoring is an overlay copy, which means anything the snapshot does not
contain survives it, and cluster-mode leftovers have to be removed
explicitly:

  server/db/etcd     a real etcd member directory next to a restored kine
                     datastore gives k3s two conflicting datastores, and
                     makes etcdClusterInitialized() report a bootstrapped
                     cluster that no longer exists.
  state.db-wal/-shm  SQLite treats a -wal beside a database as that
                     database's own journal and replays it on open, so a
                     cluster-mode journal feeds pages into the restored
                     file: it grows past its snapshot size,
                     integrity_check reports "invalid page number", and
                     k3s dies with "database disk image is malformed" on
                     every start with no way back. VACUUM INTO never
                     writes these, so removing them is unconditional.
  Longhorn replicas  replicas under /persist/vault/volumes belonging to
                     volumes the restored cluster knows nothing about
                     would otherwise be adopted by a single node that
                     cannot serve them.

Component markers are part of the restored state. The snapshot is taken
before they are written, so a restored tree reads "components installed,
not yet initialised" and the next boot re-runs initialisation against
the datastore it actually has.

Signed-off-by: Mikhail Malyshev <mike.malyshev@gmail.com>
(cherry picked from commit a96859d)
…ntainerd wait

Everything that must be ready before k3s can start. The FSM
sits in INSTALLING → STARTING_CTRD while this package runs; a
failure here aborts the boot rather than starting k3s on a broken
substrate.

 - Kernel modules loaded via modprobe (bridge, iptables_nat,
   iscsi_tcp, etc.). Absent kernel bits surface with the specific
   module name so operators can spot a kernel-config regression.
 - cpu_manager_state cleanup: kubelet sometimes leaves a stale
   cpu_manager_state under /var/lib/kubelet after a reboot with a
   changed --cpu-manager-policy. Deleting it on every boot before
   containerd starts is upstream-blessed cleanup.
 - Cgroup mount: /sys/fs/cgroup, kubepods.slice hierarchy.
 - iSCSI daemon start (needed for Longhorn's block-mode volumes).
 - Vault wait: pillar's vaultmgr signals "ready" via a fs marker;
   the daemon blocks here until the marker is present so k3s does
   not race the vault-mount.
 - EdgeNodeInfo wait: blocks until the pubsub subscription
   delivers the device identity (DeviceName / DeviceID).
 - Containerd start + reachability probe.

Everything is idempotent — the FSM re-enters INSTALLING on
recycle without expecting a clean state.

Signed-off-by: Mikhail Malyshev <mike.malyshev@gmail.com>
(cherry picked from commit c6521d1)
eriknordmark and others added 25 commits November 23, 2026 21:40
Every EVE-k cluster ran k3s's servicelb and Traefik, exposing Traefik on
80/443 of every node address. kube-init writes the local-storage drop-in
with a bare "disable:" key, which replaces the base config's servicelb
and traefik entries instead of adding to them. The "disable+" fix went
into the copy under cfg-manifests, which kube-init never reads, so the
dead copy is removed.

A unit test renders the drop-ins kube-init writes beside the base
config, applies k3s's merge rule, and fails if servicelb or traefik is
no longer disabled, or if a shipped drop-in shadows a rendered one.

Signed-off-by: eriknordmark <erik@zededa.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
(cherry picked from commit 7fddaf2)
…ng labels

reapplyNodeLabels patched and read back the Kubernetes Node using the raw
device name. k3s registers the node under state.ToK8sName(deviceName),
lowercased with underscores turned into dashes, so for any device whose
name has an uppercase letter or an underscore ("Dell-5810-3") the patch
failed every tick:

  warning: reapply node labels+annotation: nodes "Dell-5810-3" not found

This is the re-stamp path for the node-uuid label and the Longhorn
default-disk label and annotation. The single→cluster transition clears
NodeLabelsInitialized precisely so this runs again, because a node that
installed Longhorn in an earlier single-node life keeps its
LonghornInitialized marker and never re-runs the install-time stamping.
With the re-stamp failing, a node added to an existing cluster never gets
node.longhorn.io/create-default-disk, Longhorn creates no default disk
for it, and any app volume scheduled there stays pending, leaving the app
stuck in LOADING.

Use state.ToK8sName(m.deviceName) for the patch, the read-back and the
log lines, as every other node lookup in kube-init already does. The
shell cluster-init.sh labelled "$HOSTNAME" and did not have this problem;
it came in with the Go rewrite.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: vignesh-zededa <vignesh@zededa.com>
(cherry picked from commit 5e153e0)
Bumps [github.com/moby/sys/user](https://github.com/moby/sys) from 0.4.0 to 0.4.1.
- [Release notes](https://github.com/moby/sys/releases)
- [Commits](moby/sys@user/v0.4.0...user/v0.4.1)

---
updated-dependencies:
- dependency-name: github.com/moby/sys/user
  dependency-version: 0.4.1
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
(cherry picked from commit a4cbd44)
kube-init lifts EVE's CPU confinement while a first boot deploys k3s
and its components, and restores it once the node is running. It widens
/eve, /eve/services and every service leaf, but not /eve/containerd.

containerd now has a cpuset of its own (ctrd_max_vcpus, one CPU by
default), and the user containerd is the CRI runtime k3s uses: it pulls
and unpacks every image the first boot deploys. Widen and restore its
cgroup with the services, when 010-eve-cgroup created one.

Signed-off-by: Mikhail Malyshev <mike.malyshev@gmail.com>
(cherry picked from commit d0f8eb9)
CDI importers only added the cluster-wide trustedCAProxy bundle to their
trust pool when the DataVolume also had a certConfigMap (fixed upstream in
lf-edge#4109, first released in v1.66.0). Without it, an HTTP DataVolume without a
certConfigMap fails with "proxyconnect tcp: x509: certificate signed by
unknown authority" through mgmtproxy's cni0 listener, even though the CA is
published and mounted at /proxycerts.

v1.66.1 is the latest release. The operator manifest still references the
same seven images already preloaded by kube-init.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Signed-off-by: Milan Lenco <milan@zededa.com>
(cherry picked from commit c5248c8)
CDI was only deployed together with KubeVirt, which is amd64-only. But
pillar creates every EVE-k app volume as a PVC filled through a CDI
upload, including NOHYPER apps that run as plain pods, and holds volume
creation until CDI is ready. On arm64 nodes app instances therefore sat
in LOADING forever, with no error reported.

Track CDI with its own installCDI flag, set unless the node is in
native-kubernetes mode, and give it its own block in the deploy graph.

Nodes that finished first boot without CDI never re-run the deploy
graph, and the component update pass skips components that are not
installed. Add EnsureCDI to the steady-state tick: it installs the
operator, then the CR once the operator is available, one step per
tick, and leaves the node alone while a K3sBase conversion is removing
CDI or after it did. The CDI proxy patch now keys off the CDI CR
existing instead of the KubeVirt marker, so arm64 importers get the
mgmtproxy config too.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Renê de Souza Pinto <rene@renesp.com.br>
(cherry picked from commit 6a33fb4)
…igration

On the bootstrap node the single→cluster transition restarts k3s with
--cluster-init, which migrates the sqlite datastore into a new embedded
etcd. The new etcd numbers its revisions from the keys it copied, well
below the last kine resourceVersion (observed: 5168 before, 2313 after).
The pods keep running across the k3s restart, since they live in the user
containerd, so every reflector resumes its watch from a resourceVersion
that is now in the future and silently drops events until etcd counts
past it.

Longhorn is where this shows. A Volume CR created after the transition
never reaches longhorn-manager's cache: its post-create existence check
times out with "not found", every CSI CreateVolume retry after that gets
"already exists", and the app volume's PVC upload fails. pillar reports
it as "PVC Upload ... attempts to upload image failed, engine not
deployed on node", because the volume never got an engine. Every app
deployed within minutes of forming an ENC cluster on a single node was
exposed; how many failed depended on how far the old resourceVersion ran
ahead.

Arm a marker when the bootstrap config is provisioned, and have the
health worker delete the controller pods on this node once the API is
back: Deployment-owned pods in kube-system, longhorn-system, cdi and
kubevirt, plus the longhorn-manager and virt-handler DaemonSet pods.
Their replacements list from the new etcd. Data-path pods
(instance-manager, engine-image, csi-plugin), node plumbing (multus,
kube-vip) and the app namespace are left alone, so running volumes and
VMs are not interrupted. Joining nodes skip this: their old pods do not
exist in the cluster they join, and the kubelet removes them.

Only pods created before the marker's mtime are selected. The marker is
armed after k3s stops for the transition, so a newer pod already listed
from the new etcd, and a retry after a failed delete or an unreachable
API never recycles the fresh replacements again. The pass also checks
spec.nodeName itself, not just through the field selector. The marker
is cleared once every stale pod is gone, and stays armed while the API
is unreachable.

The pass reaches the API through a two-method interface (list this
node's pods, delete a pod), so its tests use a small in-memory fake rather
than the client-go fake clientset and everything it would vendor: only
this node's pre-migration controller pods go, data-path and newer pods
stay, a failed delete keeps the marker armed, and the cutoff is the
marker's mtime rather than the time of the pass.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: vignesh-zededa <vignesh@zededa.com>
(cherry picked from commit c8414b0)
…ycled

Between k3s returning from a single→cluster transition and kube-init's
first health tick recycling the controller pods, the Longhorn, CDI and
KubeVirt Deployments are all Running and Available, still watching the
pre-migration datastore. An app volume created in that window hits their
stale caches, or is cut by the recycle a few seconds later.

- kube-init mirrors its controller-restart marker as
  /run/kube/controller-restart-pending, on the /run bind shared with
  pillar; /var/lib is not visible to pillar, and is a ZFS zvol on some
  devices. It is set together with the marker, re-created each tick
  while the marker is armed (/run is tmpfs), and removed when the
  recycle is done.
- kubeapi exports ControllerRestartPending (a stub on non-EVE-k builds),
  and ClusterStorageReadyForVolumes reports not-ready while it is set.
- volumemgr's clusterStorageReady checks it ahead of its cached answer,
  which otherwise latches true for good. pillar is not restarted by the
  transition, so a node that served volumes in single-node mode would
  never re-probe. While the marker is set it returns not-ready and drops
  the cache. The marker goes as soon as the deletes succeed, before the
  replacement pods are up, so the next probe must wait for the CDI
  Deployments to be available again.

The marker path is spelled out in both modules, which cannot share a
constant. It is documented once, under "Markers shared with pillar" in
the kube-init README, and pinned in a test on each side.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: vignesh-zededa <vignesh@zededa.com>
(cherry picked from commit a407274)
longhornNodeCreate only set metadata.name, leaving spec.name empty.
Longhorn's own node controller reads node.Spec.Name (not metadata.name)
in shouldEvictReplica, so every reconcile hit "no node name provided to
check node down or deleted" and errored out before persisting the
node's computed disk status -- leaving status.diskStatus permanently
null and blocking auto-salvage forever. Set spec.name to match
metadata.name, as Longhorn's own CreateDefaultNode does.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Signed-off-by: Milan Lenco <milan@zededa.com>
(cherry picked from commit 07070ee)
kubeclient set no rest.Config.Timeout, because that timeout also cuts
open watch streams. Without it, an API call whose context has no
deadline waits forever on an apiserver that accepts the connection and
never answers.

Give the request clients a 90s Timeout. This is longer than the
apiserver's own 60s request timeout, so it only stops a call that gets
no answer. Add watch clients without the timeout. Use them for the
informer factories, the Longhorn wait informers and the kubectlx waits.
The discovery client keeps the 32s default that client-go applies when
the config has no Timeout.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Andrew Durbin <andrewd@zededa.com>
(cherry picked from commit a32ead2)
podExec runs from the monitor tick, whose context has no deadline.
kubeclient's requestTimeout does not cover exec, so a stuck exec can
stop the health checks.

Give each podExec a 60s deadline. The SPDY executor ignores the context
while it waits for the upgrade response, so try the WebSocket executor
first. It applies the deadline to the handshake too. SPDY stays as the
fallback for an apiserver that refuses the WebSocket upgrade.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Andrew Durbin <andrewd@zededa.com>
(cherry picked from commit ed0b52e)
On a single-node EVE-k device, k3s stores its state in sqlite through
kine. kine keeps lease expiry timers in memory and, at every k3s
start, sets each key's expiry to the start time plus its lease. With
event-ttl at 72h, a device that reboots more often than every three
days never expires an event. On sc-sm-e300-10, which reboots several
times a day, 26 days of events accumulated: 295600 of 298249 rows and
236 MiB of the 644 MB datastore. kine lists scan the whole name index,
so every list and every compaction gets slower as the table grows, and
listing the events no longer finishes within two minutes.

A 1h TTL is shorter than a typical uptime, so events expire within an
hour of each k3s start, including those carried over from before a
reboot.

Signed-off-by: eriknordmark <erik@zededa.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01VyjigXVFZhuUg5LiRSVwsj
(cherry picked from commit 01073b8)
Lowering event-ttl only affects events written afterwards: kine stores
each event's lease in its row and re-arms expiry from that lease at
every k3s start. On a device that reboots more often than every three
days, events written under the former 72h TTL therefore never expire,
and an upgraded device keeps its whole backlog.

Before starting k3s, kube-init now deletes the events that carry the
72h lease and vacuums the datastore if any were removed. Events from a
user override with a different TTL are left alone. On sc-sm-e300-10 the
same deletion, done by hand, removed 297835 events in 42 s and shrank
the datastore from 644 MB to 81 MB.

Signed-off-by: eriknordmark <erik@zededa.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01VyjigXVFZhuUg5LiRSVwsj
(cherry picked from commit 6babf29)
17.0-stable added two shell-era helpers that master never had, because
master already ran kube-init when the matching fixes landed:

- cluster-status-probe, the client half of the authenticated cluster
  status server (lf-edge#6753). kube-init's k3s/statusauth.go derives the same
  credentials in-process.
- cni-state-utils.sh, which clears the retired pod subnet when a node
  joins a cluster (lf-edge#6727), with its host-side test and the
  `make -C pkg/kube test` target that ran it. kube-init's clustermode
  does the same cleanup.

Nothing in the kube container runs either one any more; remove them,
the Dockerfile stage that built the probe, and the Makefile and README
references.

Signed-off-by: Mikhail Malyshev <mike.malyshev@gmail.com>
Three earlier 17.0 backports carried master commits whose pillar half
names kube-init as the other side of a contract, and reworded those
comments to name cluster-init.sh or cluster-status-probe, which ran on
this branch then:

- lf-edge#6584 (master 5327945): mgmtproxy's cni0 token and TLS cert, read
  by kube-init's mgmtproxy.PatchCDIProxyConfig.
- lf-edge#6753 (master 042622f): the cluster status server credentials,
  derived again in kube-init's k3s/statusauth.go.
- lf-edge#6917 (master a407274): the controller-restart marker, written by
  kube-init's clustermode.ControllerRestartPending.

kube-init now owns all three, so restore master's wording. Comments,
docs and one test failure message only; no code change.

Signed-off-by: Mikhail Malyshev <mike.malyshev@gmail.com>
kube-init's go.mod says go 1.25.12, the toolchain master's eve-alpine
ships. 17.0-stable's eve-alpine has Go 1.25.11, so the kube image build
stops with "go.mod requires go >= 1.25.12 (running go 1.25.11;
GOTOOLCHAIN=local)".

Nothing needs 1.25.12: the go directive is the minimum language
version, every other module in the tree declares go 1.25.0 on both
master and 17.0-stable, and no kube-init dependency asks for more than
1.25.0. Declare the same.

Signed-off-by: Mikhail Malyshev <mike.malyshev@gmail.com>
kube-init came over from master with pillar pinned at a master commit,
which is not on 17.0-stable. Pin pillar at the current 17.0-stable head
instead, using go get, go mod tidy and go mod vendor only. kube-init
uses nothing from pillar that 17.0-stable lacks, so no pillar change has
to land first.

go get also moves eve-api, otel, logr and genproto to the versions this
pillar requires. tidy marks golang.org/x/sys as a direct dependency,
since kube-init imports it itself.

Signed-off-by: Mikhail Malyshev <mike.malyshev@gmail.com>
The instance-manager gate is satisfied as soon as its CR reports
Running, often seconds after the pod starts -- before Longhorn's disk
monitor has ever run for that node. For a v1 (filesystem) disk, that
monitor itself requires a running instance-manager, so a fresh one can
pass the existing gate while Status.DiskStatus stays nil indefinitely,
since nothing retriggers the monitor once the window passes.

Observed live: a descheduler-driven VMI move landed a volume on a node
4 seconds after its instance-manager started, and the replica controller
failed forever with "cannot find disk name for replica" -- even though
longhorn-disk.cfg on disk held the correct UUID throughout.

Add a gate requiring every disk in Spec.Disks to have a
Status.DiskStatus entry with a recorded DiskUUID, and at least one of
them to have a True Ready condition, the exact condition that stayed
unmet. Only one ready disk is required so that a recorded but degraded
disk does not strand a node that can still host replicas, matching the
any-disk semantics of checkLonghornSchedulable.

The gate lives in checkLonghornReady, so it applies to all of its
callers, not only the descheduler: ClusterStorageReadyForVolumes (volume
creation), WaitForLonghornReady (the CSI attach wait) and the
components-ready poll. All of them need the node's disks resolved before
replicas can be placed or attached.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Signed-off-by: Milan Lenco <milan@zededa.com>
(cherry picked from commit 638874a)
Signed-off-by: Mikhail Malyshev <mike.malyshev@gmail.com>
The kube linuxkit package now ships a Go daemon in place of the
shell path. Adds a kube-init build rule that DOCKER_GO-invokes
`go build ./cmd/... .` inside pkg/kube/kube-init/, staged into
pkg/kube/dist/ before the linuxkit pkg build. pillar-* targets
are unchanged.

Signed-off-by: Mikhail Malyshev <mike.malyshev@gmail.com>
(cherry picked from commit a7cdcba)
Signed-off-by: Mikhail Malyshev <mike.malyshev@gmail.com>
kube-init's vendor tree is upstream Go modules with well-known
licenses; the SPDX generator's per-file scan blows out on the
tree size without adding value.

Signed-off-by: Mikhail Malyshev <mike.malyshev@gmail.com>
(cherry picked from commit d1b6f47)
Signed-off-by: Mikhail Malyshev <mike.malyshev@gmail.com>
The kube-init daemon is its own Go module, and make test enumerates
its modules explicitly, so none of kube-init's tests have ever been
executed by the target — the package ships a test suite that no CI
path runs. The container build only compiles the binary, and no
workflow names the module either, so the gap is invisible short of
noticing the absence in the log.

Add it alongside the other per-module invocations. The suite needs
./... because kube-init's tests live in its subpackages rather than
at the module root, unlike the newlog and edgeview entries above.
Runs green under -race in about 75 seconds.

Signed-off-by: eriknordmark <erik@zededa.com>
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
(cherry picked from commit 3ef0d4a)
Signed-off-by: Mikhail Malyshev <mike.malyshev@gmail.com>
domainmgr retries WaitForKubernetes forever while the KubeVirt CR is
not Available on single node and replicated storage clusters. KubeVirt
is only installed on amd64, so on arm64 eve-k domainmgr never gets past
startup, never subscribes to DomainConfig, and every app stays in
Booting.

Apps on those arches run as pods, so skip the KubeVirt readiness gate
there.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Renê de Souza Pinto <rene@renesp.com.br>
(cherry picked from commit e700961)
Signed-off-by: Mikhail Malyshev <mike.malyshev@gmail.com>
A NOHYPER app on eve-k runs as a pod whose container image is loaded
locally into containerd (PullNever). The pod does not read the app's
PVC at all.

After a reboot, contentTreeSatisfiedByPVCs sees the app's PVC already
filled and accepts the content tree as REMOTELOADED, so the image is
never downloaded and ingested again. The volume adopts the PVC, the pod
is started and fails forever with ErrImageNeverPull.

Never accept a content tree from PVCs when a native container volume
references it, and don't take the PVC adoption fast path for such a
volume either: it waits for the image like before, and the CSI handler
reuses the existing, fully uploaded PVC.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Renê de Souza Pinto <rene@renesp.com.br>
(cherry picked from commit 1e3232b)
Signed-off-by: Mikhail Malyshev <mike.malyshev@gmail.com>
When a node goes down, the virt-launcher pods of its VM apps stay in
Terminating and KubeVirt often does not create a replacement. After two
minutes checkAppsFailover() then scales the VMIRS to 0 and back to 1 to
get one scheduled, but only on the node for which isDecisionNode() is
true, which followed the eve-kube-stats-leader lease.

That lease runs with a 300s duration. If the node that died was the
stats leader, no survivor can acquire it for up to five minutes, and no
node is allowed to do the reset in the meantime. This was hit on a
3-node cluster where the powered-off node had been the stats leader for
two days: the pods went Terminating at 08:47:57 and the reset was due
from about 08:50:50, but dell-5810-2 only took the lease at 08:52:17,
reset the VMIRS at 08:53:04, and the replacement pod was created at
08:53:17, almost six minutes after the node was lost.

The eve-app-op election was added for exactly this: deciding the one
node allowed to act for an app whose node is down, with a 60s lease so
the handover never dominates the outage, and with the tie-breaker
excluded. Make isDecisionNode() follow it. The stats lease remains in
use for the stats collector, the node-prune sweep and the other
existing readers, none of which need a fast handover.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Renê de Souza Pinto <rene@renesp.com.br>
(cherry picked from commit 902a643)
checkAppsFailover() enters its "failover start" branch for every app
scheduled on this node that is not yet running, whether or not an old
copy of its pod is Terminating anywhere. For an app that is just
booting (pod in Init, for example) it then calls DetachOldWorkload()
with an empty node and app domain name, which returns at once with
"a node name is required", and logs "failover start/complete for
appDomainName: " with an empty name every 10 seconds. It also keeps
checkStuckPendingVMI() suppressed for that app although no failover is
landing on this node.

These spurious lines showed up on the failover node while debugging a
slow failover, and made the real failover activity harder to find.
Require a terminating pod before taking this branch.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Renê de Souza Pinto <rene@renesp.com.br>
(cherry picked from commit 007a6ed)
@rucoder
rucoder force-pushed the rucoder/17.0-kube-init branch from ee47d97 to 4604861 Compare November 23, 2026 21:57
@github-actions

Copy link
Copy Markdown
Contributor

Evetest: Claude chose to skip 19 test/suite name(s) as unrelated to or redundant for this PR. Which ones and why: run summary.

Comment /evetest all to run the full suite, or /evetest <name> <name> ... to run only specific tests/suites.

@github-actions

Copy link
Copy Markdown
Contributor

TestUpgradeSuite: failures likely caused by this PR

TestEVEUpgradeKubevirtToKubevirt

Failure

Timed out after 1200.000s.
Expected to satisfy: K3s node is ready
nodes:{name:"edge-dev"  conditions:{type:KUBE_NODE_CONDITION_TYPE_READY  set:true  last_transition_time:{seconds:1795475634}}  role_server:true  creation_timestamp:{seconds:1795475633}  api_server_sersion:"v1.34.2+k3s1"  internal_ip:"172.20.20.123"  schedulable:true  admission_status:NODE_ADMISSION_JOINING  node_id:"8cd382dd-cd71-45d1-b0d1-1531b8d7d7f9"}  storage:{health:SERVICE_STATUS_FAILED  transition_time:{seconds:-62135596800}}  cluster_id:"00000000-0000-0000-0000-000000000000"
Claude's conclusion
Root cause

Live inspection of the paused device confirms k3s itself came up fine (nodes: Ready=true at 172.20.20.123) but storage: SERVICE_STATUS_FAILED — because the Longhorn stack simply hadn't started yet. evetest eve kubectl get events -A shows components installing in a clearly serialized, staggered sequence: CDI operator pods begin pulling images ~9-10 minutes after boot, KubeVirt operator pods at roughly the same time, but longhorn-manager/longhorn-driver-deployer/longhorn-ui pods were only created at 2m46s before investigation — i.e. around the 19th minute of a 20-minute (1200s) boot budget — leaving no time for Longhorn's own image pulls/CRD convergence before the test's Eventually timed out. vmstat/uptime on the device show load average 6.56 and heavy iowait, consistent with the well-documented class of "kubevirt+CDI+longhorn first-boot bring-up overwhelms a 4vCPU/8GB test VM" failures that recur throughout the ledger (e.g. TestVaultZvolTrimReclaimsBlocks on 2026-11-17/18/19/22, TestThreeNodesUpgrade). However, TestEVEUpgradeKubevirtToKubevirt itself has never failed this way before — its prior ledger entries (2026-11-19, 2026-11-22) failed later, during the post-upgrade reboot with a virt-api webhook-unreachable/HALTING signature, not during the initial pre-upgrade cluster bring-up. So this is a new failure signature for this test, sharing the same general resource-contention root-cause class as other nightly failures, but not an exact repeat of a previously logged occurrence of this test.

The PR diff is a wholesale rewrite of pkg/kube/kube-init: it deletes the old shell-script component installers (kubevirt-utils.sh, longhorn-utils.sh, cluster-utils.sh, etc.) and replaces them with a brand-new Go dependency-graph deploy engine (components/components.go, deploy/deploy.go, deploy/rules.go). That engine caps concurrent component Apply work via applyConcurrency() (max(2, KubeCPUCount())) and has kubevirt, cdi-operator/cdi, and longhorn all declared with the same Requires: MultusCNIReady dependency (so they're meant to install in parallel), yet the live timeline shows Longhorn's Apply step only starting after CDI and KubeVirt were already deep into their own image pulls — exactly the kind of serialization a concurrency-limited Apply queue would produce on a 4-vCPU box when the earlier components' Apply calls take minutes. This is a plausible, concrete mechanism by which this rewrite could have slowed/serialized Longhorn's start relative to whatever the previous shell-based kubectl apply -f (which had no such concurrency gate) did.

Given the PR squarely rewrites the exact component-installation ordering/timing logic responsible for the observed symptom, but I can't fully rule out this being an instance of the same underlying environmental resource-starvation issue that predates the PR, I judge this as plausibly PR-caused rather than clearly so.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

9 participants