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
Print full labelset for all identities in 'cilium ip list' output #28425
Conversation
/test |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚢
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@joestringer Nice work!
All required tests passing and reviews are in. I'll fix up the minor nit from Fernand and repush. Should be good to merge after that. |
8e7c22a
to
a9d7166
Compare
If the 'cilium ip list' command cannot fetch identities for some numeric identities, then print an error and continue. This way it should still be possible to view most of the ips and at least their numeric identity counterparts even if one of the identities' labels cannot be queried. Signed-off-by: Joe Stringer <joe@cilium.io>
No need to iterate the labels here and individually append them to the slice, there's GetPrintableModel() for this purpose. Signed-off-by: Joe Stringer <joe@cilium.io>
In particular the host identity can have multiple labels that are not hardcoded directly from the number, so we should just always fetch the full labelset from the agent to ensure that the CLI prints what the agent knows. No special cases for reserved identities. The main subtlety here is that the GetIdentityIDParams() input is always the numeric identity as a string, and never the stringified name of that identity. For instance if client-side the CLI thinks that it can map identity "1" to "host" then it will still make the query with the parameter "1" (since that's how the identity get API works). If the query fails, then it'll attempt to fall back to printing a stringified name like "host" if available client-side, or otherwise just print the number. Signed-off-by: Joe Stringer <joe@cilium.io>
A single IP can only have exactly one identity. Each identity can have a set of labels associated with it. This code was confusingly using the variable name 'identities' for individual labels within a single identity. Rename it for clarity. (Strictly speaking the labels may not actually be labels but may be the numeric identity if the user decided not to pretty-print the labels, but I think this variable naming is still more clear than what preceded it). Signed-off-by: Joe Stringer <joe@cilium.io>
a9d7166
to
5173b4c
Compare
/test |
All required tests are passing, button is green. Merging. |
Oh wait, I'll let @joestringer do the honors. |
The host identity can have multiple labels that are not hardcoded directly from
the number, so we should just always fetch the full labelset from the agent for
all identities to ensure that the CLI prints what the agent knows. No need for
special cases for reserved identities.
Technically this bug goes way back and impacts any version since the kube-apiserver
entity policy feature has existed, but it's a minor bug so I'm only proposing this
for 1.14 at this time.