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

pkg/node: omit the generated spec.ipam.podCIDRs when running with some IPAM modes #23048

Closed
wants to merge 1 commit into from

Conversation

mvisonneau
Copy link
Contributor

@mvisonneau mvisonneau commented Jan 11, 2023

Currently, when using Cilium with IPAM in AWS ENI, Azure & AlibabaCloud methods. A random podCIDR block is being generated when the CiliumNode is created although is not being leveraged.

[...]
spec:
  ipam:
    podCIDRs:
    - 10.194.0.0/16 # << this one
    pool:
      172.16.5.192:
        resource: eni-0f2cda9c5fe02382b
      172.16.5.193:
        resource: eni-0f2cda9c5fe02382b
      172.16.5.194:
        resource: eni-0f2cda9c5fe02382b

To avoid operators confusion and make it easier to troubleshoot, I felt it could be interesting propose this change which omits the generation of this CIDR block.

[...]
spec:
  ipam:
    pool:
      172.16.5.192:
        resource: eni-0f2cda9c5fe02382b
      172.16.5.193:
        resource: eni-0f2cda9c5fe02382b
      172.16.5.194:
        resource: eni-0f2cda9c5fe02382b

Fixes #9409

@maintainer-s-little-helper maintainer-s-little-helper bot added the dont-merge/needs-release-note-label The author needs to describe the release impact of these changes. label Jan 11, 2023
@mvisonneau mvisonneau marked this pull request as ready for review January 11, 2023 17:49
@mvisonneau mvisonneau requested a review from a team as a code owner January 11, 2023 17:49
@github-actions github-actions bot added the kind/community-contribution This was a contribution made by a community member. label Jan 11, 2023
pkg/node/address.go Outdated Show resolved Hide resolved
@thorn3r
Copy link
Contributor

thorn3r commented Jan 11, 2023

thanks for the PR @mvisonneau! looks like the checkpatch test is failing because the commit title is too long. Mind amending that to shorten it a bit? I'll kick off the rest of the test suite

@thorn3r
Copy link
Contributor

thorn3r commented Jan 11, 2023

/test

@mvisonneau
Copy link
Contributor Author

Thanks for the review @thorn3r! I updated the commit message.

@mvisonneau mvisonneau changed the title pkg/node: omit the generated podCIDRs from the CiliumNode when running in ENI mode pkg/node: omit the generated spec.ipam.podCIDRs when running in ENI mode Jan 12, 2023
@thorn3r thorn3r added the release-note/minor This PR changes functionality that users may find relevant to operating Cilium. label Jan 13, 2023
@maintainer-s-little-helper maintainer-s-little-helper bot removed the dont-merge/needs-release-note-label The author needs to describe the release impact of these changes. label Jan 13, 2023
@thorn3r
Copy link
Contributor

thorn3r commented Jan 13, 2023

/test

Job 'Cilium-PR-K8s-1.25-kernel-4.19' hit: #22019 (94.82% similarity)

Copy link
Contributor

@thorn3r thorn3r left a comment

Choose a reason for hiding this comment

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

LGTM! seems like we hit an already tracked flake

@thorn3r thorn3r requested a review from a team January 17, 2023 18:26
Copy link
Contributor

@jaffcheng jaffcheng 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! I think this should close #9409

pkg/node/address.go Outdated Show resolved Hide resolved
@thorn3r thorn3r removed the request for review from a team January 19, 2023 19:22
@mvisonneau mvisonneau changed the title pkg/node: omit the generated spec.ipam.podCIDRs when running in ENI mode pkg/node: omit the generated spec.ipam.podCIDRs when running with some IPAM modes Jan 20, 2023
@maintainer-s-little-helper
Copy link

Commit 608dbb8acfd7c6ebeac4204589ccd98beaa459e3 does not contain "Signed-off-by".

Please follow instructions provided in https://docs.cilium.io/en/stable/contributing/development/contributing_guide/#developer-s-certificate-of-origin

@maintainer-s-little-helper maintainer-s-little-helper bot added the dont-merge/needs-sign-off The author needs to add signoff to their commits before merge. label Jan 20, 2023
@jaffcheng
Copy link
Contributor

Code changes LGTM! I'm not familiar with cilium CI workflows, looks like the checkpatch test fails with the current commit title, and maybe we should remove the second commit.

Error: ERROR:CUSTOM: Please avoid long commit subjects (max: 75, found: 81)

Currently, when using Cilium with AWS ENI, Azure & AlibabaCloud methods. A random podCIDR block is being generated when the CiliumNode is created although is not being leveraged.

```yaml
[...]
spec:
  ipam:
    podCIDRs:
    - 10.194.0.0/16 # << this one
    pool:
      172.16.5.192:
        resource: eni-0f2cda9c5fe02382b
      172.16.5.193:
        resource: eni-0f2cda9c5fe02382b
      172.16.5.194:
        resource: eni-0f2cda9c5fe02382b
```

To avoid operators confusion and make it easier to troubleshoot, I felt it could be interesting propose this change which omits the generation of this CIDR block.

```yaml
[...]
spec:
  ipam:
    pool:
      172.16.5.192:
        resource: eni-0f2cda9c5fe02382b
      172.16.5.193:
        resource: eni-0f2cda9c5fe02382b
      172.16.5.194:
        resource: eni-0f2cda9c5fe02382b
```

Signed-off-by: Maxime VISONNEAU <maxime.visonneau@gmail.com>
@maintainer-s-little-helper maintainer-s-little-helper bot removed the dont-merge/needs-sign-off The author needs to add signoff to their commits before merge. label Jan 23, 2023
@mvisonneau
Copy link
Contributor Author

👋 thanks for the review @jaffcheng. Not sure how this merge commit ended up there, I removed it and also shorten the message of the relevant one!

@@ -423,6 +425,12 @@ func AutoComplete() error {

InitDefaultPrefix(option.Config.DirectRoutingDevice)
Copy link
Contributor

Choose a reason for hiding this comment

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

@mvisonneau I'm a bit lost about how this work, could you share more on that? I assume the cidr is generated in InitDefaultPrefix, but it's not skipped.
https://github.com/cilium/cilium/pull/23048/files#diff-9143180298a1f5ba5dc10fd98d87945d1381ef45b7347a639f85e13e84285ca2L424

Copy link
Contributor Author

Choose a reason for hiding this comment

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

absolutely, I did not find it useful to skip the InitDefaultPrefix function call during my tests. I assumed that the allocation was happening later (L633 &/or L644).

As we return early (L431) it seems to be sufficient. Not sure about the impact of moving the return logic before the InitDefaultPrefix call but happy to try it out if you want/prefer.

Copy link
Contributor

Choose a reason for hiding this comment

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

Thanks for clarifying.
Looks like there are two places calling InitDefaultPrefix:

InitDefaultPrefix(option.Config.DirectRoutingDevice)

node.InitDefaultPrefix(option.Config.DirectRoutingDevice)

I tried the patch in Alibabacloud mode and found that I have to skip both InitDefaultPrefix calls to omit the podCIDR. Not sure if there are some differences between ENI mode.

Copy link
Member

@christarazi christarazi 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 the PR. I don't quite understand why any of these changes are needed. Shouldn't it be as simple as detecting which IPAM mode we need to skip updating the podCIDR field for during the CiliumNode creation? I'd expect such a change to be here.

@christarazi christarazi added kind/enhancement This would improve or streamline existing functionality. sig/ipam IP address management, including cloud IPAM labels Feb 1, 2023
@aanm aanm removed their assignment Feb 1, 2023
@christarazi
Copy link
Member

@mvisonneau Do you plan to continue on this PR?

@mvisonneau
Copy link
Contributor Author

I was yes, I apologize as I haven't been able to prioritize it yet. Feel free to update or make progress onto if necessary though!

@github-actions
Copy link

github-actions bot commented Apr 9, 2023

This pull request has been automatically marked as stale because it
has not had recent activity. It will be closed if no further activity
occurs. Thank you for your contributions.

@github-actions github-actions bot added the stale The stale bot thinks this issue is old. Add "pinned" label to prevent this from becoming stale. label Apr 9, 2023
@github-actions github-actions bot removed the stale The stale bot thinks this issue is old. Add "pinned" label to prevent this from becoming stale. label Apr 19, 2023
@aanm
Copy link
Member

aanm commented Apr 27, 2023

@mvisonneau ping? 🙂

@joestringer joestringer marked this pull request as draft May 5, 2023 17:21
@joestringer
Copy link
Member

Thanks for the contribution. I've marked the PR as draft while the feedback is addressed. When the PR is ready for review, you can indicate this by clicking the "Ready for review" button at the bottom of the page.

@mvisonneau
Copy link
Contributor Author

My apologies, I am going to put my head back onto it and will keep you posted!

@gandro gandro mentioned this pull request Jun 28, 2023
29 tasks
@github-actions
Copy link

github-actions bot commented Jul 1, 2023

This pull request has been automatically marked as stale because it
has not had recent activity. It will be closed if no further activity
occurs. Thank you for your contributions.

@github-actions github-actions bot added the stale The stale bot thinks this issue is old. Add "pinned" label to prevent this from becoming stale. label Jul 1, 2023
@christarazi christarazi removed the stale The stale bot thinks this issue is old. Add "pinned" label to prevent this from becoming stale. label Jul 3, 2023
@gandro
Copy link
Member

gandro commented Jul 6, 2023

I have pushed a PR that implements Chris' suggestion to not announce the podCIDR for now: #26663

Long term however, I think we do want to fully get rid of the code that auto-generates the podCIDR for all IPAM modes. It's not used by any IPAM mode, so let's just remove that.

@github-actions
Copy link

github-actions bot commented Aug 6, 2023

This pull request has been automatically marked as stale because it
has not had recent activity. It will be closed if no further activity
occurs. Thank you for your contributions.

@github-actions github-actions bot added the stale The stale bot thinks this issue is old. Add "pinned" label to prevent this from becoming stale. label Aug 6, 2023
@christarazi
Copy link
Member

@mvisonneau Any update?

@github-actions github-actions bot removed the stale The stale bot thinks this issue is old. Add "pinned" label to prevent this from becoming stale. label Aug 8, 2023
@github-actions
Copy link

github-actions bot commented Sep 7, 2023

This pull request has been automatically marked as stale because it
has not had recent activity. It will be closed if no further activity
occurs. Thank you for your contributions.

@github-actions github-actions bot added the stale The stale bot thinks this issue is old. Add "pinned" label to prevent this from becoming stale. label Sep 7, 2023
@jaffcheng
Copy link
Contributor

Looks like the related issue is fixed by #26663 ?

@gandro
Copy link
Member

gandro commented Sep 7, 2023

Looks like the related issue is fixed by #26663 ?

Yes, that PR fixed the issue for ENI. There is still more work around the use of pod CIDRs in IPAM modes that don't have them (c.f. #27018), but the issue addressed by this PR should be fixed now.

@mvisonneau I'm closing this PR as "obsolete". Please feel free to re-open or ping me if you feel otherwise.

@gandro gandro closed this Sep 7, 2023
@mvisonneau
Copy link
Contributor Author

Apologies, I had messed up with my email notifications! 🙈 Amazing, thanks, I'll try it out but at first sight it does indeed seem to supersedes it 👍

@mvisonneau mvisonneau deleted the pkg_node_addr_eni_ignore branch September 7, 2023 15:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/community-contribution This was a contribution made by a community member. kind/enhancement This would improve or streamline existing functionality. release-note/minor This PR changes functionality that users may find relevant to operating Cilium. sig/ipam IP address management, including cloud IPAM stale The stale bot thinks this issue is old. Add "pinned" label to prevent this from becoming stale.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ENI: Do not fill ciliumnodes with allocated podCIDRs in ENI mode
7 participants