kubernetes-client
kubernetes-client copied to clipboard
JSONPath selection in PrinterColumn
As today the @PrinterColumn annotation can only be set on a field, but in some case it would be nice to have the option to set in on a type, i.e. on a CustomResource
with the go sdk, one can do something like:
kubebuilder:printcolumn:name="provider",type=string,JSONPath=`.spec.runtime.provider`,description="provider"
but I don't a similar option with the java operator sdk
My use case is that I have a Java class used in both the spec and the status and I want to print the same field from spec and status but with a different name.
public class ConnectorSpec {
private DeploymentRef deployment;
}
public class ConnectorStatus {
private DeploymentRef deployment;
}
with the go sdk, I could write something like
kubebuilder:printcolumn:name=name="foo",type=string,JSONPath=`.spec.deployment.field`"
kubebuilder:printcolumn:name=name="bar",type=string,JSONPath=`.status.deployment.field`
I can workaround this by in-lining classes in the spec/status or having two distinct classes but since the information are exactly the same, it would put more maintenance