Skip to content

Commit c02c0ec

Browse files
authored
Add custom columns for capms resources (#45)
1 parent 53cb305 commit c02c0ec

6 files changed

+94
-3
lines changed

api/v1alpha1/metalstackcluster_types.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,13 @@ type MetalStackClusterStatus struct {
106106

107107
// +kubebuilder:object:root=true
108108
// +kubebuilder:subresource:status
109+
// +kubebuilder:printcolumn:name="Cluster",type="string",JSONPath=".metadata.labels.cluster\\.x-k8s\\.io/cluster-name",description="Cluster to which this MetalStackCluster belongs"
110+
// +kubebuilder:printcolumn:name="Endpoint",type="string",JSONPath=".spec.controlPlaneEndpoint.host",description="Control plane API endpoint"
111+
// +kubebuilder:printcolumn:name="Partition",type="string",priority=1,JSONPath=".spec.partition",description="The partition within metal-stack"
112+
// +kubebuilder:printcolumn:name="Project",type="string",priority=1,JSONPath=".spec.projectID",description="The project within metal-stack"
113+
// +kubebuilder:printcolumn:name="Network",type="string",priority=1,JSONPath=".status.nodeNetworkID",description="The network within metal-stack"
114+
// +kubebuilder:printcolumn:name="Ready",type="string",JSONPath=".status.ready",description="MetalStackCluster is ready"
115+
// +kubebuilder:printcolumn:name="Age",type="date",JSONPath=".metadata.creationTimestamp",description="Uptime of the cluster"
109116

110117
// MetalStackCluster is the Schema for the metalstackclusters API.
111118
type MetalStackCluster struct {

api/v1alpha1/metalstackmachine_types.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,13 @@ type MetalStackMachineStatus struct {
7272

7373
// +kubebuilder:object:root=true
7474
// +kubebuilder:subresource:status
75+
// +kubebuilder:printcolumn:name="Cluster",type="string",JSONPath=".metadata.labels.cluster\\.x-k8s\\.io/cluster-name",description="Cluster to which this MetalStackMachine belongs"
76+
// +kubebuilder:printcolumn:name="ProviderID",type="string",JSONPath=".spec.providerID",description="ProviderID reference for the MetalStackMachine"
77+
// +kubebuilder:printcolumn:name="Size",type="string",JSONPath=".spec.size",priority=1,description="Size of the MetalStackMachine"
78+
// +kubebuilder:printcolumn:name="Image",type="string",JSONPath=".spec.image",description="OS image of the MetalStackMachine"
79+
// +kubebuilder:printcolumn:name="Ready",type="string",JSONPath=".status.ready",description="MetalStackMachine is ready for worker nodes"
80+
// +kubebuilder:printcolumn:name="Healthy",type="string",JSONPath=".status.conditions[1].status",description="Health of the provider machine"
81+
// +kubebuilder:printcolumn:name="Age",type="date",JSONPath=".metadata.creationTimestamp"
7582

7683
// MetalStackMachine is the Schema for the metalstackmachines API.
7784
type MetalStackMachine struct {

api/v1alpha1/metalstackmachinetemplate_types.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,9 @@ type MetalStackMachineTemplateSpec struct {
2929
}
3030

3131
// +kubebuilder:object:root=true
32+
// +kubebuilder:printcolumn:name="Age",type="date",JSONPath=".metadata.creationTimestamp"
33+
// +kubebuilder:printcolumn:name="Size",type="string",JSONPath=".spec.template.spec.size",description="Size of the MetalStackMachine"
34+
// +kubebuilder:printcolumn:name="Image",type="string",JSONPath=".spec.template.spec.image",description="OS image of the MetalStackMachine"
3235

3336
// MetalStackMachineTemplate is the Schema for the inframachinetemplates API.
3437
type MetalStackMachineTemplate struct {

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

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,39 @@ spec:
1414
singular: metalstackcluster
1515
scope: Namespaced
1616
versions:
17-
- name: v1alpha1
17+
- additionalPrinterColumns:
18+
- description: Cluster to which this MetalStackCluster belongs
19+
jsonPath: .metadata.labels.cluster\.x-k8s\.io/cluster-name
20+
name: Cluster
21+
type: string
22+
- description: Control plane API endpoint
23+
jsonPath: .spec.controlPlaneEndpoint.host
24+
name: Endpoint
25+
type: string
26+
- description: The partition within metal-stack
27+
jsonPath: .spec.partition
28+
name: Partition
29+
priority: 1
30+
type: string
31+
- description: The project within metal-stack
32+
jsonPath: .spec.projectID
33+
name: Project
34+
priority: 1
35+
type: string
36+
- description: The network within metal-stack
37+
jsonPath: .status.nodeNetworkID
38+
name: Network
39+
priority: 1
40+
type: string
41+
- description: MetalStackCluster is ready
42+
jsonPath: .status.ready
43+
name: Ready
44+
type: string
45+
- description: Uptime of the cluster
46+
jsonPath: .metadata.creationTimestamp
47+
name: Age
48+
type: date
49+
name: v1alpha1
1850
schema:
1951
openAPIV3Schema:
2052
description: MetalStackCluster is the Schema for the metalstackclusters API.

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

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,36 @@ spec:
1414
singular: metalstackmachine
1515
scope: Namespaced
1616
versions:
17-
- name: v1alpha1
17+
- additionalPrinterColumns:
18+
- description: Cluster to which this MetalStackMachine belongs
19+
jsonPath: .metadata.labels.cluster\.x-k8s\.io/cluster-name
20+
name: Cluster
21+
type: string
22+
- description: ProviderID reference for the MetalStackMachine
23+
jsonPath: .spec.providerID
24+
name: ProviderID
25+
type: string
26+
- description: Size of the MetalStackMachine
27+
jsonPath: .spec.size
28+
name: Size
29+
priority: 1
30+
type: string
31+
- description: OS image of the MetalStackMachine
32+
jsonPath: .spec.image
33+
name: Image
34+
type: string
35+
- description: MetalStackMachine is ready for worker nodes
36+
jsonPath: .status.ready
37+
name: Ready
38+
type: string
39+
- description: Health of the provider machine
40+
jsonPath: .status.conditions[1].status
41+
name: Healthy
42+
type: string
43+
- jsonPath: .metadata.creationTimestamp
44+
name: Age
45+
type: date
46+
name: v1alpha1
1847
schema:
1948
openAPIV3Schema:
2049
description: MetalStackMachine is the Schema for the metalstackmachines API.

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

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,19 @@ spec:
1414
singular: metalstackmachinetemplate
1515
scope: Namespaced
1616
versions:
17-
- name: v1alpha1
17+
- additionalPrinterColumns:
18+
- jsonPath: .metadata.creationTimestamp
19+
name: Age
20+
type: date
21+
- description: Size of the MetalStackMachine
22+
jsonPath: .spec.template.spec.size
23+
name: Size
24+
type: string
25+
- description: OS image of the MetalStackMachine
26+
jsonPath: .spec.template.spec.image
27+
name: Image
28+
type: string
29+
name: v1alpha1
1830
schema:
1931
openAPIV3Schema:
2032
description: MetalStackMachineTemplate is the Schema for the inframachinetemplates
@@ -175,3 +187,4 @@ spec:
175187
type: object
176188
served: true
177189
storage: true
190+
subresources: {}

0 commit comments

Comments
 (0)