Skip to content
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

feature: support the (X/Y) display mode for the printcolumn field in kubebuilder #1051

Closed
googs1025 opened this issue Sep 7, 2024 · 11 comments
Labels
kind/feature Categorizes issue or PR as related to a new feature. lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale.

Comments

@googs1025
Copy link
Member

/kind feature
As mentioned in the title and our discussion here kubernetes-sigs/kubebuilder#4134, can we support a JsonPath-like way of multiple combinations? This would allow for more flexible and rich display in CRs, for example, in the format of (X/Y).

It seems that there are others who have the same need.

@k8s-ci-robot k8s-ci-robot added the kind/feature Categorizes issue or PR as related to a new feature. label Sep 7, 2024
@sbueringer
Copy link
Member

If there is a way to do this with CRDs we can generate them accordingly with controller-gen.

If there is not, Kubernetes has to implement support for it first in the apiserver (and this issue should be opened in the kubernetes/kubernetes repo)

@camilamacedo86
Copy link
Member

camilamacedo86 commented Sep 9, 2024

Hi @sbueringer

Just to clarify the scenario, users are looking for

type FooSpec struct {
       Ready int `json:"ready"`
       Total int `json:"total"`
}

// +kubebuilder:object:root=true
// +kubebuilder:printcolumn:name="READY",type=string,JSONPath=`{.spec.ready}/{.spec.total}`
type Foo struct {
      metav1.TypeMeta   `json:",inline"`
      metav1.ObjectMeta `json:"metadata,omitempty"`
  
      Spec   FooSpec   `json:"spec,omitempty"`
      Status FooStatus `json:"status,omitempty"`
}

However, seems that

JSONPath=`{.spec.ready}/{.spec.total}` 

does not work. So, this issue is to ask for add the support to allow operations via JSONPath as the above example.

So, should the request with this example be raised against apiserver ?

@sbueringer
Copy link
Member

If it is not supported by Kubernetes today, I don't see how we can support it in controller-gen.
controller-gen only generates CRD YAMLs.

So yes, if it's not supported by the apiserver today, we should open an issue for the apiserver not for controller-gen

@googs1025
Copy link
Member Author

Is there a way we could support a MultiJsonPath-like approach, allowing multiple JsonPaths to be combined? This would make the display more flexible, rather than being limited to specific JsonPaths only.

@sbueringer
Copy link
Member

Sorry to say this again. This repository only contains controller-gen. controller-gen is a command line tool to generate CRD YAMLs. This repository does not contain any kube-apiserver code.

Because of that we cannot modify controller-gen to implement a feature that is not supported in the kube-apiserver first.

@googs1025
Copy link
Member Author

Sorry to say this again. This repository only contains controller-gen. controller-gen is a command line tool to generate CRD YAMLs. This repository does not contain any kube-apiserver code.

Because of that we cannot modify controller-gen to implement a feature that is not supported in the kube-apiserver first.

Thanks for the response! I appreciate it. I'm sorry for repeatedly asking you about the same thing. It's because I don't understand how it's generated. Also, if I want a similar feature, I need kube-apiserver support, right? If so, I'll go ahead and submit an issue in kubernetes/kubernetes to discuss and track this matter.

@camilamacedo86
Copy link
Member

Hi @googs1025

If so, I'll go ahead and submit an issue in kubernetes/kubernetes to discuss and track this matter.

Yes, that seems the right thing to do. I think that is the project: https://github.com/kubernetes/apiserver
Please, add the code example like #1051 (comment)

To clarify the scenario.

@googs1025
Copy link
Member Author

Hi @googs1025

If so, I'll go ahead and submit an issue in kubernetes/kubernetes to discuss and track this matter.

Yes, that seems the right thing to do. I think that is the project: https://github.com/kubernetes/apiserver Please, add the code example like #1051 (comment)

To clarify the scenario.

Maybe we should file an issue in kubernetes/kubernetes, since the kubernetes/apiserver repository is the one to sync :)

@k8s-triage-robot
Copy link

The Kubernetes project currently lacks enough contributors to adequately respond to all issues.

This bot triages un-triaged issues according to the following rules:

  • After 90d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was applied, the issue is closed

You can:

  • Mark this issue as fresh with /remove-lifecycle stale
  • Close this issue with /close
  • Offer to help out with Issue Triage

Please send feedback to sig-contributor-experience at kubernetes/community.

/lifecycle stale

@k8s-ci-robot k8s-ci-robot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Dec 8, 2024
@sbueringer
Copy link
Member

/close

As this cannot be fixed / implemented in controller-tools

@k8s-ci-robot
Copy link
Contributor

@sbueringer: Closing this issue.

In response to this:

/close

As this cannot be fixed / implemented in controller-tools

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/feature Categorizes issue or PR as related to a new feature. lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale.
Projects
None yet
Development

No branches or pull requests

5 participants