From d0ba615f9ea0bf133a057e9a4f87343418502b10 Mon Sep 17 00:00:00 2001 From: runkecheng <1131648942@qq.com> Date: Wed, 11 May 2022 11:19:54 +0800 Subject: [PATCH] crd: Add additionalPrinterColumns. #476 New columns: SpecReplicas, ReadyNodes, Leader --- api/v1alpha1/mysqlcluster_types.go | 6 ++++-- .../crds/mysql.radondb.com_mysqlclusters.yaml | 14 +++++++++++--- .../crd/bases/mysql.radondb.com_mysqlclusters.yaml | 14 +++++++++++--- 3 files changed, 26 insertions(+), 8 deletions(-) diff --git a/api/v1alpha1/mysqlcluster_types.go b/api/v1alpha1/mysqlcluster_types.go index 526738eaf..135ce1bab 100644 --- a/api/v1alpha1/mysqlcluster_types.go +++ b/api/v1alpha1/mysqlcluster_types.go @@ -373,8 +373,10 @@ type MysqlClusterStatus struct { // +kubebuilder:object:root=true // +kubebuilder:subresource:status // +kubebuilder:subresource:scale:specpath=.spec.replicas,statuspath=.status.readyNodes -// +kubebuilder:printcolumn:name="Ready",type="string",JSONPath=".status.conditions[?(@.type == 'Ready')].status",description="The cluster status" -// +kubebuilder:printcolumn:name="Replicas",type="integer",JSONPath=".spec.replicas",description="The number of desired nodes" +// +kubebuilder:printcolumn:name="State",type="string",JSONPath=".status.state",description="The cluster status" +// +kubebuilder:printcolumn:name="SpecReplicas",type="integer",JSONPath=".spec.replicas",description="The number of desired nodes" +// +kubebuilder:printcolumn:name="ReadyNodes",type="integer",JSONPath=".status.readyNodes",description="The number of ready nodes" +// +kubebuilder:printcolumn:name="Leader",type="string",JSONPath=".status.nodes[?(@.raftStatus.role == 'LEADER')].name",description="Name of the leader node" // +kubebuilder:printcolumn:name="Age",type="date",JSONPath=".metadata.creationTimestamp" // +kubebuilder:resource:shortName=mysql // MysqlCluster is the Schema for the mysqlclusters API diff --git a/charts/mysql-operator/crds/mysql.radondb.com_mysqlclusters.yaml b/charts/mysql-operator/crds/mysql.radondb.com_mysqlclusters.yaml index 24a879706..21f0b2cef 100644 --- a/charts/mysql-operator/crds/mysql.radondb.com_mysqlclusters.yaml +++ b/charts/mysql-operator/crds/mysql.radondb.com_mysqlclusters.yaml @@ -20,13 +20,21 @@ spec: versions: - additionalPrinterColumns: - description: The cluster status - jsonPath: .status.conditions[?(@.type == 'Ready')].status - name: Ready + jsonPath: .status.state + name: State type: string - description: The number of desired nodes jsonPath: .spec.replicas - name: Replicas + name: SpecReplicas type: integer + - description: The number of ready nodes + jsonPath: .status.readyNodes + name: ReadyNodes + type: integer + - description: Name of the leader node + jsonPath: .status.nodes[?(@.raftStatus.role == 'LEADER')].name + name: Leader + type: string - jsonPath: .metadata.creationTimestamp name: Age type: date diff --git a/config/crd/bases/mysql.radondb.com_mysqlclusters.yaml b/config/crd/bases/mysql.radondb.com_mysqlclusters.yaml index 24a879706..21f0b2cef 100644 --- a/config/crd/bases/mysql.radondb.com_mysqlclusters.yaml +++ b/config/crd/bases/mysql.radondb.com_mysqlclusters.yaml @@ -20,13 +20,21 @@ spec: versions: - additionalPrinterColumns: - description: The cluster status - jsonPath: .status.conditions[?(@.type == 'Ready')].status - name: Ready + jsonPath: .status.state + name: State type: string - description: The number of desired nodes jsonPath: .spec.replicas - name: Replicas + name: SpecReplicas type: integer + - description: The number of ready nodes + jsonPath: .status.readyNodes + name: ReadyNodes + type: integer + - description: Name of the leader node + jsonPath: .status.nodes[?(@.raftStatus.role == 'LEADER')].name + name: Leader + type: string - jsonPath: .metadata.creationTimestamp name: Age type: date