Skip to content

Conversation

squeed
Copy link
Contributor

@squeed squeed commented May 13, 2024

Manual backport of #28224 -- pkg/labels: print all leaf CIDRs, not just the last one.
[ upstream commit 1ec121c ]

[ backporters notes: needed to shuffle files around due to renames. ]

When printing Labels (e.g. by cilium identity list), CIDR labels are de-expanded to only show the relevant ones. For example, the CIDR label 1.1.1.0/24 is under-the-hood expanded to 0.0.0.0/0, 0.0.0.0/1, ..., 1.1.1.0/23, 1.1.1.0/24. Then, when the identity is printed for human consumption, the CIDR labels are de-expanded. However, this code did not anticipate a single identity having multiple "leaf" CIDR labels.

So, change the printing logic to output all interesting CIDRs. This adds a small utility datatype to efficiently prune a tree of cidrs to the leaves. It winds up being about 30% faster than the original, incorrect version.

Once this PR is merged, you can update the PR labels via:

$ for pr in 28224; do contrib/backporting/set-labels.py $pr done 1.14; done

[ upstream commit 1ec121c ]

[ backporters notes: needed to shuffle files around due to renames. ]

When printing Labels (e.g. by `cilium identity list`), CIDR labels are
de-expanded to only show the relevant ones. For example, the CIDR label
1.1.1.0/24 is under-the-hood expanded to 0.0.0.0/0, 0.0.0.0/1, ...,
1.1.1.0/23, 1.1.1.0/24. Then, when the identity is printed for human
consumption, the CIDR labels are de-expanded. However, this code did not
anticipate a single identity having multiple "leaf" CIDR labels.

So, change the printing logic to output all interesting CIDRs. This adds
a small utility datatype to efficiently prune a tree of cidrs to the
leaves. It winds up being about 30% faster than the original, incorrect
version.

Signed-off-by: Casey Callendrello <cdc@isovalent.com>
@squeed squeed requested a review from a team as a code owner May 13, 2024 13:47
@maintainer-s-little-helper maintainer-s-little-helper bot added backport/1.14 This PR represents a backport for Cilium 1.14.x of a PR that was merged to main. kind/backports This PR provides functionality previously merged into master. labels May 13, 2024
@nathanjsweet
Copy link
Member

/test-backport-1.14

@julianwiedmann julianwiedmann added the ready-to-merge This PR has passed all tests and received consensus from code owners to merge. label May 15, 2024
@michi-covalent michi-covalent merged commit 68ccae8 into cilium:v1.14 May 15, 2024
michi-covalent added a commit to cilium/release that referenced this pull request Jun 8, 2024
Print pull request URLs to make it easier to troubleshoot when something
goes wrong. For example, I needed to update the pull request description
in cilium/cilium#32511 because it was pointing
to an incorrect pull request number.

Signed-off-by: Michi Mutsuzaki <michi@isovalent.com>
michi-covalent added a commit to cilium/release that referenced this pull request Jun 17, 2024
Print pull request URLs to make it easier to troubleshoot when something
goes wrong. For example, I needed to update the pull request description
in cilium/cilium#32511 because it was pointing
to an incorrect pull request number.

Signed-off-by: Michi Mutsuzaki <michi@isovalent.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport/1.14 This PR represents a backport for Cilium 1.14.x of a PR that was merged to main. kind/backports This PR provides functionality previously merged into master. ready-to-merge This PR has passed all tests and received consensus from code owners to merge.
Projects
No open projects
Status: Released
Development

Successfully merging this pull request may close these issues.

4 participants