mirror of
https://github.com/vmware-tanzu/velero.git
synced 2026-09-13 11:34:54 +00:00
Merge branch 'main' into data-mover-generic-data-path
This commit is contained in:
@@ -162,7 +162,9 @@ func getKubectlVersion() (string, error) {
|
||||
case <-time.After(kubectlTimeout):
|
||||
// we don't care about the possible error returned from Kill() here,
|
||||
// just return an empty string
|
||||
kubectlCmd.Process.Kill()
|
||||
if err := kubectlCmd.Process.Kill(); err != nil {
|
||||
return "", fmt.Errorf("error killing kubectl process: %w", err)
|
||||
}
|
||||
return "", errors.New("timeout waiting for kubectl version")
|
||||
|
||||
case err := <-done:
|
||||
|
||||
@@ -64,7 +64,10 @@ $ velero completion fish > ~/.config/fish/completions/velero.fish
|
||||
shell := args[0]
|
||||
switch shell {
|
||||
case "bash":
|
||||
cmd.Root().GenBashCompletion(os.Stdout)
|
||||
if err := cmd.Root().GenBashCompletion(os.Stdout); err != nil {
|
||||
fmt.Println("fail to generate bash completion script", err)
|
||||
os.Exit(1)
|
||||
}
|
||||
case "zsh":
|
||||
// # fix #4912
|
||||
// cobra does not support zsh completion ouptput used by source command
|
||||
@@ -72,11 +75,20 @@ $ velero completion fish > ~/.config/fish/completions/velero.fish
|
||||
// Need to append compdef manually to do that.
|
||||
zshHead := "#compdef velero\ncompdef _velero velero\n"
|
||||
out := os.Stdout
|
||||
out.Write([]byte(zshHead))
|
||||
if _, err := out.Write([]byte(zshHead)); err != nil {
|
||||
fmt.Println("fail to append compdef command into zsh completion script: ", err)
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
cmd.Root().GenZshCompletion(out)
|
||||
if err := cmd.Root().GenZshCompletion(out); err != nil {
|
||||
fmt.Println("fail to generate zsh completion script: ", err)
|
||||
os.Exit(1)
|
||||
}
|
||||
case "fish":
|
||||
cmd.Root().GenFishCompletion(os.Stdout, true)
|
||||
if err := cmd.Root().GenFishCompletion(os.Stdout, true); err != nil {
|
||||
fmt.Println("fail to generate fish completion script: ", err)
|
||||
os.Exit(1)
|
||||
}
|
||||
default:
|
||||
fmt.Println("Invalid shell specified, specify bash, zsh, or fish")
|
||||
os.Exit(1)
|
||||
|
||||
@@ -44,6 +44,7 @@ import (
|
||||
|
||||
"github.com/vmware-tanzu/velero/internal/credentials"
|
||||
velerov1api "github.com/vmware-tanzu/velero/pkg/apis/velero/v1"
|
||||
velerov2alpha1api "github.com/vmware-tanzu/velero/pkg/apis/velero/v2alpha1"
|
||||
"github.com/vmware-tanzu/velero/pkg/buildinfo"
|
||||
"github.com/vmware-tanzu/velero/pkg/client"
|
||||
"github.com/vmware-tanzu/velero/pkg/cmd"
|
||||
@@ -134,9 +135,22 @@ func newNodeAgentServer(logger logrus.FieldLogger, factory client.Factory, confi
|
||||
|
||||
ctrl.SetLogger(zap.New(zap.UseDevMode(true)))
|
||||
|
||||
velerov1api.AddToScheme(scheme)
|
||||
v1.AddToScheme(scheme)
|
||||
storagev1api.AddToScheme(scheme)
|
||||
if err := velerov1api.AddToScheme(scheme); err != nil {
|
||||
cancelFunc()
|
||||
return nil, err
|
||||
}
|
||||
if err := velerov2alpha1api.AddToScheme(scheme); err != nil {
|
||||
cancelFunc()
|
||||
return nil, err
|
||||
}
|
||||
if err := v1.AddToScheme(scheme); err != nil {
|
||||
cancelFunc()
|
||||
return nil, err
|
||||
}
|
||||
if err := storagev1api.AddToScheme(scheme); err != nil {
|
||||
cancelFunc()
|
||||
return nil, err
|
||||
}
|
||||
|
||||
nodeName := os.Getenv("NODE_NAME")
|
||||
|
||||
|
||||
@@ -55,6 +55,7 @@ import (
|
||||
"github.com/vmware-tanzu/velero/internal/credentials"
|
||||
"github.com/vmware-tanzu/velero/internal/storage"
|
||||
velerov1api "github.com/vmware-tanzu/velero/pkg/apis/velero/v1"
|
||||
velerov2alpha1api "github.com/vmware-tanzu/velero/pkg/apis/velero/v2alpha1"
|
||||
"github.com/vmware-tanzu/velero/pkg/backup"
|
||||
"github.com/vmware-tanzu/velero/pkg/buildinfo"
|
||||
"github.com/vmware-tanzu/velero/pkg/client"
|
||||
@@ -313,9 +314,22 @@ func newServer(f client.Factory, config serverConfig, logger *logrus.Logger) (*s
|
||||
}
|
||||
|
||||
scheme := runtime.NewScheme()
|
||||
velerov1api.AddToScheme(scheme)
|
||||
corev1api.AddToScheme(scheme)
|
||||
snapshotv1api.AddToScheme(scheme)
|
||||
if err := velerov1api.AddToScheme(scheme); err != nil {
|
||||
cancelFunc()
|
||||
return nil, err
|
||||
}
|
||||
if err := velerov2alpha1api.AddToScheme(scheme); err != nil {
|
||||
cancelFunc()
|
||||
return nil, err
|
||||
}
|
||||
if err := corev1api.AddToScheme(scheme); err != nil {
|
||||
cancelFunc()
|
||||
return nil, err
|
||||
}
|
||||
if err := snapshotv1api.AddToScheme(scheme); err != nil {
|
||||
cancelFunc()
|
||||
return nil, err
|
||||
}
|
||||
|
||||
ctrl.SetLogger(logrusr.New(logger))
|
||||
|
||||
|
||||
@@ -32,6 +32,7 @@ import (
|
||||
"github.com/fatih/color"
|
||||
kbclient "sigs.k8s.io/controller-runtime/pkg/client"
|
||||
|
||||
veleroapishared "github.com/vmware-tanzu/velero/pkg/apis/velero/shared"
|
||||
velerov1api "github.com/vmware-tanzu/velero/pkg/apis/velero/v1"
|
||||
"github.com/vmware-tanzu/velero/pkg/cmd/util/downloadrequest"
|
||||
"github.com/vmware-tanzu/velero/pkg/features"
|
||||
@@ -597,7 +598,7 @@ type volumesByPod struct {
|
||||
|
||||
// Add adds a pod volume with the specified pod namespace, name
|
||||
// and volume to the appropriate group.
|
||||
func (v *volumesByPod) Add(namespace, name, volume, phase string, progress velerov1api.PodVolumeOperationProgress) {
|
||||
func (v *volumesByPod) Add(namespace, name, volume, phase string, progress veleroapishared.DataMoveOperationProgress) {
|
||||
if v.volumesByPodMap == nil {
|
||||
v.volumesByPodMap = make(map[string]*podVolumeGroup)
|
||||
}
|
||||
|
||||
@@ -61,7 +61,9 @@ func ClearOutputFlagDefault(cmd *cobra.Command) {
|
||||
return
|
||||
}
|
||||
f.DefValue = ""
|
||||
f.Value.Set("")
|
||||
if err := f.Value.Set(""); err != nil {
|
||||
fmt.Printf("error clear the default value of output flag: %s\n", err.Error())
|
||||
}
|
||||
}
|
||||
|
||||
// GetOutputFlagValue returns the value of the "output" flag
|
||||
|
||||
Reference in New Issue
Block a user