diff --git a/api/v1alpha1/mysqlcluster_types.go b/api/v1alpha1/mysqlcluster_types.go index 526738eaf..4a6badb7b 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="Ready",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..8c5516b44 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 + jsonPath: .status.state name: Ready 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..8c5516b44 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 + jsonPath: .status.state name: Ready 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