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

DualStack Proposal #237

Merged
merged 4 commits into from
Aug 18, 2022

Conversation

Ayush21298
Copy link
Member

@Ayush21298 Ayush21298 commented Jun 8, 2022

Proposal

Brief Design Proposal for IPv4/IPv6 DualStack support.

Checklist

  • Feature introduction
  • Development Goals
  • Design idea
  • Impact on modules
  • Alternative Design

I wasn't sure about the proposal format being used for the project, so if anything is missing please add it in the checklist :)

Related Issue

Dual Stack Support

Signed-off-by: Ayush Patel <patel.ayush08@gmail.com>
@Ayush21298 Ayush21298 requested a review from dougbtv as a code owner June 8, 2022 14:47
"mode": "bridge",
"ipam": {
"type": "whereabouts",
- "range": "192.168.2.225/28",
Copy link
Member

Choose a reason for hiding this comment

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

I think we both want to keep this for backwards compatibility.

Copy link
Member

Choose a reason for hiding this comment

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

Ooops, I see this is one example, I see that other keeps this.

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes :)

Type string `json:"type"`
Routes []*cnitypes.Route `json:"routes"`
Datastore string `json:"datastore"`
+ IPs []IPConfig `json:"ips"`
Copy link
Member

Choose a reason for hiding this comment

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

Name ideas:

  • IPRanges
  • IPConfigs
  • IPAliases
  • IPCIDRs
  • CIDRs

Copy link
Collaborator

Choose a reason for hiding this comment

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

I would go for IPRanges . And name the attribute type RangeConfiguration or range config.

Copy link
Member

Choose a reason for hiding this comment

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

RangeConfiguration ++

@maiqueb maiqueb self-requested a review June 9, 2022 14:11
@maiqueb maiqueb added this to Review in Dual stack Jun 13, 2022
Copy link
Collaborator

@maiqueb maiqueb left a comment

Choose a reason for hiding this comment

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

Thanks for this proposal.

I'd like to actually congratulate you on the focus on the changes from the current API, and how easy you made it for us to understand them. Kudos.

I am OK with pretty much everything you wrote, but still pointed a couple of nits.

doc/proposals/dualstack.md Show resolved Hide resolved

<hr>

## Introduction <a name="introduction"></a>
Copy link
Collaborator

Choose a reason for hiding this comment

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

Isn't this <a name="introduction"></a> redundant in markdown ? AFAIU, there's an implicit anchor after the lowercase, dash separated, name of the heading. In this case - introduction.

This is a design proposal document for introducing IPv4/IPv6 DualStack support in whereabouts.


### Goal <a name="goal"></a>
Copy link
Collaborator

Choose a reason for hiding this comment

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

same; goal can be used directly without specifying the anchor name.


<hr>

## Design <a name="design"></a>
Copy link
Collaborator

Choose a reason for hiding this comment

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

ditto


Basically, rather than having IP related configurations directly as key members of `IPAMConfig` object, they be included as element of an object type, let's say `IPConfig` and `IPAMConfig` should have an array of `IPConfig` as it's element.

### Changes in IPAM Config <a name="configChanges"></a>
Copy link
Collaborator

Choose a reason for hiding this comment

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

here it makes sense - assuming you don't want to use the implicit changes-in-ipam-config anchor name.

"mode": "bridge",
"ipam": {
"type": "whereabouts",
"ips": [
Copy link
Collaborator

Choose a reason for hiding this comment

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

ditto. I would name this ranges instead.


```diff

+type IPConfig struct {
Copy link
Collaborator

Choose a reason for hiding this comment

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

RangeConfiguration ?

Type string `json:"type"`
Routes []*cnitypes.Route `json:"routes"`
Datastore string `json:"datastore"`
+ IPs []IPConfig `json:"ips"`
Copy link
Collaborator

Choose a reason for hiding this comment

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

I would go for IPRanges . And name the attribute type RangeConfiguration or range config.

"exclude": [
"192.168.2.229/30",
"192.168.2.236/32",
+ "2001::0/124"
Copy link
Collaborator

Choose a reason for hiding this comment

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

how would you map the entries on the exclusion list to the correct range ? Here it actually seems doable since the ranges are from different IP families, but, what if you want to use this feature to configure multiple IPs in the same interface ?

Copy link
Member Author

Choose a reason for hiding this comment

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

We can take separate unions of IPv4 and IPv6 excluded ranges and just skip the IPs that belongs to that union set/list :)
I don't think we need to map it to the exact range. ^^

Comment on lines +278 to +280
First approach requires addition on a new _type_ for encapsulating all the IP related information on `IPAMConfig` and requires significant amount of change in the current code. But with this additional effort, it will have additional benefit of allowing us to allocate as many as we required IP addresses of any IP family without any constraints. _(We need to support the existing fields too for backward compatibility)_

Second approach is somewhat simpler. It just adds some additional fields for _secondary_ IP address related configuration (which might be IPv4 or IPv6 depending on stack policy). The downside is that we will limit ourselves to adding at max 2 IP address for a pod. _(TBH, it also seems okay for now, but I prefer the first approach)_
Copy link
Collaborator

Choose a reason for hiding this comment

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

I agree with the analysis presented here: first approach is preferable - simply because the second one does not scale.

Furthermore, the IP is somewhat clunky IMO.

I vote for option 1 as well.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Please add a paragraph to the summary indicating what is the chosen option and why.

@coveralls
Copy link

Pull Request Test Coverage Report for Build 2462334462

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage remained the same at 54.252%

Totals Coverage Status
Change from base Build 2353203143: 0.0%
Covered Lines: 874
Relevant Lines: 1611

💛 - Coveralls

- Updated attribute and struct name as per discussion
- Minor formatting in proposal document
Copy link
Collaborator

@maiqueb maiqueb left a comment

Choose a reason for hiding this comment

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

Nearly there.

Are you ready to propose a test plan for the feature, or would you prefer to do so later on ?

I suggest you never the less familiarize yourself with the e2e tests we have; imo, you would add a new test suite there.


Basically, rather than having IP related configurations directly as key members of `IPAMConfig` object, they be included as element of an object type, let's say `IPConfig` and `IPAMConfig` should have an array of `IPConfig` as it's element.
Rather than having IP related configurations directly as key members of `IPAMConfig` object, the IP configuration would be wrapped in a new struct - let's say `IPConfig`.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
Rather than having IP related configurations directly as key members of `IPAMConfig` object, the IP configuration would be wrapped in a new struct - let's say `IPConfig`.
Rather than having IP related configurations directly as key members of `IPAMConfig` object, the IP configuration would be wrapped in a new struct - let's say `RangeConfiguration`.

Comment on lines +278 to +280
First approach requires addition on a new _type_ for encapsulating all the IP related information on `IPAMConfig` and requires significant amount of change in the current code. But with this additional effort, it will have additional benefit of allowing us to allocate as many as we required IP addresses of any IP family without any constraints. _(We need to support the existing fields too for backward compatibility)_

Second approach is somewhat simpler. It just adds some additional fields for _secondary_ IP address related configuration (which might be IPv4 or IPv6 depending on stack policy). The downside is that we will limit ourselves to adding at max 2 IP address for a pod. _(TBH, it also seems okay for now, but I prefer the first approach)_
Copy link
Collaborator

Choose a reason for hiding this comment

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

Please add a paragraph to the summary indicating what is the chosen option and why.

@Ayush21298 Ayush21298 requested a review from maiqueb June 25, 2022 13:33
@Ayush21298
Copy link
Member Author

Thank you for your comments.
I made the changes as suggested :)

Are you ready to propose a test plan for the feature, or would you prefer to do so later on ?

I'm planning to do it latter along with the development :)

I suggest you never the less familiarize yourself with the e2e tests we have; imo, you would add a new test suite there.

Thank you for you guidance :)
I had a look at the unit test suites as well as e2e test suite and will update them as I go on along with development :)

@Ayush21298
Copy link
Member Author

Hello @dougbtv @maiqueb ~

Can you please review this 😅

Copy link
Collaborator

@maiqueb maiqueb left a comment

Choose a reason for hiding this comment

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

I have a question about the proposed alternative: how do the new RangesConfiguration slice play along w/ the old Range attribute ? Is the behavior additive (i.e. 1 range + 2 entries in the RangeConfiguration results in 3 configured interfaces) ?

I would like to see a sub-section about this, explaining (w/ a couple of examples) how it would works.

Some alternatives for this I see:

  • additive behavior (described above)
  • only use the new range configuration array / slice (the old Range would be just used for reading - i.e. copy the first range from the array there)
  • if Range is provided, disallow multiple ranges

@Ayush21298
Copy link
Member Author

I have a question about the proposed alternative: how do the new RangesConfiguration slice play along w/ the old Range attribute ? Is the behavior additive (i.e. 1 range + 2 entries in the RangeConfiguration results in 3 configured interfaces) ?

I would like to see a sub-section about this, explaining (w/ a couple of examples) how it would works.

Some alternatives for this I see:

* additive behavior (described above)

* only use the new range configuration array / slice (the _old_ `Range` would be just used for reading - i.e. copy the first range from the array there)

* if `Range` is provided, disallow multiple ranges

@maiqueb As you described, when both old configuration and IPRanges are present, the behavior will be additive.

I have added a section for the same along with examples in the proposal. :)

Copy link
Collaborator

@maiqueb maiqueb left a comment

Choose a reason for hiding this comment

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

Thank you for providing the examples - your proposal is now - imo - crystal clear.

I'll let this soak for a few weeks to give the community the time to also provide feedback / @dougbtv to back it up, but, I think you can start implementing this as is.

Good work.

@Ayush21298
Copy link
Member Author

Thank you for providing the examples - your proposal is now - imo - crystal clear.

I'll let this soak for a few weeks to give the community the time to also provide feedback / @dougbtv to back it up, but, I think you can start implementing this as is.

Good work.

Thanks @maiqueb :)
Yes I started working on the same line in PR #250. I'll try to finish it up ASAP :)

@maiqueb
Copy link
Collaborator

maiqueb commented Aug 5, 2022

Thank you for providing the examples - your proposal is now - imo - crystal clear.
I'll let this soak for a few weeks to give the community the time to also provide feedback / @dougbtv to back it up, but, I think you can start implementing this as is.
Good work.

Thanks @maiqueb :) Yes I started working on the same line in PR #250. I'll try to finish it up ASAP :)

Take your time, no rush.

Feel free to reach out if you need help with the e2e tests.

@JanScheurich
Copy link

We fully support this initiative to let whereabouts assign IP addresses from multiple IP ranges (IPv4 and/or v6) to a secondary pod interface and agree with the proposed implementation.

@Ayush21298
Copy link
Member Author

@dougbtv Hi, can we merge this proposal ?

Copy link
Member

@dougbtv dougbtv left a comment

Choose a reason for hiding this comment

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

LGTM. Thanks Ayush for the proposal, looking forward to the functionality.

@dougbtv dougbtv merged commit 6b202cb into k8snetworkplumbingwg:master Aug 18, 2022
@maiqueb maiqueb moved this from Review to Done in Dual stack Aug 18, 2022
@ryanlyy
Copy link

ryanlyy commented Nov 30, 2022

all,

which release will support this feature? seems now only master has these code support.

Thanks

@dougbtv
Copy link
Member

dougbtv commented Nov 30, 2022

Thanks @ryanlyy -- we have published https://github.com/k8snetworkplumbingwg/whereabouts/releases/tag/v0.6 -- including this feature!

@ryanlyy
Copy link

ryanlyy commented Dec 1, 2022

@dougbtv thank you!

@lubronzhan
Copy link

Hi @Ayush21298 does this only support macvlan mode? looking at the test, only macvlan is tested.
Do you worried that with ipvlan, different pod might get same slaac ip through dhcp?
Thank you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
No open projects
Development

Successfully merging this pull request may close these issues.

None yet

7 participants