Skip to content

Commit

Permalink
crd: Add additionalPrinterColumns. radondb#476
Browse files Browse the repository at this point in the history
New columns: SpecReplicas, ReadyNodes, Leader
  • Loading branch information
runkecheng committed May 11, 2022
1 parent d35a415 commit 6838969
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 6 deletions.
6 changes: 4 additions & 2 deletions api/v1alpha1/mysqlcluster_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
12 changes: 10 additions & 2 deletions charts/mysql-operator/crds/mysql.radondb.com_mysqlclusters.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
12 changes: 10 additions & 2 deletions config/crd/bases/mysql.radondb.com_mysqlclusters.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 6838969

Please sign in to comment.