Skip to content

Commit d614047

Browse files
authored
Merge pull request #543 from CecileRobertMichon/print-columns-ux
✨ Add printer columns to AzureMachine and AzureCluster
2 parents 59e2947 + 8b58a22 commit d614047

File tree

4 files changed

+63
-2
lines changed

4 files changed

+63
-2
lines changed

api/v1alpha3/azurecluster_types.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,11 @@ type AzureClusterStatus struct {
5858
}
5959

6060
// +kubebuilder:object:root=true
61+
// +kubebuilder:printcolumn:name="Cluster",type="string",JSONPath=".metadata.labels.cluster\\.x-k8s\\.io/cluster-name",description="Cluster to which this AzureCluster belongs"
62+
// +kubebuilder:printcolumn:name="Ready",type="boolean",JSONPath=".status.ready"
63+
// +kubebuilder:printcolumn:name="Resource Group",type="string",priority=1,JSONPath=".spec.resourceGroup"
64+
// +kubebuilder:printcolumn:name="Location",type="string",priority=1,JSONPath=".spec.location"
65+
// +kubebuilder:printcolumn:name="Endpoint",type="string",priority=1,JSONPath=".spec.controlPlaneEndpoint.host",description="Control Plane Endpoint"
6166
// +kubebuilder:resource:path=azureclusters,scope=Namespaced,categories=cluster-api
6267
// +kubebuilder:storageversion
6368
// +kubebuilder:subresource:status

api/v1alpha3/azuremachine_types.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,12 @@ type AzureMachineStatus struct {
114114
}
115115

116116
// +kubebuilder:object:root=true
117+
// +kubebuilder:printcolumn:name="Ready",type="string",JSONPath=".status.ready",description="AzureMachine ready status"
118+
// +kubebuilder:printcolumn:name="State",type="string",JSONPath=".status.vmState",description="Azure VM provisioning state"
119+
// +kubebuilder:printcolumn:name="Cluster",type="string",priority=1,JSONPath=".metadata.labels.cluster\\.x-k8s\\.io/cluster-name",description="Cluster to which this AzureMachine belongs"
120+
// +kubebuilder:printcolumn:name="Machine",type="string",priority=1,JSONPath=".metadata.ownerReferences[?(@.kind==\"Machine\")].name",description="Machine object to which this AzureMachine belongs"
121+
// +kubebuilder:printcolumn:name="VM ID",type="string",priority=1,JSONPath=".spec.providerID",description="Azure VM ID"
122+
// +kubebuilder:printcolumn:name="VM Size",type="string",priority=1,JSONPath=".spec.vmSize",description="Azure VM Size"
117123
// +kubebuilder:resource:path=azuremachines,scope=Namespaced,categories=cluster-api
118124
// +kubebuilder:storageversion
119125
// +kubebuilder:subresource:status

config/crd/bases/infrastructure.cluster.x-k8s.io_azureclusters.yaml

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -392,7 +392,28 @@ spec:
392392
storage: false
393393
subresources:
394394
status: {}
395-
- name: v1alpha3
395+
- additionalPrinterColumns:
396+
- description: Cluster to which this AzureCluster belongs
397+
jsonPath: .metadata.labels.cluster\.x-k8s\.io/cluster-name
398+
name: Cluster
399+
type: string
400+
- jsonPath: .status.ready
401+
name: Ready
402+
type: boolean
403+
- jsonPath: .spec.resourceGroup
404+
name: Resource Group
405+
priority: 1
406+
type: string
407+
- jsonPath: .spec.location
408+
name: Location
409+
priority: 1
410+
type: string
411+
- description: Control Plane Endpoint
412+
jsonPath: .spec.controlPlaneEndpoint.host
413+
name: Endpoint
414+
priority: 1
415+
type: string
416+
name: v1alpha3
396417
schema:
397418
openAPIV3Schema:
398419
description: AzureCluster is the Schema for the azureclusters API

config/crd/bases/infrastructure.cluster.x-k8s.io_azuremachines.yaml

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,36 @@ spec:
184184
storage: false
185185
subresources:
186186
status: {}
187-
- name: v1alpha3
187+
- additionalPrinterColumns:
188+
- description: AzureMachine ready status
189+
jsonPath: .status.ready
190+
name: Ready
191+
type: string
192+
- description: Azure VM provisioning state
193+
jsonPath: .status.vmState
194+
name: State
195+
type: string
196+
- description: Cluster to which this AzureMachine belongs
197+
jsonPath: .metadata.labels.cluster\.x-k8s\.io/cluster-name
198+
name: Cluster
199+
priority: 1
200+
type: string
201+
- description: Machine object to which this AzureMachine belongs
202+
jsonPath: .metadata.ownerReferences[?(@.kind=="Machine")].name
203+
name: Machine
204+
priority: 1
205+
type: string
206+
- description: Azure VM ID
207+
jsonPath: .spec.providerID
208+
name: VM ID
209+
priority: 1
210+
type: string
211+
- description: Azure VM Size
212+
jsonPath: .spec.vmSize
213+
name: VM Size
214+
priority: 1
215+
type: string
216+
name: v1alpha3
188217
schema:
189218
openAPIV3Schema:
190219
description: AzureMachine is the Schema for the azuremachines API

0 commit comments

Comments
 (0)