Skip to content

Commit 4c2d5ef

Browse files
committed
Add Ready print column to kubectl
1 parent d875bff commit 4c2d5ef

File tree

3 files changed

+9
-0
lines changed

3 files changed

+9
-0
lines changed

config/crds/mysql_v1alpha1_mysqlcluster.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@ metadata:
77
name: mysqlclusters.mysql.presslabs.org
88
spec:
99
additionalPrinterColumns:
10+
- JSONPath: .status.conditions[?(@.type == "Ready")].status
11+
description: The cluster status
12+
name: Ready
13+
type: string
1014
- JSONPath: .spec.replicas
1115
description: The number of desired nodes
1216
name: Replicas

hack/charts/mysql-operator/templates/crds.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,10 @@ metadata:
3333
helm.sh/hook: crd-install
3434
spec:
3535
additionalPrinterColumns:
36+
- JSONPath: .status.conditions[?(@.type == "Ready")].status
37+
description: The cluster status
38+
name: Ready
39+
type: string
3640
- JSONPath: .spec.replicas
3741
description: The number of desired nodes
3842
name: Replicas

pkg/apis/mysql/v1alpha1/mysqlcluster_types.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -282,6 +282,7 @@ type MysqlClusterStatus struct {
282282
// +k8s:openapi-gen=true
283283
// +kubebuilder:subresource:status
284284
// +kubebuilder:subresource:scale:specpath=.spec.replicas,statuspath=.status.readyNodes
285+
// +kubebuilder:printcolumn:name="Ready",type="string",JSONPath=".status.conditions[?(@.type == "Ready")].status",description="The cluster status"
285286
// +kubebuilder:printcolumn:name="Replicas",type="integer",JSONPath=".spec.replicas",description="The number of desired nodes"
286287
// +kubebuilder:printcolumn:name="Age",type="date",JSONPath=".metadata.creationTimestamp"
287288
type MysqlCluster struct {

0 commit comments

Comments
 (0)