Skip to content

feat: Implement CNI plugin robustness improvements - #38

Merged
bpalermo merged 5 commits into
mainfrom
feat/cni-robustness
Mar 22, 2026
Merged

bpalermo merged 5 commits into
mainfrom
feat/cni-robustness

Conversation

@bpalermo

Copy link
Copy Markdown
Owner

Summary

  • Implement CmdCheck: validates network namespace exists, interface is present, pod is registered with agent
  • Implement CmdStatus: checks agent gRPC endpoint reachability
  • Add gRPC call timeouts (30s for Add/Del, 10s for Check/Status)
  • Add retry with exponential backoff for transient gRPC errors on AddPod (3 retries, 100ms/200ms/400ms)
  • RemovePod intentionally does not retry to avoid issues

Files Changed

  • cni/internal/plugin/plugin.go — CmdCheck and CmdStatus implementations
  • cni/internal/plugin/client.go — Timeouts, retry logic, new helper methods
  • cni/internal/plugin/plugin_test.go — Tests for netns/interface verification
  • cni/internal/plugin/client_test.go — Tests for retry, timeout, connectivity

Test plan

  • bazel test --config=llm //cni/internal/plugin:plugin_test passes
  • Full suite passes (18/18 non-integration tests)

🤖 Generated with Claude Code

@bpalermo
bpalermo force-pushed the feat/cni-robustness branch from be136ad to 3496c1a Compare March 22, 2026 13:47
- Implement CmdCheck: validates network namespace existence, verifies
  expected interface via /proc/<pid>/net/dev, and confirms pod
  registration with the agent via gRPC call
- Implement CmdStatus: parses config, creates agent client, and
  verifies gRPC endpoint reachability via connection state check
- Add context timeouts to all gRPC calls (30s for Add/Del, 10s for
  Check operations) to prevent indefinite hangs
- Add retry with exponential backoff for transient gRPC errors
  (Unavailable, DeadlineExceeded) on AddPod only, max 3 retries
- Del operations are intentionally not retried to avoid duplicate
  deletion issues
- Add comprehensive unit tests for all new functionality including
  retry logic, timeout behavior, transient error detection, netns
  verification, and interface checks

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
@bpalermo
bpalermo force-pushed the feat/cni-robustness branch from 3496c1a to f04cd00 Compare March 22, 2026 13:54
bpalermo and others added 4 commits March 22, 2026 10:57
Set addTimeout and delTimeout to 5s and checkTimeout to 1s for faster
failure detection. Remove gazelle:ignore directive from BUILD.bazel —
gazelle now manages the file correctly.

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
Move retry-with-backoff and gRPC transient error classification from the
CNI plugin client into a reusable common/retry package. The package
provides retry.Do with configurable max attempts, exponential backoff,
and pluggable IsRetryable predicate. retry.GRPCTransient classifies
Unavailable and DeadlineExceeded as retryable.

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
Replace `defer client.Close() //nolint:errcheck` with proper error
handling that logs close failures via the plugin's zap logger.

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
Worktrees caused gazelle to see duplicate packages and drop internal
deps. Now that worktrees are removed, gazelle resolves deps correctly
and the keep directives are no longer needed.

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
@bpalermo
bpalermo merged commit 030deae into main Mar 22, 2026
7 checks passed
@bpalermo
bpalermo deleted the feat/cni-robustness branch March 22, 2026 14:12
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.

1 participant