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

ipam: report IP owner of non-default pool IPs in multi-pool IPAM #27968

Merged
merged 1 commit into from Sep 6, 2023

Conversation

tklauser
Copy link
Member

@tklauser tklauser commented Sep 6, 2023

Before this change, only IPs from the default pool are reported in cilium status --verbose in the "Allocated addresses" section when using multi-pool IPAM mode. With this change, all IPs from non-default pools are reported as well by making use of the fact that the pool name is prepended to the IP in (*multiPoolManager).dump.

Example:

% ks exec -it cilium-n8xw7 -- cilium status --verbose
[...]
IPAM:                   IPv4: 2 IPAM pool(s) available,
Allocated addresses:
  10.10.0.46 (router)
  10.10.0.48 (kube-system/coredns-5d78c9869d-d4nts [restored])
  10.10.0.61 (kube-system/hubble-relay-597b7bdff8-pwl69 [restored])
  10.10.0.62 (health)
  jupiter/192.168.0.15 (default/nginx-jupiter)
[...]

Note that IPs from non-default pools (in this case the jupiter pool) are reported with the pool name prefixed.

For #25470

@tklauser tklauser added release-note/minor This PR changes functionality that users may find relevant to operating Cilium. sig/ipam IP address management, including cloud IPAM area/ipam Impacts IP address management functionality. needs-backport/1.14 This PR / issue needs backporting to the v1.14 branch labels Sep 6, 2023
@tklauser tklauser requested a review from gandro September 6, 2023 13:48
@tklauser tklauser requested a review from a team as a code owner September 6, 2023 13:48
@maintainer-s-little-helper maintainer-s-little-helper bot added this to Needs backport from main in 1.14.2 Sep 6, 2023
@tklauser tklauser mentioned this pull request Sep 6, 2023
29 tasks
@tklauser
Copy link
Member Author

tklauser commented Sep 6, 2023

/test

Before this change, only IPs from the default pool are reported in
`cilium status --verbose` in the "Allocated addresses" section when
using multi-pool IPAM mode. With this change, all IPs from non-default
pools are reported as well by making use of the fact that the pool name
is prepended to the IP in `(*multiPoolManager).dump`.

Example:

```
% ks exec -it cilium-n8xw7 -- cilium status --verbose
[...]
IPAM:                   IPv4: 2 IPAM pool(s) available,
Allocated addresses:
  10.10.0.46 (router)
  10.10.0.48 (kube-system/coredns-5d78c9869d-d4nts [restored])
  10.10.0.61 (kube-system/hubble-relay-597b7bdff8-pwl69 [restored])
  10.10.0.62 (health)
  jupiter/192.168.0.15 (default/nginx-jupiter)
[...]
```

Note that IPs from non-default pools (in this case the `jupiter` pool)
are reported with the pool name prefixed.

Signed-off-by: Tobias Klauser <tobias@cilium.io>
@tklauser tklauser force-pushed the pr/tklauser/multi-pool-status-pool-owner branch from bad7657 to 35daa4d Compare September 6, 2023 13:50
@tklauser
Copy link
Member Author

tklauser commented Sep 6, 2023

/test

Copy link
Member

@gandro gandro 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 fixing this. Have you also considered changing the type of the IPv4Allocator.Dump() interface to store the pool name separately? To my knowledge, the Allocator interface (where Dump is a part of) while exported is actually not used outside the IPAM package, so I think we should consider changing the signature of ipam.Allocator.Dump to contain the pool name if possible.

The ipam.IPAM.Dump signature can remain as is, I would only change ipam.Allocator.Dump so we can transport the information without having to split strings.

@tklauser
Copy link
Member Author

tklauser commented Sep 6, 2023

Thanks for fixing this. Have you also considered changing the type of the IPv4Allocator.Dump() interface to store the pool name separately? To my knowledge, the Allocator interface (where Dump is a part of) while exported is actually not used outside the IPAM package, so I think we should consider changing the signature of ipam.Allocator.Dump to contain the pool name if possible.

The ipam.IPAM.Dump signature can remain as is, I would only change ipam.Allocator.Dump so we can transport the information without having to split strings.

Thanks for the suggestion. I haven't considered this so far but it would make the interface a lot cleaner. I'd probably defer that change to a follow-up PR, so this rather small PR can be backported (given it adds additional debugging/tourbleshooting information for multi-pool IPAM) without much internal API refactoring.

@maintainer-s-little-helper maintainer-s-little-helper bot added the ready-to-merge This PR has passed all tests and received consensus from code owners to merge. label Sep 6, 2023
@youngnick youngnick merged commit afd8e4e into main Sep 6, 2023
205 checks passed
@youngnick youngnick deleted the pr/tklauser/multi-pool-status-pool-owner branch September 6, 2023 23:28
@michi-covalent michi-covalent added this to Needs backport from main in 1.14.3 Sep 9, 2023
@michi-covalent michi-covalent removed this from Needs backport from main in 1.14.2 Sep 9, 2023
@gandro gandro mentioned this pull request Sep 12, 2023
15 tasks
@gandro gandro added backport-pending/1.14 The backport for Cilium 1.14.x for this PR is in progress. and removed needs-backport/1.14 This PR / issue needs backporting to the v1.14 branch labels Sep 12, 2023
@gandro gandro added backport-done/1.14 The backport for Cilium 1.14.x for this PR is done. and removed backport-pending/1.14 The backport for Cilium 1.14.x for this PR is in progress. labels Sep 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/ipam Impacts IP address management functionality. backport-done/1.14 The backport for Cilium 1.14.x for this PR is done. ready-to-merge This PR has passed all tests and received consensus from code owners to merge. release-note/minor This PR changes functionality that users may find relevant to operating Cilium. sig/ipam IP address management, including cloud IPAM
Projects
No open projects
1.14.3
Needs backport from main
Development

Successfully merging this pull request may close these issues.

None yet

3 participants