Skip to content

Commit 430bac0

Browse files
authored
Enhance the print column for powervs resources (#777)
1 parent adfe632 commit 430bac0

File tree

4 files changed

+58
-7
lines changed

4 files changed

+58
-7
lines changed

api/v1beta1/ibmpowervscluster_types.go

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,14 @@ type IBMPowerVSClusterStatus struct {
5353
Ready bool `json:"ready"`
5454
}
5555

56-
//+kubebuilder:object:root=true
57-
//+kubebuilder:subresource:status
58-
//+kubebuilder:storageversion
56+
// +kubebuilder:object:root=true
57+
// +kubebuilder:subresource:status
58+
// +kubebuilder:storageversion
59+
// +kubebuilder:printcolumn:name="Cluster",type="string",JSONPath=".metadata.labels.cluster\\.x-k8s\\.io/cluster-name",description="Cluster to which this IBMPowerVSCluster belongs"
60+
// +kubebuilder:printcolumn:name="Age",type="date",JSONPath=".metadata.creationTimestamp",description="Time duration since creation of IBMPowerVSCluster"
61+
// +kubebuilder:printcolumn:name="PowerVS Cloud Instance ID",type="string",priority=1,JSONPath=".spec.serviceInstanceID"
62+
// +kubebuilder:printcolumn:name="Endpoint",type="string",priority=1,JSONPath=".spec.controlPlaneEndpoint.host",description="Control Plane Endpoint"
63+
// +kubebuilder:printcolumn:name="Port",type="string",priority=1,JSONPath=".spec.controlPlaneEndpoint.port",description="Control Plane Port"
5964

6065
// IBMPowerVSCluster is the Schema for the ibmpowervsclusters API.
6166
type IBMPowerVSCluster struct {

api/v1beta1/ibmpowervsmachine_types.go

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -167,11 +167,15 @@ type IBMPowerVSMachineStatus struct {
167167
Zone *string `json:"zone,omitempty"`
168168
}
169169

170-
//+kubebuilder:object:root=true
171-
//+kubebuilder:subresource:status
172-
//+kubebuilder:storageversion
170+
// +kubebuilder:object:root=true
171+
// +kubebuilder:subresource:status
172+
// +kubebuilder:storageversion
173173
// +kubebuilder:printcolumn:name="Cluster",type="string",JSONPath=".metadata.labels.cluster\\.x-k8s\\.io/cluster-name",description="Cluster to which this IBMPowerVSMachine belongs"
174+
// +kubebuilder:printcolumn:name="Machine",type="string",priority=1,JSONPath=".metadata.ownerReferences[?(@.kind==\"Machine\")].name",description="Machine object to which this IBMPowerVSMachine belongs"
175+
// +kubebuilder:printcolumn:name="Age",type="date",JSONPath=".metadata.creationTimestamp",description="Time duration since creation of IBMPowerVSMachine"
174176
// +kubebuilder:printcolumn:name="Ready",type="string",JSONPath=".status.ready",description="Cluster infrastructure is ready for IBM PowerVS instances"
177+
// +kubebuilder:printcolumn:name="Internal-IP",type="string",priority=1,JSONPath=".status.addresses[?(@.type==\"InternalIP\")].address",description="Instance Internal Addresses"
178+
// +kubebuilder:printcolumn:name="External-IP",type="string",priority=1,JSONPath=".status.addresses[?(@.type==\"ExternalIP\")].address",description="Instance External Addresses"
175179
// +kubebuilder:printcolumn:name="State",type="string",JSONPath=".status.instanceState",description="PowerVS instance state"
176180
// +kubebuilder:printcolumn:name="Health",type="string",JSONPath=".status.health",description="PowerVS instance health"
177181

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

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,30 @@ spec:
8585
storage: false
8686
subresources:
8787
status: {}
88-
- name: v1beta1
88+
- additionalPrinterColumns:
89+
- description: Cluster to which this IBMPowerVSCluster belongs
90+
jsonPath: .metadata.labels.cluster\.x-k8s\.io/cluster-name
91+
name: Cluster
92+
type: string
93+
- description: Time duration since creation of IBMPowerVSCluster
94+
jsonPath: .metadata.creationTimestamp
95+
name: Age
96+
type: date
97+
- jsonPath: .spec.serviceInstanceID
98+
name: PowerVS Cloud Instance ID
99+
priority: 1
100+
type: string
101+
- description: Control Plane Endpoint
102+
jsonPath: .spec.controlPlaneEndpoint.host
103+
name: Endpoint
104+
priority: 1
105+
type: string
106+
- description: Control Plane Port
107+
jsonPath: .spec.controlPlaneEndpoint.port
108+
name: Port
109+
priority: 1
110+
type: string
111+
name: v1beta1
89112
schema:
90113
openAPIV3Schema:
91114
description: IBMPowerVSCluster is the Schema for the ibmpowervsclusters API.

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

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,10 +155,29 @@ spec:
155155
jsonPath: .metadata.labels.cluster\.x-k8s\.io/cluster-name
156156
name: Cluster
157157
type: string
158+
- description: Machine object to which this IBMPowerVSMachine belongs
159+
jsonPath: .metadata.ownerReferences[?(@.kind=="Machine")].name
160+
name: Machine
161+
priority: 1
162+
type: string
163+
- description: Time duration since creation of IBMPowerVSMachine
164+
jsonPath: .metadata.creationTimestamp
165+
name: Age
166+
type: date
158167
- description: Cluster infrastructure is ready for IBM PowerVS instances
159168
jsonPath: .status.ready
160169
name: Ready
161170
type: string
171+
- description: Instance Internal Addresses
172+
jsonPath: .status.addresses[?(@.type=="InternalIP")].address
173+
name: Internal-IP
174+
priority: 1
175+
type: string
176+
- description: Instance External Addresses
177+
jsonPath: .status.addresses[?(@.type=="ExternalIP")].address
178+
name: External-IP
179+
priority: 1
180+
type: string
162181
- description: PowerVS instance state
163182
jsonPath: .status.instanceState
164183
name: State

0 commit comments

Comments
 (0)