Merge branch 'main' of https://github.com/qiuming-best/velero into uploader-restic

This commit is contained in:
Ming
2022-08-29 11:33:59 +00:00
13 changed files with 258 additions and 265 deletions
+10 -2
View File
@@ -28,7 +28,7 @@ import (
"github.com/vmware-tanzu/velero/pkg/client"
"github.com/vmware-tanzu/velero/pkg/cmd"
"github.com/vmware-tanzu/velero/pkg/cmd/util/output"
"github.com/vmware-tanzu/velero/pkg/restic"
"github.com/vmware-tanzu/velero/pkg/label"
)
func NewDescribeCommand(f client.Factory, use string) *cobra.Command {
@@ -69,7 +69,7 @@ func NewDescribeCommand(f client.Factory, use string) *cobra.Command {
first := true
for _, restore := range restores.Items {
opts := restic.NewPodVolumeRestoreListOptions(restore.Name)
opts := newPodVolumeRestoreListOptions(restore.Name)
podvolumeRestoreList, err := veleroClient.VeleroV1().PodVolumeRestores(f.Namespace()).List(context.TODO(), opts)
if err != nil {
fmt.Fprintf(os.Stderr, "error getting PodVolumeRestores for restore %s: %v\n", restore.Name, err)
@@ -94,3 +94,11 @@ func NewDescribeCommand(f client.Factory, use string) *cobra.Command {
return c
}
// newPodVolumeRestoreListOptions creates a ListOptions with a label selector configured to
// find PodVolumeRestores for the restore identified by name.
func newPodVolumeRestoreListOptions(name string) metav1.ListOptions {
return metav1.ListOptions{
LabelSelector: fmt.Sprintf("%s=%s", velerov1api.RestoreNameLabel, label.GetValidName(name)),
}
}