Skip to content

Commit 51817d6

Browse files
authored
Merge pull request #787 from lukas8219/5411-kubectl-cosmetics
Add better kubectl columns to ImageRepository and ImagePolicy
2 parents 05a6e55 + c4ddb04 commit 51817d6

File tree

4 files changed

+39
-6
lines changed

4 files changed

+39
-6
lines changed

api/v1beta2/imagepolicy_types.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,11 @@ func (in *ImagePolicy) SetConditions(conditions []metav1.Condition) {
206206
// +kubebuilder:object:root=true
207207
// +kubebuilder:subresource:status
208208
// +kubebuilder:resource:shortName=imgpol;imagepol
209-
// +kubebuilder:printcolumn:name="LatestImage",type=string,JSONPath=`.status.latestImage`
209+
// +kubebuilder:printcolumn:name="Image",type=string,JSONPath=`.status.latestRef.name`
210+
// +kubebuilder:printcolumn:name="Tag",type=string,JSONPath=`.status.latestRef.tag`
211+
// +kubebuilder:printcolumn:name="Ready",type="string",JSONPath=".status.conditions[?(@.type==\"Ready\")].status",description=""
212+
// +kubebuilder:printcolumn:name="Status",type="string",JSONPath=".status.conditions[?(@.type==\"Ready\")].message",description=""
213+
// +kubebuilder:printcolumn:name="Age",type="date",JSONPath=".metadata.creationTimestamp",description=""
210214

211215
// ImagePolicy is the Schema for the imagepolicies API
212216
type ImagePolicy struct {

api/v1beta2/imagerepository_types.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -215,8 +215,12 @@ func (in ImageRepository) GetRequeueAfter() time.Duration {
215215
// +kubebuilder:object:root=true
216216
// +kubebuilder:subresource:status
217217
// +kubebuilder:resource:shortName=imgrepo;imagerepo
218-
// +kubebuilder:printcolumn:name="Last scan",type=string,JSONPath=`.status.lastScanResult.scanTime`
218+
// +kubebuilder:printcolumn:name="Image",type="string",JSONPath=".spec.image"
219219
// +kubebuilder:printcolumn:name="Tags",type=string,JSONPath=`.status.lastScanResult.tagCount`
220+
// +kubebuilder:printcolumn:name="Ready",type="string",JSONPath=".status.conditions[?(@.type==\"Ready\")].status",description=""
221+
// +kubebuilder:printcolumn:name="Status",type="string",JSONPath=".status.conditions[?(@.type==\"Ready\")].message",description=""
222+
// +kubebuilder:printcolumn:name="Last scan",type=string,JSONPath=`.status.lastScanResult.scanTime`,priority=1
223+
// +kubebuilder:printcolumn:name="Age",type="date",JSONPath=".metadata.creationTimestamp",description=""
220224

221225
// ImageRepository is the Schema for the imagerepositories API
222226
type ImageRepository struct {

config/crd/bases/image.toolkit.fluxcd.io_imagepolicies.yaml

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -210,9 +210,21 @@ spec:
210210
subresources:
211211
status: {}
212212
- additionalPrinterColumns:
213-
- jsonPath: .status.latestImage
214-
name: LatestImage
213+
- jsonPath: .status.latestRef.name
214+
name: Image
215+
type: string
216+
- jsonPath: .status.latestRef.tag
217+
name: Tag
218+
type: string
219+
- jsonPath: .status.conditions[?(@.type=="Ready")].status
220+
name: Ready
221+
type: string
222+
- jsonPath: .status.conditions[?(@.type=="Ready")].message
223+
name: Status
215224
type: string
225+
- jsonPath: .metadata.creationTimestamp
226+
name: Age
227+
type: date
216228
name: v1beta2
217229
schema:
218230
openAPIV3Schema:

config/crd/bases/image.toolkit.fluxcd.io_imagerepositories.yaml

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -243,12 +243,25 @@ spec:
243243
subresources:
244244
status: {}
245245
- additionalPrinterColumns:
246-
- jsonPath: .status.lastScanResult.scanTime
247-
name: Last scan
246+
- jsonPath: .spec.image
247+
name: Image
248248
type: string
249249
- jsonPath: .status.lastScanResult.tagCount
250250
name: Tags
251251
type: string
252+
- jsonPath: .status.conditions[?(@.type=="Ready")].status
253+
name: Ready
254+
type: string
255+
- jsonPath: .status.conditions[?(@.type=="Ready")].message
256+
name: Status
257+
type: string
258+
- jsonPath: .status.lastScanResult.scanTime
259+
name: Last scan
260+
priority: 1
261+
type: string
262+
- jsonPath: .metadata.creationTimestamp
263+
name: Age
264+
type: date
252265
name: v1beta2
253266
schema:
254267
openAPIV3Schema:

0 commit comments

Comments
 (0)