Replies: 4 comments 3 replies
-
#2285 |
Beta Was this translation helpful? Give feedback.
-
// +genclient
//+kubebuilder:object:root=true
//+kubebuilder:subresource:status
//+kubebuilder:subresource:scale:specpath=.spec.replicas,statuspath=.status.replicas,selectorpath=.status.hpaPodSelector
//+kubebuilder:resource:shortName={lws}
//+kubebuilder:printcolumn:name="Ready",type="string",JSONPath=`{.status.readyReplicas}/{.spec.replicas}`,description="Ratio of ready replicas to desired replicas."
//+kubebuilder:printcolumn:name="UP-TO-DATE",type="string",JSONPath=".status.updatedReplicas",description="Number of groups that have been updated (ready or not)."
//+kubebuilder:printcolumn:name="Age",JSONPath=".metadata.creationTimestamp",type=date,description="Age is the time LeaderWorkerSet was created."
// LeaderWorkerSet is the Schema for the leaderworkersets API
type LeaderWorkerSet struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`
Spec LeaderWorkerSetSpec `json:"spec,omitempty"`
Status LeaderWorkerSetStatus `json:"status,omitempty"`
} When I use it, the following error occurs root@VM-0-8-ubuntu:/home/ubuntu/lws# make uninstall
make: go: Permission denied
test -s /home/ubuntu/lws/bin/controller-gen && /home/ubuntu/lws/bin/controller-gen --version | grep -q v0.16.2 || \
GOBIN=/home/ubuntu/lws/bin go install sigs.k8s.io/controller-tools/cmd/controller-gen@v0.16.2
/home/ubuntu/lws/bin/controller-gen \
rbac:roleName=manager-role output:rbac:artifacts:config=config/rbac \
crd:generateEmbeddedObjectMeta=true output:crd:artifacts:config=config/crd/bases \
webhook output:webhook:artifacts:config=config/webhook \
paths="./..."
/home/ubuntu/lws/bin/kustomize build config/crd | kubectl delete --ignore-not-found=false -f -
customresourcedefinition.apiextensions.k8s.io "leaderworkersets.leaderworkerset.x-k8s.io" deleted
root@VM-0-8-ubuntu:/home/ubuntu/lws# make install
make: go: Permission denied
test -s /home/ubuntu/lws/bin/controller-gen && /home/ubuntu/lws/bin/controller-gen --version | grep -q v0.16.2 || \
GOBIN=/home/ubuntu/lws/bin go install sigs.k8s.io/controller-tools/cmd/controller-gen@v0.16.2
/home/ubuntu/lws/bin/controller-gen \
rbac:roleName=manager-role output:rbac:artifacts:config=config/rbac \
crd:generateEmbeddedObjectMeta=true output:crd:artifacts:config=config/crd/bases \
webhook output:webhook:artifacts:config=config/webhook \
paths="./..."
/home/ubuntu/lws/bin/kustomize build config/crd | kubectl create -f -
The CustomResourceDefinition "leaderworkersets.leaderworkerset.x-k8s.io" is invalid: spec.additionalPrinterColumns[0].JSONPath: Invalid value: "{.status.readyReplicas}/{.spec.replicas}": must be a simple json path starting with .
make: *** [Makefile:187: install] Error 1 |
Beta Was this translation helpful? Give feedback.
-
Thank you for continuously researching my question! That's really great. Yes, as you mentioned, using the approach you provided can achieve this goal. However, in terms of design, adding such a field just for display purposes is clearly not a good design practice. This kind of display format like (X/Y) is, in my opinion, very useful and there will likely be many projects that could benefit from it. This should be a feature that needs to be implemented. |
Beta Was this translation helpful? Give feedback.
-
Closing this one since an issue was open for controller-tools: kubernetes-sigs/controller-tools#1051 |
Beta Was this translation helpful? Give feedback.
-
For a custom resource object, I want to use the kubectl method (X/Y) to display the Ready field. I tried it and it shows empty.
My expectation is 3/3. like this
Beta Was this translation helpful? Give feedback.
All reactions