Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add validation for IPAM IPPools annotation usage #2902

Merged
merged 1 commit into from
Dec 15, 2023

Conversation

Icarus9913
Copy link
Collaborator

@Icarus9913 Icarus9913 commented Dec 14, 2023

  1. Once multiple NICs use spiderpool as IPAM, if you use annotaion ipam.spidernet.io/ippools, you have to specify the same correct IPPool slice for multiple NICs. Add strong validation in this PR.
    For instance, if you have 2 NICs and use ipam.spidernet.io/ippools to specify the IPPools, you need to specify each NIC corresponding IPPools
// Bad
ipam.spidernet.io/ippools: '[{"interface": "net1","ipv4": ["ens6-v4"],"ipv6":["ens6-v6"]}]'
---
// Good
ipam.spidernet.io/ippools: '[{"interface": "eth0","ipv4": ["ens5-v4"],"ipv6":["ens5-v6"]},{"interface": "net1","ipv4": ["ens6-v4"],"ipv6":["ens6-v6"]}]'
  1. Add validation for same NICs name in ipam.spidernet.io/ippools.
// Bad
ipam.spidernet.io/ippools: '[{"interface": "eth0","ipv4": ["ens5-v4"],"ipv6":["ens5-v6"]},{"interface": "eth0","ipv4": ["ens6-v4"],"ipv6":["ens6-v6"]}]'
  1. Add validation for spiderpool IPAM binary with NIC address.

Signed-off-by: Icarus9913 [email protected]

What this PR does / why we need it:
fix bug

Which issue(s) this PR fixes:
close #2901 #2903

@Icarus9913 Icarus9913 added pr/ready-review This pull is ready for review release/bug cherrypick-release-v0.8 Cherry-pick the PR to branch release-v0.8. labels Dec 14, 2023
Copy link

codecov bot commented Dec 14, 2023

Codecov Report

Merging #2902 (8ced784) into main (cbd4be9) will increase coverage by 0.01%.
Report is 5 commits behind head on main.
The diff coverage is 0.00%.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #2902      +/-   ##
==========================================
+ Coverage   81.09%   81.10%   +0.01%     
==========================================
  Files          49       49              
  Lines        5333     5336       +3     
==========================================
+ Hits         4325     4328       +3     
  Misses        852      852              
  Partials      156      156              
Flag Coverage Δ
unittests 81.10% <0.00%> (+0.01%) ⬆️

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

Files Coverage Δ
cmd/spiderpool/cmd/command_add.go 78.26% <0.00%> (-1.74%) ⬇️

... and 1 file with indirect coverage changes

@Icarus9913 Icarus9913 merged commit 3e3aede into spidernet-io:main Dec 15, 2023
40 of 41 checks passed
@Icarus9913 Icarus9913 deleted the fix/wk/ippools branch December 26, 2023 08:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cherrypick-release-v0.8 Cherry-pick the PR to branch release-v0.8. cherrypick-release-v0.9 pr/ready-review This pull is ready for review release/bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Pod cannot run if multiple underlying NICs are specified through IPPools.
3 participants