-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add additional printer columns for CRDs #2881
Add additional printer columns for CRDs #2881
Conversation
473eec3
to
a2028e9
Compare
@zubron Since we've locked the v1.5.0 list except for critical fixes, I'm going to mark this for v1.5.1 in the GitHub milestones. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@zubron I added a few minor comments. PTAL
// +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" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
suggest: Start Time
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I opted for the "Created" title to match the equivalent column from velero get backups
. Same with "Age" to match the final column in standard kubectl get
output (we already had that field/column for BSLs). Is consistency with those important?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1 for being consistent with the columns for backups and using Created
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed, I would prefer consistency.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think I would prefer to match the current velero get backups
output, since that's established and updating it may break user scripts, so Created
works for me.
That does, however, put us in an awkward spot since I think all other .status.startTimestamp
fields should match, due to the existence of the creationTimestamp
field. Ideally, we'd have clean mappings between the field name in the YAML and printer column, but I think due to historical reasons we're a little stuck.
So my vote is this mapping:
Print .status.startTimestamp
under Created
Print .metadata.creationTimestamp
under Age
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, I'm not sure I understand what you mean by:
That does, however, put us in an awkward spot since I think all other .status.startTimestamp fields should match, due to the existence of the creationTimestamp field.
As for the mapping you'd prefer, that is what is in this file. Am I missing something?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The awkward spot I was referring to is that we have creationTimestamp
that isn't mapped to the Created
display name. It's probably not a big deal except for people looking at the code.
It looks like there's 2 instances where status.startTimestamp
is mapped to Start Time
, rather than Created
:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, I see. Thanks for the explanation!
I used Started
as those column names which matches the output from velero get restores
... another inconsistency :(
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Gotcha - yeah, that was our past mistake.
I think we could put that on the docket for v2.0 to update those velero
commands so we don't break any scripts.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Created #2989 to address this.
// +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" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
suggest: Created At
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See above
@@ -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" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
suggest: Start Time
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It'd be helpful to know the reasoning for this request. Otherwise, Created
is consistent with the column name for our other resources.
// +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" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suggest: Created At
// +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" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: Start Time
for consistency
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll note that this doesn't match what we've got specified in the backup.go file right now; I think whichever we choose, the column name should be consistent across object types.
// +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" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
suggest: Created At
@@ -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" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: Start Time
for consistency
// +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" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
suggest: Created At
@@ -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" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
suggest: Created At
@zubron when you have a chance please resolve the conflicts, thanks. |
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]>
a2028e9
to
97037ff
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I know we had a discussion about calculated fields in the community meeting, and we can't do them without extra code.
With that in mind, I think renaming the current Age
fields would be desirable, because kubectl
uses a calculated value as opposed to a bare timestamp for this when querying for built-in resources.
For example, here's what it looks like when querying for nodes:
% kubectl get nodes
NAME STATUS ROLES AGE VERSION
kind-control-plane Ready master 19h v1.17.0
In this case, the Age
column is actually the difference between now and the creation timestamp. If we use the creationTimestamp directly, I worry about overloading the field's name with a different type of data.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
My change request was based on inaccurate information.
I think I'm going to lean towards keeping the fields internally consistent, and letting this PR merge as is. We now have an action item to clean things up in v2.0, so I think that will work. |
@ashish-amarnath Could you review the comments and update your review? |
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]>
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]>
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]>
This reverts commit 4178d9d.
This reverts commit 4178d9d. Signed-off-by: Carlisia <[email protected]>
* Revert "Add additional printer columns for CRDs (#2881)" This reverts commit 4178d9d. Signed-off-by: Carlisia <[email protected]> * Add generated files Signed-off-by: Carlisia <[email protected]>
* Revert "Add additional printer columns for CRDs (vmware-tanzu#2881)" This reverts commit 4178d9d. Signed-off-by: Carlisia <[email protected]> * Add generated files Signed-off-by: Carlisia <[email protected]> Signed-off-by: Pradeep Jigalur <[email protected]>
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]>
* Revert "Add additional printer columns for CRDs (vmware-tanzu#2881)" This reverts commit 4178d9d. Signed-off-by: Carlisia <[email protected]> * Add generated files Signed-off-by: Carlisia <[email protected]>
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]>
* Revert "Add additional printer columns for CRDs (vmware-tanzu#2881)" This reverts commit 4178d9d. Signed-off-by: Carlisia <[email protected]> * Add generated files Signed-off-by: Carlisia <[email protected]>
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]>
* Revert "Add additional printer columns for CRDs (vmware-tanzu#2881)" This reverts commit 4178d9d. Signed-off-by: Carlisia <[email protected]> * Add generated files Signed-off-by: Carlisia <[email protected]>
This change modifies the kubebuilder annotations for the Velero CRDs to
include
additionalPrinterColumns
so that more information is exposedwhen using
kubectl get
.For each of the CRDs, annotations have been added to make the output
for
kubectl get
match the output from the equivalentvelero get
command as closely as possible. There are some cases where this output
could not be replicated, such as the
EXPIRES
column for Backups, dueto 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 asPodVolumeBackup
andPodVolumeRestore
, a best effort has been made toexpose information that provides value.
Fixes #1780
Signed-off-by: Bridget McErlean [email protected]