feat(metis): fallback CNI to direct local IPAM when daemon is unavailable - #1283
feat(metis): fallback CNI to direct local IPAM when daemon is unavailable#1283arvindbr8 wants to merge 7 commits into
Conversation
|
This issue is currently awaiting triage. If the repository mantainers determine this is a relevant issue, they will accept it by applying the The DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
|
/assign @YifeiZhuang |
|
Hi @arvindbr8. Thanks for your PR. I'm waiting for a kubernetes member to verify that this patch is reasonable to test. If it is, they should reply with Tip We noticed you've done this a few times! Consider joining the org to skip this step and gain Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
… fallback default
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: arvindbr8 The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
… race integration test
… startup lifecycle
|
/ok-to-test |
Summary
This PR implements socket connection retry logic and direct local IPAM fallback in the Metis CNI plugin when the background daemon process is unavailable or starting up.
os.Stat) prior to gRPC client initialization ingetGrpcClientto prevent lazy gRPC connection false-positives.prepare()to gracefully handle transient daemon restarts or startup timing.dbPath(/var/lib/cni/metis/metis.sqlite) and instantiatingIPAMEnginein-process viadirectClientAdapter.Operational & Safety Details
_busy_timeout=5000ms, and_txlock=immediateensure transaction isolation and lock safety when CNI and Daemon concurrently access SQLite.IPAMEnginecleanly returnsstore.ErrNoAvailableIPs(since no daemon/monitor is present to trigger dynamic scale-up).Test Plan
go test ./...inmetis/(ok k8s.io/metis/pkg/cni,ok k8s.io/metis/pkg/daemon,ok k8s.io/metis/pkg/store).metis/test/daemon_cni_race_test.gocovering deterministic startup sequences:TestCNI_SequenceA_CNIBeforeDaemon: CNI runs before daemon exists -> direct fallback -> daemon starts -> daemon handles subsequent requests cleanly.TestCNI_SequenceB_SocketAppearsDuringRetry: Daemon socket creation delayed by 150ms -> CNI retries socket -> connects via gRPC on attempt 2.TestCNI_SequenceC_DaemonAlreadyRunning: CNI connects immediately to running daemon.make verify-up-to-datepassed with 0 dirty changes.