Skip to content

Commit 6bda277

Browse files
authored
Add support for kubectl printer columns (#1421)
Unless we add another `.status` field, this is what we can do. Only simple queries starting with `.` can be used. Signed-off-by: Todd Short <[email protected]>
1 parent cfd4bec commit 6bda277

File tree

2 files changed

+22
-1
lines changed

2 files changed

+22
-1
lines changed

api/v1alpha1/clusterextension_types.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -510,6 +510,11 @@ type ClusterExtensionInstallStatus struct {
510510
//+kubebuilder:object:root=true
511511
//+kubebuilder:resource:scope=Cluster
512512
//+kubebuilder:subresource:status
513+
//+kubebuilder:printcolumn:name="Installed Bundle",type=string,JSONPath=`.status.install.bundle.name`
514+
//+kubebuilder:printcolumn:name=Version,type=string,JSONPath=`.status.install.bundle.version`
515+
//+kubebuilder:printcolumn:name="Installed",type=string,JSONPath=`.status.conditions[?(@.type=='Installed')].status`
516+
//+kubebuilder:printcolumn:name="Progressing",type=string,JSONPath=`.status.conditions[?(@.type=='Progressing')].status`
517+
//+kubebuilder:printcolumn:name=Age,type=date,JSONPath=`.metadata.creationTimestamp`
513518

514519
// ClusterExtension is the Schema for the clusterextensions API
515520
type ClusterExtension struct {

config/base/crd/bases/olm.operatorframework.io_clusterextensions.yaml

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,23 @@ spec:
1414
singular: clusterextension
1515
scope: Cluster
1616
versions:
17-
- name: v1alpha1
17+
- additionalPrinterColumns:
18+
- jsonPath: .status.install.bundle.name
19+
name: Installed Bundle
20+
type: string
21+
- jsonPath: .status.install.bundle.version
22+
name: Version
23+
type: string
24+
- jsonPath: .status.conditions[?(@.type=='Installed')].status
25+
name: Installed
26+
type: string
27+
- jsonPath: .status.conditions[?(@.type=='Progressing')].status
28+
name: Progressing
29+
type: string
30+
- jsonPath: .metadata.creationTimestamp
31+
name: Age
32+
type: date
33+
name: v1alpha1
1834
schema:
1935
openAPIV3Schema:
2036
description: ClusterExtension is the Schema for the clusterextensions API

0 commit comments

Comments
 (0)