strimzi / kafka-access-operator

Operator for sharing access to Strimzi clusters across namespaces
Apache License 2.0
17 stars 15 forks source link

Define additional printer columns in the `KafkaAccess` CRD #53

Open scholzj opened 1 month ago

scholzj commented 1 month ago

We should define some additional columns to the KafkaAccess CRD so that it shows a bit more useful information when you do kubectl get kafkaacces or kubectl get kafkaaccess -o wide. The Ready column / state would be the most obvious thing to add there.

We should probably also add it to the strimzi group to have it listed together with the other Strimzi CRs.

ppatierno commented 4 weeks ago

Triaged on 03.10.2024: we agreed on having the additional columns.

MichaelMorrisEst commented 3 weeks ago

Id like to volunteer to work on this

scholzj commented 3 weeks ago

You can definitely look into it. But unfortunately, because this is using the Java Operator SDK, I have no idea where to start. Not sure if @katheris has any idea.

katheris commented 3 weeks ago

I think Java Operator SDK uses the fabric8 CRD generator under the covers, so you should be able to use an annotation https://github.com/fabric8io/kubernetes-client/blob/main/doc/CRD-generator.md#iofabric8crdgeneratorannotationprintercolumn

MichaelMorrisEst commented 2 weeks ago

I'd suggest the following additional columns:

NAME              CLUSTER      LISTENER   USER      READY  
my-kafka-access   my-cluster   tls        my-user   False

Does this sound ok?

The cluster, listener and user can easily be added using the annotation suggested above. However the ready column cannot as the annotation does not support filters and hence there is no way to filter the conditions for the Ready condition (i.e. no way to specify conditions[?(@.type==\"Ready\")])

There is however a new annotation in development (see https://github.com/fabric8io/kubernetes-client/pull/6390) that will allow the filter be specified.

We can wait for that to be released, or we can manually update 040-Crd-kafkaaccess.yaml until such time as that is released. If I'm not missing anything, it looks like 040-Crd-kafkaaccess.yaml is not automatically updated with the output from the crd generator as part of the build anyway?

scholzj commented 2 weeks ago

Thanks for looking into this. I think the suggested columns look good. But we should not modify the CRDs manually (and I think the recent PRs made it updated with the generated ones out of the box). We should either wait for the support to be added - or if you want we can add what we can right now and add the remaining columns in the future when available.

katheris commented 2 weeks ago

I'm also happy with the columns you proposed. And fine either way if we wait or add what is supported now and then add the final column in future.

MichaelMorrisEst commented 2 weeks ago

I have created a PR that addresses what we can for now.

Remaining: