Skip to content

Commit

Permalink
Add additional printer columns for CRDs (vmware-tanzu#2881)
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
zubron authored Oct 27, 2020
1 parent 0487a21 commit 4178d9d
Show file tree
Hide file tree
Showing 24 changed files with 274 additions and 11 deletions.
1 change: 1 addition & 0 deletions changelogs/unreleased/2881-zubron
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Add additional printer columns for Velero CRDs to allow more information to be exposed when using `kubectl get`.
27 changes: 27 additions & 0 deletions config/crd/bases/velero.io_backups.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
12 changes: 12 additions & 0 deletions config/crd/bases/velero.io_backupstoragelocations.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
13 changes: 13 additions & 0 deletions config/crd/bases/velero.io_deletebackuprequests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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.
Expand Down
17 changes: 17 additions & 0 deletions config/crd/bases/velero.io_downloadrequests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
33 changes: 33 additions & 0 deletions config/crd/bases/velero.io_podvolumebackups.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -16,6 +48,7 @@ spec:
singular: podvolumebackup
preserveUnknownFields: false
scope: Namespaced
subresources: {}
validation:
openAPIV3Schema:
properties:
Expand Down
37 changes: 37 additions & 0 deletions config/crd/bases/velero.io_podvolumerestores.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -16,6 +52,7 @@ spec:
singular: podvolumerestore
preserveUnknownFields: false
scope: Namespaced
subresources: {}
validation:
openAPIV3Schema:
properties:
Expand Down
10 changes: 10 additions & 0 deletions config/crd/bases/velero.io_resticrepositories.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -16,6 +25,7 @@ spec:
singular: resticrepository
preserveUnknownFields: false
scope: Namespaced
subresources: {}
validation:
openAPIV3Schema:
properties:
Expand Down
29 changes: 29 additions & 0 deletions config/crd/bases/velero.io_restores.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
21 changes: 21 additions & 0 deletions config/crd/bases/velero.io_schedules.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
5 changes: 5 additions & 0 deletions config/crd/bases/velero.io_serverstatusrequests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 8 additions & 0 deletions config/crd/bases/velero.io_volumesnapshotlocations.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -16,6 +23,7 @@ spec:
singular: volumesnapshotlocation
preserveUnknownFields: false
scope: Namespaced
subresources: {}
validation:
openAPIV3Schema:
description: VolumeSnapshotLocation is a location where Velero stores volume
Expand Down
Loading

0 comments on commit 4178d9d

Please sign in to comment.