Skip to content

add host_stack_cidrs support in datapathv2#879

Merged
BSWANG merged 3 commits intoAliyunContainerService:mainfrom
l1b0k:feat/enhance_dataplan
Sep 5, 2025
Merged

add host_stack_cidrs support in datapathv2#879
BSWANG merged 3 commits intoAliyunContainerService:mainfrom
l1b0k:feat/enhance_dataplan

Conversation

@l1b0k
Copy link
Collaborator

@l1b0k l1b0k commented Sep 5, 2025

No description provided.

- Remove hardcoded LOCAL_DNS_IP in bpf_lxc.c
- Add TerwayHostStackCIDR option in daemon_main.go
- Update hostips-sync.go to use configurable CIDR
- Add HostStackCIDRs to option/config.go

Signed-off-by: l1b0k <libokang.lbk@alibaba-inc.com>
@l1b0k l1b0k requested a review from BSWANG September 5, 2025 02:34
@l1b0k l1b0k force-pushed the feat/enhance_dataplan branch 2 times, most recently from 6913891 to 24b925a Compare September 5, 2025 02:57
@codecov
Copy link

codecov bot commented Sep 5, 2025

Codecov Report

❌ Patch coverage is 70.00000% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 46.80%. Comparing base (d0d421e) to head (7f4b3db).
⚠️ Report is 4 commits behind head on main.

Files with missing lines Patch % Lines
cmd/terway-cli/policy.go 70.00% 2 Missing and 1 partial ⚠️

❌ Your project status has failed because you have indirect coverage changes. Learn more about Unexpected Coverage Changes and reasons for indirect coverage changes.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #879      +/-   ##
==========================================
- Coverage   46.84%   46.80%   -0.04%     
==========================================
  Files         132      132              
  Lines       19513    19523      +10     
==========================================
- Hits         9140     9137       -3     
- Misses       9441     9451      +10     
- Partials      932      935       +3     
Flag Coverage Δ
unittests 46.80% <70.00%> (-0.04%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 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.

- Introduce HostStackCIDRs configuration option in PolicyConfig
- Validate and parse host stack CIDRs
- Append host stack CIDRs to ciliumArgs

Signed-off-by: l1b0k <libokang.lbk@alibaba-inc.com>
- Update image tag from policy-ce3481dc to policy-381dd606

Signed-off-by: l1b0k <libokang.lbk@alibaba-inc.com>
@l1b0k l1b0k force-pushed the feat/enhance_dataplan branch from 24b925a to 7f4b3db Compare September 5, 2025 03:28
@BSWANG BSWANG requested a review from Copilot September 5, 2025 07:11
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR implements support for multiple host stack CIDRs in Cilium's datapathv2 mode for the Terway CNI plugin. The implementation adds a new BPF map to handle multiple host stack CIDR ranges instead of relying on a single hardcoded IP address.

  • Add new BPF map terway_host_stack_cidr with LPM trie structure for efficient CIDR lookups
  • Implement host stack CIDR management functions in Go including map initialization and CIDR entry management
  • Update configuration handling to support multiple host stack CIDRs via command line arguments and CNI configuration

Reviewed Changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
tests/kind/conf/*.cmdline Add --terway-host-stack-cidr=169.254.20.10/32 parameter to test configuration files
policy/cilium/0014-feat-datapath-add-multi-host-stack-support-for-veth-.patch Contains the main implementation patch with BPF map definition, daemon initialization logic, and configuration parsing
deploy/images/*/Dockerfile Update Terway policy image reference to newer version with host stack CIDR support
cmd/terway-cli/policy.go Add support for parsing host_stack_cidrs from CNI configuration and generating appropriate cilium arguments
cmd/terway-cli/policy_test.go Add test cases for host stack CIDR configuration scenarios

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@BSWANG BSWANG merged commit 559f4db into AliyunContainerService:main Sep 5, 2025
8 of 9 checks passed
@l1b0k l1b0k deleted the feat/enhance_dataplan branch September 5, 2025 08:58
cursor bot pushed a commit that referenced this pull request Sep 7, 2025
add host_stack_cidrs support in datapathv2
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.

3 participants