Add additional printer columns for CRDs (#2881)

This change modifies the kubebuilder annotations for the Velero CRDs to
include `additionalPrinterColumns` so that more information is exposed
when using `kubectl get`.

For each of the CRDs, annotations have been added to make the output
for `kubectl get` match the output from the equivalent `velero get`
command as closely as possible. There are some cases where this output
could not be replicated, such as the `EXPIRES` column for Backups, due
to the limitations of JSONPath expressions within the resulting CRD
defition. Some columns undergo processing and formatting before being
printed by the Velero CLI which cannot be replicated using JSONPath. In
these cases, these printer columns have been omitted.

For other CRDs where there is no `velero get` equivalent, such as
`PodVolumeBackup` and `PodVolumeRestore`, a best effort has been made to
expose information that provides value.

Signed-off-by: Bridget McErlean <bmcerlean@vmware.com>
This commit is contained in:
Bridget McErlean
2020-10-27 18:19:33 -04:00
committed by GitHub
parent 0487a21c84
commit 4178d9de32
24 changed files with 274 additions and 11 deletions

View File

@@ -0,0 +1 @@
Add additional printer columns for Velero CRDs to allow more information to be exposed when using `kubectl get`.

View File

@@ -8,6 +8,32 @@ metadata:
creationTimestamp: null
name: backups.velero.io
spec:
additionalPrinterColumns:
- JSONPath: .status.phase
description: Backup status such as InProgress/Completed
name: Status
type: string
- JSONPath: .status.errors
description: Count of all error messages that were generated during execution
of this backup
name: Errors
type: integer
- JSONPath: .status.warnings
description: Count of all warning messages that were generated during execution
of this backup
name: Warnings
type: integer
- JSONPath: .status.startTimestamp
description: Time when this backup was started
name: Created
type: date
- JSONPath: .spec.storageLocation
description: Name of the Backup Storage Location where this backup should be stored
name: Storage Location
type: string
- JSONPath: .metadata.creationTimestamp
name: Age
type: date
group: velero.io
names:
kind: Backup
@@ -16,6 +42,7 @@ spec:
singular: backup
preserveUnknownFields: false
scope: Namespaced
subresources: {}
validation:
openAPIV3Schema:
description: Backup is a Velero resource that respresents the capture of Kubernetes

View File

@@ -9,6 +9,14 @@ metadata:
name: backupstoragelocations.velero.io
spec:
additionalPrinterColumns:
- JSONPath: .spec.provider
description: Provider of the backup storage
name: Provider
type: string
- JSONPath: .spec.objectStorage.bucket
description: Bucket to use for object storage
name: Bucket
type: string
- JSONPath: .status.phase
description: Backup Storage Location status such as Available/Unavailable
name: Phase
@@ -18,6 +26,10 @@ spec:
validated
name: Last Validated
type: date
- JSONPath: .spec.accessMode
description: Permissions for the backup storage location
name: Access Mode
type: string
- JSONPath: .metadata.creationTimestamp
name: Age
type: date

View File

@@ -8,6 +8,18 @@ metadata:
creationTimestamp: null
name: deletebackuprequests.velero.io
spec:
additionalPrinterColumns:
- JSONPath: .status.phase
description: Delete Backup Request status such as InProgress/Processed
name: Status
type: string
- JSONPath: .spec.backupName
description: Name of backup to be deleted
name: Backup Name
type: string
- JSONPath: .metadata.creationTimestamp
name: Age
type: date
group: velero.io
names:
kind: DeleteBackupRequest
@@ -16,6 +28,7 @@ spec:
singular: deletebackuprequest
preserveUnknownFields: false
scope: Namespaced
subresources: {}
validation:
openAPIV3Schema:
description: DeleteBackupRequest is a request to delete one or more backups.

View File

@@ -8,6 +8,22 @@ metadata:
creationTimestamp: null
name: downloadrequests.velero.io
spec:
additionalPrinterColumns:
- JSONPath: .status.phase
description: DownloadRequest status such as New/Processed
name: Status
type: string
- JSONPath: .spec.target.name
description: Name of the associated Kubernetes resource
name: Target Name
type: string
- JSONPath: .spec.target.kind
description: Type of file to download
name: Target Kind
type: string
- JSONPath: .metadata.creationTimestamp
name: Age
type: date
group: velero.io
names:
kind: DownloadRequest
@@ -16,6 +32,7 @@ spec:
singular: downloadrequest
preserveUnknownFields: false
scope: Namespaced
subresources: {}
validation:
openAPIV3Schema:
description: DownloadRequest is a request to download an artifact from backup

View File

@@ -8,6 +8,38 @@ metadata:
creationTimestamp: null
name: podvolumebackups.velero.io
spec:
additionalPrinterColumns:
- JSONPath: .status.phase
description: Pod Volume Backup status such as New/InProgress
name: Status
type: string
- JSONPath: .status.startTimestamp
description: Time when this backup was started
name: Created
type: date
- JSONPath: .spec.pod.namespace
description: Namespace of the pod containing the volume to be backed up
name: Namespace
type: string
- JSONPath: .spec.pod.name
description: Name of the pod containing the volume to be backed up
name: Pod
type: string
- JSONPath: .spec.volume
description: Name of the volume to be backed up
name: Volume
type: string
- JSONPath: .spec.repoIdentifier
description: Restic repository identifier for this backup
name: Restic Repo
type: string
- JSONPath: .spec.backupStorageLocation
description: Name of the Backup Storage Location where this backup should be stored
name: Storage Location
type: string
- JSONPath: .metadata.creationTimestamp
name: Age
type: date
group: velero.io
names:
kind: PodVolumeBackup
@@ -16,6 +48,7 @@ spec:
singular: podvolumebackup
preserveUnknownFields: false
scope: Namespaced
subresources: {}
validation:
openAPIV3Schema:
properties:

View File

@@ -8,6 +8,42 @@ metadata:
creationTimestamp: null
name: podvolumerestores.velero.io
spec:
additionalPrinterColumns:
- JSONPath: .status.phase
description: Restore status such as InProgress/Completed
name: Status
type: string
- JSONPath: .spec.pod.namespace
description: Namespace of pod containing the volume to be restored
name: Namespace
type: string
- JSONPath: .spec.pod.name
description: Name of pod containing the volume to be restored
name: Pod
type: string
- JSONPath: .spec.volume
description: Name of volume to restore
name: Volume
type: string
- JSONPath: .status.progress.bytesDone
description: Number of bytes restored
name: Bytes Done
type: string
- JSONPath: .status.progress.totalBytes
description: Total number of bytes to be restored
name: Total Bytes
type: string
- JSONPath: .status.startTimestamp
description: Time when the restore operation was started
name: Started
type: date
- JSONPath: .status.completionTimestamp
description: Time when the restore operation was completed
name: Completed
type: date
- JSONPath: .metadata.creationTimestamp
name: Age
type: date
group: velero.io
names:
kind: PodVolumeRestore
@@ -16,6 +52,7 @@ spec:
singular: podvolumerestore
preserveUnknownFields: false
scope: Namespaced
subresources: {}
validation:
openAPIV3Schema:
properties:

View File

@@ -8,6 +8,15 @@ metadata:
creationTimestamp: null
name: resticrepositories.velero.io
spec:
additionalPrinterColumns:
- JSONPath: .status.phase
description: Restic Repository status such as New/Ready
name: Status
type: string
- JSONPath: .status.lastMaintenanceTime
description: Last time maintenance was run
name: Last Maintenance
type: date
group: velero.io
names:
kind: ResticRepository
@@ -16,6 +25,7 @@ spec:
singular: resticrepository
preserveUnknownFields: false
scope: Namespaced
subresources: {}
validation:
openAPIV3Schema:
properties:

View File

@@ -6,6 +6,34 @@ metadata:
creationTimestamp: null
name: restores.velero.io
spec:
additionalPrinterColumns:
- JSONPath: .spec.backupName
description: Name of backup to restore from
name: Backup
type: string
- JSONPath: .status.phase
description: Restore status such as InProgress/Completed
name: Status
type: string
- JSONPath: .status.startTimestamp
description: Time when the restore operation was started
name: Started
type: date
- JSONPath: .status.completionTimestamp
description: Time when the restore operation was completed
name: Completed
type: date
- JSONPath: .status.errors
description: Count of all errors generated during the restore
name: Errors
type: integer
- JSONPath: .status.warnings
description: Count of all warnings generated during the restore
name: Warnings
type: integer
- JSONPath: .metadata.creationTimestamp
name: Age
type: date
group: velero.io
names:
kind: Restore
@@ -14,6 +42,7 @@ spec:
singular: restore
preserveUnknownFields: false
scope: Namespaced
subresources: {}
validation:
openAPIV3Schema:
description: Restore is a Velero resource that represents the application of

View File

@@ -8,6 +8,26 @@ metadata:
creationTimestamp: null
name: schedules.velero.io
spec:
additionalPrinterColumns:
- JSONPath: .status.phase
description: Schedule status such as New/Enabled
name: Status
type: string
- JSONPath: .spec.schedule
description: Cron expression defining when to run the backup
name: Schedule
type: string
- JSONPath: .spec.template.ttl
description: How long the backups should be retained for
name: Backup TTL
type: string
- JSONPath: .status.lastBackup
description: Last time a backup was run for this schedule
name: Last Backup
type: date
- JSONPath: .metadata.creationTimestamp
name: Age
type: date
group: velero.io
names:
kind: Schedule
@@ -16,6 +36,7 @@ spec:
singular: schedule
preserveUnknownFields: false
scope: Namespaced
subresources: {}
validation:
openAPIV3Schema:
description: Schedule is a Velero resource that represents a pre-scheduled or

View File

@@ -8,6 +8,11 @@ metadata:
creationTimestamp: null
name: serverstatusrequests.velero.io
spec:
additionalPrinterColumns:
- JSONPath: .status.phase
description: Server Status Request status such as New/Processed
name: Status
type: string
group: velero.io
names:
kind: ServerStatusRequest

View File

@@ -8,6 +8,13 @@ metadata:
creationTimestamp: null
name: volumesnapshotlocations.velero.io
spec:
additionalPrinterColumns:
- JSONPath: .spec.provider
name: Provider
type: string
- JSONPath: .metadata.creationTimestamp
name: Age
type: date
group: velero.io
names:
kind: VolumeSnapshotLocation
@@ -16,6 +23,7 @@ spec:
singular: volumesnapshotlocation
preserveUnknownFields: false
scope: Namespaced
subresources: {}
validation:
openAPIV3Schema:
description: VolumeSnapshotLocation is a location where Velero stores volume

File diff suppressed because one or more lines are too long

View File

@@ -312,6 +312,12 @@ type BackupProgress struct {
// +genclient
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
// +kubebuilder:printcolumn:name="Status",type="string",JSONPath=".status.phase",description="Backup status such as InProgress/Completed"
// +kubebuilder:printcolumn:name="Errors",type="integer",JSONPath=".status.errors",description="Count of all error messages that were generated during execution of this backup"
// +kubebuilder:printcolumn:name="Warnings",type="integer",JSONPath=".status.warnings",description="Count of all warning messages that were generated during execution of this backup"
// +kubebuilder:printcolumn:name="Created",type="date",JSONPath=".status.startTimestamp",description="Time when this backup was started"
// +kubebuilder:printcolumn:name="Storage Location",type="string",JSONPath=".spec.storageLocation",description="Name of the Backup Storage Location where this backup should be stored"
// +kubebuilder:printcolumn:name="Age",type="date",JSONPath=".metadata.creationTimestamp"
// Backup is a Velero resource that respresents the capture of Kubernetes
// cluster state at a point in time (API objects and associated volume state).

View File

@@ -90,8 +90,11 @@ type BackupStorageLocationStatus struct {
// +kubebuilder:object:generate=true
// +kubebuilder:storageversion
// +kubebuilder:subresource:status
// +kubebuilder:printcolumn:name="Provider",type="string",JSONPath=".spec.provider",description="Provider of the backup storage"
// +kubebuilder:printcolumn:name="Bucket",type="string",JSONPath=".spec.objectStorage.bucket",description="Bucket to use for object storage"
// +kubebuilder:printcolumn:name="Phase",type="string",JSONPath=".status.phase",description="Backup Storage Location status such as Available/Unavailable"
// +kubebuilder:printcolumn:name="Last Validated",type="date",JSONPath=".status.lastValidationTime",description="LastValidationTime is the last time the backup store location was validated"
// +kubebuilder:printcolumn:name="Access Mode",type="string",JSONPath=".spec.accessMode",description="Permissions for the backup storage location"
// +kubebuilder:printcolumn:name="Age",type="date",JSONPath=".metadata.creationTimestamp"
// BackupStorageLocation is a location where Velero stores backup objects

View File

@@ -52,6 +52,9 @@ type DeleteBackupRequestStatus struct {
// +genclient
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
// +kubebuilder:printcolumn:name="Status",type="string",JSONPath=".status.phase",description="Delete Backup Request status such as InProgress/Processed"
// +kubebuilder:printcolumn:name="Backup Name",type="string",JSONPath=".spec.backupName",description="Name of backup to be deleted"
// +kubebuilder:printcolumn:name="Age",type="date",JSONPath=".metadata.creationTimestamp"
// DeleteBackupRequest is a request to delete one or more backups.
type DeleteBackupRequest struct {

View File

@@ -79,6 +79,10 @@ type DownloadRequestStatus struct {
// +genclient
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
// +kubebuilder:printcolumn:name="Status",type="string",JSONPath=".status.phase",description="DownloadRequest status such as New/Processed"
// +kubebuilder:printcolumn:name="Target Name",type="string",JSONPath=".spec.target.name",description="Name of the associated Kubernetes resource"
// +kubebuilder:printcolumn:name="Target Kind",type="string",JSONPath=".spec.target.kind",description="Type of file to download"
// +kubebuilder:printcolumn:name="Age",type="date",JSONPath=".metadata.creationTimestamp"
// DownloadRequest is a request to download an artifact from backup object storage, such as a backup
// log file.

View File

@@ -100,6 +100,14 @@ type PodVolumeBackupStatus struct {
// +genclient
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
// +kubebuilder:printcolumn:name="Status",type="string",JSONPath=".status.phase",description="Pod Volume Backup status such as New/InProgress"
// +kubebuilder:printcolumn:name="Created",type="date",JSONPath=".status.startTimestamp",description="Time when this backup was started"
// +kubebuilder:printcolumn:name="Namespace",type="string",JSONPath=".spec.pod.namespace",description="Namespace of the pod containing the volume to be backed up"
// +kubebuilder:printcolumn:name="Pod",type="string",JSONPath=".spec.pod.name",description="Name of the pod containing the volume to be backed up"
// +kubebuilder:printcolumn:name="Volume",type="string",JSONPath=".spec.volume",description="Name of the volume to be backed up"
// +kubebuilder:printcolumn:name="Restic Repo",type="string",JSONPath=".spec.repoIdentifier",description="Restic repository identifier for this backup"
// +kubebuilder:printcolumn:name="Storage Location",type="string",JSONPath=".spec.backupStorageLocation",description="Name of the Backup Storage Location where this backup should be stored"
// +kubebuilder:printcolumn:name="Age",type="date",JSONPath=".metadata.creationTimestamp"
type PodVolumeBackup struct {
metav1.TypeMeta `json:",inline"`

View File

@@ -83,6 +83,15 @@ type PodVolumeRestoreStatus struct {
// +genclient
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
// +kubebuilder:printcolumn:name="Status",type="string",JSONPath=".status.phase",description="Restore status such as InProgress/Completed"
// +kubebuilder:printcolumn:name="Namespace",type="string",JSONPath=".spec.pod.namespace",description="Namespace of pod containing the volume to be restored"
// +kubebuilder:printcolumn:name="Pod",type="string",JSONPath=".spec.pod.name",description="Name of pod containing the volume to be restored"
// +kubebuilder:printcolumn:name="Volume",type="string",JSONPath=".spec.volume",description="Name of volume to restore"
// +kubebuilder:printcolumn:name="Bytes Done",type="string",JSONPath=".status.progress.bytesDone",description="Number of bytes restored"
// +kubebuilder:printcolumn:name="Total Bytes",type="string",JSONPath=".status.progress.totalBytes",description="Total number of bytes to be restored"
// +kubebuilder:printcolumn:name="Started",type="date",JSONPath=".status.startTimestamp",description="Time when the restore operation was started"
// +kubebuilder:printcolumn:name="Completed",type="date",JSONPath=".status.completionTimestamp",description="Time when the restore operation was completed"
// +kubebuilder:printcolumn:name="Age",type="date",JSONPath=".metadata.creationTimestamp"
type PodVolumeRestore struct {
metav1.TypeMeta `json:",inline"`

View File

@@ -66,6 +66,8 @@ type ResticRepositoryStatus struct {
// +genclient
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
// +kubebuilder:printcolumn:name="Status",type="string",JSONPath=".status.phase",description="Restic Repository status such as New/Ready"
// +kubebuilder:printcolumn:name="Last Maintenance",type="date",JSONPath=".status.lastMaintenanceTime",description="Last time maintenance was run"
type ResticRepository struct {
metav1.TypeMeta `json:",inline"`

View File

@@ -251,6 +251,13 @@ type RestoreStatus struct {
// +genclient
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
// +kubebuilder:printcolumn:name="Backup",type="string",JSONPath=".spec.backupName",description="Name of backup to restore from"
// +kubebuilder:printcolumn:name="Status",type="string",JSONPath=".status.phase",description="Restore status such as InProgress/Completed"
// +kubebuilder:printcolumn:name="Started",type="date",JSONPath=".status.startTimestamp",description="Time when the restore operation was started"
// +kubebuilder:printcolumn:name="Completed",type="date",JSONPath=".status.completionTimestamp",description="Time when the restore operation was completed"
// +kubebuilder:printcolumn:name="Errors",type="integer",JSONPath=".status.errors",description="Count of all errors generated during the restore"
// +kubebuilder:printcolumn:name="Warnings",type="integer",JSONPath=".status.warnings",description="Count of all warnings generated 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.

View File

@@ -73,6 +73,11 @@ type ScheduleStatus struct {
// +genclient
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
// +kubebuilder:printcolumn:name="Status",type="string",JSONPath=".status.phase",description="Schedule status such as New/Enabled"
// +kubebuilder:printcolumn:name="Schedule",type="string",JSONPath=".spec.schedule",description="Cron expression defining when to run the backup"
// +kubebuilder:printcolumn:name="Backup TTL",type="string",JSONPath=".spec.template.ttl",description="How long the backups should be retained for"
// +kubebuilder:printcolumn:name="Last Backup",type="date",JSONPath=".status.lastBackup",description="Last time a backup was run for this schedule"
// +kubebuilder:printcolumn:name="Age",type="date",JSONPath=".metadata.creationTimestamp"
// Schedule is a Velero resource that represents a pre-scheduled or
// periodic Backup that should be run.

View File

@@ -29,6 +29,7 @@ import (
// +kubebuilder:object:generate=true
// +kubebuilder:storageversion
// +kubebuilder:subresource:status
// +kubebuilder:printcolumn:name="Status",type="string",JSONPath=".status.phase",description="Server Status Request status such as New/Processed"
// ServerStatusRequest is a request to access current status information about
// the Velero server.

View File

@@ -20,6 +20,8 @@ import metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
// +genclient
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
// +kubebuilder:printcolumn:name="Provider",type="string",JSONPath=".spec.provider"
// +kubebuilder:printcolumn:name="Age",type="date",JSONPath=".metadata.creationTimestamp"
// VolumeSnapshotLocation is a location where Velero stores volume snapshots.
type VolumeSnapshotLocation struct {