community
community copied to clipboard
Ability to specify additional printer columns in `ack-generate` config file
Is your feature request related to a problem?
Currently, ack-generate can produce go code with kubebuilder markers allowing CRDs to have additional print columns. However, CRDs can only have one print column per field. Ideally, we would like to have an option to specify extra print columns with something similar to:
additionalPrinterColumns:
- name: SYNCED
jsonPath: .status.conditions[?(@.type=="ACK.ResourceSynced")].status
Describe the solution you'd like Ability to have multiple print columns per field.
This feature will unblock https://github.com/aws-controllers-k8s/community/issues/1271
I'd propose we can go ahead with adding the SYNCED column to every CRD, anyway. Let's not even make it an option for resources, just do it for everything.
Issues go stale after 90d of inactivity.
Mark the issue as fresh with /remove-lifecycle stale.
Stale issues rot after an additional 30d of inactivity and eventually close.
If this issue is safe to close now please do so with /close.
Provide feedback via https://github.com/aws-controllers-k8s/community.
/lifecycle stale
Stale issues rot after 30d of inactivity.
Mark the issue as fresh with /remove-lifecycle rotten.
Rotten issues close after an additional 30d of inactivity.
If this issue is safe to close now please do so with /close.
Provide feedback via https://github.com/aws-controllers-k8s/community.
/lifecycle rotten
/lifecycle frozen
+1 on this (though SYNCED is already there with print.add_synced_column: true now.
Would love to see this feature so I can reference "arbitrary" fields of the resource (from spec and status), e.g. ARN or state from an EventBridge rule and project it into a printer column.
I raised this with @A-Hilaly again, and he's definitely aware and supportive.
/assign
Giving more context on this issue:
PrinterColumns is a CRD attribute that allows extending kubectl get table result. In ACK land our CRD yaml files are generated using controller-gen which behinds the scenes relies on kubebuilder markers (Golang comments) to know how a field should be printed and injected in the kubectl get result.
For example in prometheusservice-controller, we inject this kubebuilder marker (Go comment) to instruct controller-gen to inject additionalPrinterColumns in the CRD yaml file which contains information on how to print the .spec.Alias
The feature described in this Issue, will allow ACK code-generator users to inject special kubebuilder markers to support printing nested fields, specific elements in an array/maps and doing some complex json queries in order to provide the best kubectl get experience. A good example is .status.conditions[?(@.type=="ACK.ResourceSynced")].status that will allow users to see the value of the synced condition.
There a PR that shows how we added the ability to append the AGE columns: https://github.com/aws-controllers-k8s/code-generator/pull/84/files
This functionality is now available in the main branch of code-generator, and will be in the next release.