fix: Volcengine adopt uses the ENI secondary IPs; daemon survives a detached ENI - #15
Merged
Conversation
…ched NICs adopt derived the pool from the subnet on every platform, but a VPC routes only the assigned ENI secondary IPs to a Volcengine node, so an adopted node leased unroutable addresses, ENI primaries included. The pool now comes from the one ENI read Status already performs; init and the docs already said the ENI secondaries are the pool. setupSecondaryNICs is the first step of node.Setup and fails hard on a missing link, so one out-of-band ENI detach put the daemon into a systemd restart loop with no DHCP. adopt already filters with PresentLinks; the daemon does the same.
… fallback pendingOffers.add could never report a displaced IP: offerIP resolves the MAC's live offer first and drops an expired one, so the map entry is absent or already equal. restore(l) was restoreAll with one element. cmd/adopt resolves the primary NIC before calling Adopt, so the cmp.Or fallback never ran.
Every sibling surfaces REVISION and BUILTAT; cocoon-net injected them at build time and dropped them. Package docs shrink to one line, the subprocess WHY moves to the one call site each, test files carry no comments, docs/gke.md states that adopt fails where init only warns.
…t; the daemon stays fail-fast on a missing link Status lists every ENI on the instance, so the pool now keeps only the secondary IPs inside --subnet, minus the gateway, deduplicated, and fails when none remain. The daemon keeps refusing to start over a missing secondary link: the flat pool cannot drop the detached ENI's addresses, so continuing would lease unroutable IPs.
…sent link per pool ENI HostPrefix carries the gateway/broadcast validation SubnetIPs performed, so the Volcengine path rejects a malformed or out-of-subnet --gateway before any discovery. PoolStatus reports secondary IPs per ENI; adopt counts the ENIs that contribute pool addresses and refuses to persist a pool whose ENIs outnumber the present secondary links, instead of silently keeping a detached ENI's addresses.
Counting links against ENIs cannot tell an ENI whose link is missing from an unrelated ENI whose link is present; the Volcengine status now carries each ENI's MAC and adopt refuses when a pool ENI has no link with that address.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Whole-repo quality round (2026-09-03): every Go file read against the /code Style Self-Check and the judgment lenses; three commits.
adoptderived the DHCP pool from the subnet on every platform, but a Volcengine VPC routes only the ENI-assigned secondary IPs to the node (docs/volcengine.md: "secondary private IPs are assigned to each ENI — these become the DHCP pool"), so an adopted node leased unroutable addresses, ENI primaries included.adoptnow seeds the pool from the one ENI readStatusalready performs (nothing is created or changed; README/architecture/volcengine/configuration/dhcp docs updated). The pool keeps only the ENI secondary IPs inside--subnet(minus the gateway, deduplicated) and fails when none remain. The daemon still refuses to start over a missing secondary link: the flat pool cannot drop a detached ENI's addresses, so continuing would lease unroutable IPs (held; a safe degrade needs the state file to record ENI membership).pendingOffers.addcould never report a displaced IP (the caller resolves the MAC's live offer first and drops an expired one);restore(l)wasrestoreAllwith one element; the GKEAdoptNIC fallback never ran (cmd/adopt resolves it first).--versioncarries rev and build time like every sibling (the Makefile and goreleaser already injected them); package docs shrink to one line with the subprocess WHY at the call sites; test files carry no comments; docs/gke.md states that adopt fails where init only warns.Held with measurement:
lease.save()underlifecycleMuper DHCP ACK is ~0.2–0.3 ms (three syscalls; 43 ms serialized across a 140-IP boot storm) and the persist-before-ACK / persist-before-free ordering is test-pinned, so no change.activeCountmaterializing leases per Prometheus scrape (~11 KB every scrape) stays.Gates:
GOWORK=off make lint0 issues on linux and darwin;make fmt-checkclean;asl ./...clean on both GOOS;GOWORK=off go test -race -count=1 ./...green. Round diff: 21 files, +45/−65; comment lines +3/−30.