-
Notifications
You must be signed in to change notification settings - Fork 1k
CRDs: additionalPrinterColumns configuration #1632
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
Conversation
BFDProfileBGPPeerIPAddressPoolCommunityI wanted to add a single column that provides a list of alias names that the individual resources define using the following marker: However, it doesn't work as expected, only the first item from the L2AdvertisementBGPAdvertisement |
| //+kubebuilder:subresource:status | ||
| //+kubebuilder:printcolumn:name="IPAddressPools",type=string,JSONPath=`.spec.ipAddressPools` | ||
| //+kubebuilder:printcolumn:name="IPAddressPool Selectors",type=string,JSONPath=`.spec.ipAddressPoolSelectors` | ||
| //+kubebuilder:printcolumn:name="Peers",type=string,JSONPath=`.spec.peers` |
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.
Any reason why we don't have the node selector here?
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.
I added those fields which seemed to be the most "important" for the resources. (So the output doesn't get too wide.)
Or in other words those configurations which I'd most often check.
In case of BGPAdvertisement for me it seemed these were the most important things:
- what addresses are we advertising,
- who are we advertising to.
I'm happy to add the node selector if that's also something users would usually set and check.
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.
(Btw. we can even add "hidden" fields that are only appear with -o wide.)
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.
Yep, I was curious about the asymmetry between l2 and bgp advertisement, where we had the node selector only on the l2 one.
Regarding hidden fields, TIL. I think it's reasonable to keep the node selector hidden in both.
|
I am torn about the selectors, but I think the only alternative is to leave them out (which might be even more confusing). So at least they are on the right when a user sees them. |
That'd definitely a more difficult change, but I think an alternative solution would be to add (and always keep up to date) an Then we could print the name of all the matching For example: apiVersion: metallb.io/v1beta1
kind: BGPAdvertisement
metadata:
name: example
namespace: metallb-system
spec:
ipAddressPools:
- first-pool
- second-pool
ipAddressPoolSelectors:
- matchLabels:
type: example
status:
ipAddressPools:
- first-pool
- second-pool
- example-1-pool
- example-2-pool⬇️ |
Sounds legit. Let me add that to the list of things it may make sense to expose as status. I am working on a proposal (that will turn in a lot of issues :P to be worked) to collect all the status we may want to expose. I'd apply the change suggested above (hide the node selectors) and go out with this first version. It's not as binding as an api in any case, and we can change it later on.
|
This commit adds `+kubebuilder:printcolumn` markers to CRD structs so the generated CRDs are extended with `additionalPrinterColumns` properties.
Sounds good! 🥳
Changes applied. I also updated the output example in the comment: #1632 (comment) |
|
LGTM! |
This commit adds
+kubebuilder:printcolumnmarkers to CRD structs so the generated CRDs are extended withadditionalPrinterColumnsproperties.Closes: #1459