Add printer columns for Backup and Restore CRDs (#10200)
e2e-test-kind.yaml / extract (push) Failing after 7s
Run the E2E test on kind / get-go-version (push) Failing after 9s
Run the E2E test on kind / build (push) Skipped
Run the E2E test on kind / setup-test-matrix (push) Successful in 3s
Run the E2E test on kind / run-e2e-test (push) Skipped
push.yml / extract (push) Failing after 6s
Main CI / get-go-version (push) Failing after 7s
Main CI / Build (push) Skipped

* Add printer columns for Backup and Restore CRDs

kubectl get backup and kubectl get restore fall back to the default
NAME/AGE table because neither type declares printer columns, while
Schedule and BackupStorageLocation do. Anything reading the API without
the velero binary cannot see a backup's phase, error count or timing.

Printer columns were added in #2881 and reverted in #3652 as a
workaround for #3600, a CRD install error that was never root-caused.
Schedule regained columns in 2022 and BackupStorageLocation has them
today, with no recurrence.

Only fields expressible as plain JSONPath are included. Expiration is
deliberately omitted: kubectl renders a date column as time elapsed,
so a future expiration prints <invalid>, which covers every backup that
has not yet expired.

Fixes #10199

Signed-off-by: saral <ilovegojo2580@gmail.com>

* Rename changelog name to pass changelog check

Signed-off-by: Tiger Kaovilai <passawit.kaovilai@gmail.com>

---------

Signed-off-by: saral <ilovegojo2580@gmail.com>
Signed-off-by: Tiger Kaovilai <passawit.kaovilai@gmail.com>
Co-authored-by: Tiger Kaovilai <passawit.kaovilai@gmail.com>
This commit is contained in:
Ralthos
2026-08-11 16:58:19 +00:00
committed by GitHub
co-authored by Tiger Kaovilai
parent 3da77b9469
commit ae1d869c77
6 changed files with 57 additions and 4 deletions
+1
View File
@@ -0,0 +1 @@
Add printer columns for Backup and Restore CRDs so kubectl shows status, errors, warnings and timing
+22 -1
View File
@@ -16,7 +16,27 @@ spec:
singular: backup
scope: Namespaced
versions:
- name: v1
- additionalPrinterColumns:
- description: Backup status such as New/InProgress
jsonPath: .status.phase
name: Status
type: string
- description: Total number of errors logged during the backup
jsonPath: .status.errors
name: Errors
type: integer
- description: Total number of warnings logged during the backup
jsonPath: .status.warnings
name: Warnings
type: integer
- description: The time the backup was started
jsonPath: .status.startTimestamp
name: Started
type: date
- jsonPath: .metadata.creationTimestamp
name: Age
type: date
name: v1
schema:
openAPIV3Schema:
description: |-
@@ -688,3 +708,4 @@ spec:
type: object
served: true
storage: true
subresources: {}
+22 -1
View File
@@ -16,7 +16,27 @@ spec:
singular: restore
scope: Namespaced
versions:
- name: v1
- additionalPrinterColumns:
- description: The name of the backup this restore is from
jsonPath: .spec.backupName
name: Backup
type: string
- description: Restore status such as New/InProgress
jsonPath: .status.phase
name: Status
type: string
- description: Total number of errors logged during the restore
jsonPath: .status.errors
name: Errors
type: integer
- description: Total number of warnings logged during the restore
jsonPath: .status.warnings
name: Warnings
type: integer
- jsonPath: .metadata.creationTimestamp
name: Age
type: date
name: v1
schema:
openAPIV3Schema:
description: |-
@@ -597,3 +617,4 @@ spec:
type: object
served: true
storage: true
subresources: {}
File diff suppressed because one or more lines are too long
+5
View File
@@ -520,6 +520,11 @@ type HookStatus struct {
// +kubebuilder:rbac:groups=velero.io,resources=backups,verbs=create;delete;get;list;patch;update;watch
// +kubebuilder:rbac:groups=velero.io,resources=backups/status,verbs=get;update;patch
// +kubebuilder:resource:shortName=bak
// +kubebuilder:printcolumn:name="Status",type="string",JSONPath=".status.phase",description="Backup status such as New/InProgress"
// +kubebuilder:printcolumn:name="Errors",type="integer",JSONPath=".status.errors",description="Total number of errors logged during the backup"
// +kubebuilder:printcolumn:name="Warnings",type="integer",JSONPath=".status.warnings",description="Total number of warnings logged during the backup"
// +kubebuilder:printcolumn:name="Started",type="date",JSONPath=".status.startTimestamp",description="The time the backup was started"
// +kubebuilder:printcolumn:name="Age",type="date",JSONPath=".metadata.creationTimestamp"
// Backup is a Velero resource that represents the capture of Kubernetes
// cluster state at a point in time (API objects and associated volume state).
+5
View File
@@ -420,6 +420,11 @@ type RestoreProgress struct {
// +kubebuilder:rbac:groups=velero.io,resources=restores,verbs=create;delete;get;list;patch;update;watch
// +kubebuilder:rbac:groups=velero.io,resources=restores/status,verbs=get;update;patch
// +kubebuilder:resource:shortName=rst
// +kubebuilder:printcolumn:name="Backup",type="string",JSONPath=".spec.backupName",description="The name of the backup this restore is from"
// +kubebuilder:printcolumn:name="Status",type="string",JSONPath=".status.phase",description="Restore status such as New/InProgress"
// +kubebuilder:printcolumn:name="Errors",type="integer",JSONPath=".status.errors",description="Total number of errors logged during the restore"
// +kubebuilder:printcolumn:name="Warnings",type="integer",JSONPath=".status.warnings",description="Total number of warnings logged during the restore"
// +kubebuilder:printcolumn:name="Age",type="date",JSONPath=".metadata.creationTimestamp"
// Restore is a Velero resource that represents the application of
// resources from a Velero backup to a target Kubernetes cluster.