Skip to content

Commit eb1ba26

Browse files
build(deps): bump github.com/vmware-tanzu/velero from 1.14.1 to 1.15.0 (#1479)
* build(deps): bump github.com/vmware-tanzu/velero from 1.14.1 to 1.15.0 Bumps [github.com/vmware-tanzu/velero](https://github.com/vmware-tanzu/velero) from 1.14.1 to 1.15.0. - [Release notes](https://github.com/vmware-tanzu/velero/releases) - [Changelog](https://github.com/vmware-tanzu/velero/blob/main/CHANGELOG.md) - [Commits](vmware-tanzu/velero@v1.14.1...v1.15.0) --- updated-dependencies: - dependency-name: github.com/vmware-tanzu/velero dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <[email protected]> * remove use of no-longer-existing velero library --------- Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Andrew Lavery <[email protected]>
1 parent 851a53c commit eb1ba26

File tree

4 files changed

+32
-48
lines changed

4 files changed

+32
-48
lines changed

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ require (
3737
github.com/spf13/viper v1.19.0
3838
github.com/stretchr/testify v1.9.0
3939
github.com/urfave/cli/v2 v2.27.5
40-
github.com/vmware-tanzu/velero v1.14.1
40+
github.com/vmware-tanzu/velero v1.15.0
4141
go.uber.org/multierr v1.11.0
4242
golang.org/x/crypto v0.29.0
4343
golang.org/x/term v0.26.0

go.sum

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -657,6 +657,7 @@ github.com/hashicorp/hcl v1.0.0 h1:0Anlzjpi4vEasTeNFn2mLJgTSwt0+6sfsiTG8qcWGx4=
657657
github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ=
658658
github.com/hinshun/vt10x v0.0.0-20220119200601-820417d04eec h1:qv2VnGeEQHchGaZ/u7lxST/RaJw+cv273q79D81Xbog=
659659
github.com/hinshun/vt10x v0.0.0-20220119200601-820417d04eec/go.mod h1:Q48J4R4DvxnHolD5P8pOtXigYlRuPLGl6moFx3ulM68=
660+
github.com/hpcloud/tail v1.0.0 h1:nfCOvKYfkgYP8hkirhJocXT2+zOD8yUNjXaWfTlyFKI=
660661
github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU=
661662
github.com/huandu/xstrings v1.5.0 h1:2ag3IFq9ZDANvthTwTiqSSZLjDc+BedvHPAp5tJy2TI=
662663
github.com/huandu/xstrings v1.5.0/go.mod h1:y5/lhBue+AyNmUVz9RLU9xbLR0o4KIIExikq4ovT0aE=
@@ -831,14 +832,11 @@ github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLA
831832
github.com/nwaples/rardecode v1.1.0/go.mod h1:5DzqNKiOdpKKBH87u8VlvAnPZMXcGRhxWkRpHbbfGS0=
832833
github.com/nwaples/rardecode v1.1.2 h1:Cj0yZY6T1Zx1R7AhTbyGSALm44/Mmq+BAPc4B/p/d3M=
833834
github.com/nwaples/rardecode v1.1.2/go.mod h1:5DzqNKiOdpKKBH87u8VlvAnPZMXcGRhxWkRpHbbfGS0=
834-
github.com/nxadm/tail v1.4.8 h1:nPr65rt6Y5JFSKQO7qToXr7pePgD6Gwiw05lkbyAQTE=
835-
github.com/nxadm/tail v1.4.8/go.mod h1:+ncqLTQzXmGhMZNUePPaPqPvBxHAIsmXswZKocGu+AU=
836835
github.com/ohler55/ojg v1.25.0 h1:sDwc4u4zex65Uz5Nm7O1QwDKTT+YRcpeZQTy1pffRkw=
837836
github.com/ohler55/ojg v1.25.0/go.mod h1:gQhDVpQLqrmnd2eqGAvJtn+NfKoYJbe/A4Sj3/Vro4o=
838837
github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
838+
github.com/onsi/ginkgo v1.10.1 h1:q/mM8GF/n0shIN8SaAZ0V+jnLPzen6WIVZdiwrRlMlo=
839839
github.com/onsi/ginkgo v1.10.1/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
840-
github.com/onsi/ginkgo v1.16.5 h1:8xi0RTUf59SOSfEtZMvwTvXYMzG4gV23XVHOZiXNtnE=
841-
github.com/onsi/ginkgo v1.16.5/go.mod h1:+E8gABHa3K6zRBolWtd+ROzc/U5bkGt0FwiG042wbpU=
842840
github.com/onsi/ginkgo/v2 v2.21.0 h1:7rg/4f3rB88pb5obDgNZrNHrQ4e6WpjonchcpuBRnZM=
843841
github.com/onsi/ginkgo/v2 v2.21.0/go.mod h1:7Du3c42kxCUegi0IImZ1wUQzMBVecgIHjR1C+NkhLQo=
844842
github.com/onsi/gomega v1.7.0/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY=
@@ -997,8 +995,8 @@ github.com/vishvananda/netlink v1.3.0 h1:X7l42GfcV4S6E4vHTsw48qbrV+9PVojNfIhZcwQ
997995
github.com/vishvananda/netlink v1.3.0/go.mod h1:i6NetklAujEcC6fK0JPjT8qSwWyO0HLn4UKG+hGqeJs=
998996
github.com/vishvananda/netns v0.0.4 h1:Oeaw1EM2JMxD51g9uhtC0D7erkIjgmj8+JZc26m1YX8=
999997
github.com/vishvananda/netns v0.0.4/go.mod h1:SpkAiCQRtJ6TvvxPnOSyH3BMl6unz3xZlaprSwhNNJM=
1000-
github.com/vmware-tanzu/velero v1.14.1 h1:HYj73scn7ZqtfTanjW/X4W0Hn3w/qcfoRbrHCWM52iI=
1001-
github.com/vmware-tanzu/velero v1.14.1/go.mod h1:/OzHzTvbevkkX+bK/BS4AgYMv6nKuOgsybuuvLWkSS0=
998+
github.com/vmware-tanzu/velero v1.15.0 h1:+S/lNSDwQqlROGWfmNuZnnabopGmco978COIt3AP09c=
999+
github.com/vmware-tanzu/velero v1.15.0/go.mod h1:28VhzPJRBo91GBRkgs4Ird0fx2vCpepBWmhF+5Pn/WQ=
10021000
github.com/x448/float16 v0.8.4 h1:qLwI1I70+NjRFUR3zs1JPUCgaCXSh3SW62uAKT1mSBM=
10031001
github.com/x448/float16 v0.8.4/go.mod h1:14CWIYCyZA/cWjXOioeEpHeN/83MdbZDRQHoFcYsOfg=
10041002
github.com/xeipuuv/gojsonpointer v0.0.0-20180127040702-4e3ac2762d5f/go.mod h1:N2zxlSyiKSe5eX1tZViRH5QA0qijqEDrYZiPEAiq3wU=
@@ -1652,6 +1650,7 @@ gopkg.in/cheggaaa/pb.v1 v1.0.27/go.mod h1:V/YB90LKu/1FcN3WVnfiiE5oMCibMjukxqG/qS
16521650
gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI=
16531651
gopkg.in/evanphx/json-patch.v4 v4.12.0 h1:n6jtcsulIzXPJaxegRbvFNNrZDjbij7ny3gmSPG+6V4=
16541652
gopkg.in/evanphx/json-patch.v4 v4.12.0/go.mod h1:p8EYWUEYMpynmqDbY58zCKCFZw8pRWMG4EsWvDvM72M=
1653+
gopkg.in/fsnotify.v1 v1.4.7 h1:xOHLXZwVvI9hhs+cLKq5+I5onOuwQLhQwiu63xxlHs4=
16551654
gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys=
16561655
gopkg.in/inf.v0 v0.9.1 h1:73M5CoZyi3ZLMOyDlQh031Cx6N9NDJ2Vvfl76EDAgDc=
16571656
gopkg.in/inf.v0 v0.9.1/go.mod h1:cWUDdTG/fYaXco+Dcufb5Vnc6Gp2YChqWtbxRZE0mXw=

pkg/cmd/restore.go

Lines changed: 24 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -36,14 +36,14 @@ import (
3636
"github.com/sirupsen/logrus"
3737
"github.com/urfave/cli/v2"
3838
velerov1 "github.com/vmware-tanzu/velero/pkg/apis/velero/v1"
39-
veleroclientv1 "github.com/vmware-tanzu/velero/pkg/generated/clientset/versioned/typed/velero/v1"
39+
velerov1api "github.com/vmware-tanzu/velero/pkg/apis/velero/v1"
4040
corev1 "k8s.io/api/core/v1"
4141
"k8s.io/apimachinery/pkg/api/errors"
4242
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
4343
"k8s.io/apimachinery/pkg/types"
4444
k8snet "k8s.io/utils/net"
4545
"k8s.io/utils/ptr"
46-
k8sconfig "sigs.k8s.io/controller-runtime/pkg/client/config"
46+
"sigs.k8s.io/controller-runtime/pkg/client"
4747
k8syaml "sigs.k8s.io/yaml"
4848
)
4949

@@ -222,15 +222,9 @@ func getBackupFromRestoreState(ctx context.Context, provider *defaults.Provider,
222222
if !ok || backupName == "" {
223223
return nil, nil
224224
}
225-
cfg, err := k8sconfig.GetConfig()
226-
if err != nil {
227-
return nil, fmt.Errorf("unable to get kubernetes config: %w", err)
228-
}
229-
veleroClient, err := veleroclientv1.NewForConfig(cfg)
230-
if err != nil {
231-
return nil, fmt.Errorf("unable to create velero client: %w", err)
232-
}
233-
backup, err := veleroClient.Backups(defaults.VeleroNamespace).Get(ctx, backupName, metav1.GetOptions{})
225+
226+
backup := velerov1api.Backup{}
227+
err = kcli.Get(ctx, types.NamespacedName{Name: backupName, Namespace: defaults.VeleroNamespace}, &backup)
234228
if err != nil {
235229
return nil, fmt.Errorf("unable to get backup: %w", err)
236230
}
@@ -246,10 +240,10 @@ func getBackupFromRestoreState(ctx context.Context, provider *defaults.Provider,
246240
return nil, fmt.Errorf("unable to get k0s config from disk: %w", err)
247241
}
248242

249-
if restorable, reason := isBackupRestorable(backup, provider, rel, isAirgap, k0sCfg); !restorable {
243+
if restorable, reason := isBackupRestorable(&backup, provider, rel, isAirgap, k0sCfg); !restorable {
250244
return nil, fmt.Errorf("backup %q %s", backup.Name, reason)
251245
}
252-
return backup, nil
246+
return &backup, nil
253247
}
254248

255249
// newS3BackupStore prompts the user for S3 backup store configuration.
@@ -456,14 +450,9 @@ func waitForBackups(ctx context.Context, provider *defaults.Provider, isAirgap b
456450
defer loading.Close()
457451
loading.Infof("Waiting for backups to become available")
458452

459-
cfg, err := k8sconfig.GetConfig()
460-
if err != nil {
461-
return nil, fmt.Errorf("unable to get kubernetes config: %w", err)
462-
}
463-
464-
veleroClient, err := veleroclientv1.NewForConfig(cfg)
453+
kcli, err := kubeutils.KubeClient()
465454
if err != nil {
466-
return nil, fmt.Errorf("unable to create velero client: %w", err)
455+
return nil, fmt.Errorf("unable to create kube client: %w", err)
467456
}
468457

469458
rel, err := release.GetChannelRelease()
@@ -482,7 +471,9 @@ func waitForBackups(ctx context.Context, provider *defaults.Provider, isAirgap b
482471
for i := 0; i < 30; i++ {
483472
time.Sleep(5 * time.Second)
484473

485-
backupList, err := veleroClient.Backups(defaults.VeleroNamespace).List(ctx, metav1.ListOptions{})
474+
backupList := velerov1api.BackupList{}
475+
err = kcli.List(ctx, &backupList, client.InNamespace(defaults.VeleroNamespace))
476+
486477
if err != nil {
487478
return nil, fmt.Errorf("unable to list backups: %w", err)
488479
}
@@ -556,29 +547,25 @@ func getK0sConfigFromDisk() (*k0sv1beta1.ClusterConfig, error) {
556547

557548
// waitForVeleroRestoreCompleted waits for a Velero restore to complete.
558549
func waitForVeleroRestoreCompleted(ctx context.Context, restoreName string) (*velerov1.Restore, error) {
559-
cfg, err := k8sconfig.GetConfig()
560-
if err != nil {
561-
return nil, fmt.Errorf("unable to get kubernetes config: %w", err)
562-
}
563-
564-
veleroClient, err := veleroclientv1.NewForConfig(cfg)
550+
kcli, err := kubeutils.KubeClient()
565551
if err != nil {
566-
return nil, fmt.Errorf("unable to create velero client: %w", err)
552+
return nil, fmt.Errorf("unable to create kube client: %w", err)
567553
}
568554

569555
for {
570-
restore, err := veleroClient.Restores(defaults.VeleroNamespace).Get(ctx, restoreName, metav1.GetOptions{})
556+
restore := velerov1api.Restore{}
557+
err = kcli.Get(ctx, types.NamespacedName{Name: restoreName, Namespace: defaults.VeleroNamespace}, &restore)
571558
if err != nil {
572559
return nil, fmt.Errorf("unable to get restore: %w", err)
573560
}
574561

575562
switch restore.Status.Phase {
576563
case velerov1.RestorePhaseCompleted:
577-
return restore, nil
564+
return &restore, nil
578565
case velerov1.RestorePhaseFailed:
579-
return restore, fmt.Errorf("restore failed")
566+
return &restore, fmt.Errorf("restore failed")
580567
case velerov1.RestorePhasePartiallyFailed:
581-
return restore, fmt.Errorf("restore partially failed")
568+
return &restore, fmt.Errorf("restore partially failed")
582569
default:
583570
// in progress
584571
}
@@ -751,20 +738,16 @@ func waitForDRComponent(ctx context.Context, drComponent disasterRecoveryCompone
751738

752739
// restoreFromBackup restores a disaster recovery component from a backup.
753740
func restoreFromBackup(ctx context.Context, backup *velerov1.Backup, drComponent disasterRecoveryComponent) error {
754-
cfg, err := k8sconfig.GetConfig()
755-
if err != nil {
756-
return fmt.Errorf("unable to get kubernetes config: %w", err)
757-
}
758-
759-
veleroClient, err := veleroclientv1.NewForConfig(cfg)
741+
kcli, err := kubeutils.KubeClient()
760742
if err != nil {
761-
return fmt.Errorf("unable to create velero client: %w", err)
743+
return fmt.Errorf("unable to create kube client: %w", err)
762744
}
763745

764746
restoreName := fmt.Sprintf("%s.%s", backup.Name, string(drComponent))
765747

766748
// check if a restore object already exists
767-
_, err = veleroClient.Restores(defaults.VeleroNamespace).Get(ctx, restoreName, metav1.GetOptions{})
749+
rest := velerov1api.Restore{}
750+
err = kcli.Get(ctx, types.NamespacedName{Name: restoreName, Namespace: defaults.VeleroNamespace}, &rest)
768751
if err != nil && !errors.IsNotFound(err) {
769752
return fmt.Errorf("unable to get restore: %w", err)
770753
}
@@ -812,7 +795,7 @@ func restoreFromBackup(ctx context.Context, backup *velerov1.Backup, drComponent
812795
return fmt.Errorf("unable to ensure restore resource modifiers: %w", err)
813796
}
814797

815-
_, err := veleroClient.Restores(defaults.VeleroNamespace).Create(ctx, restore, metav1.CreateOptions{})
798+
err = kcli.Create(ctx, restore)
816799
if err != nil {
817800
return fmt.Errorf("unable to create restore: %w", err)
818801
}

pkg/kubeutils/scheme.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import (
44
autopilotv1beta2 "github.com/k0sproject/k0s/pkg/apis/autopilot/v1beta2"
55
k0sv1beta1 "github.com/k0sproject/k0s/pkg/apis/k0s/v1beta1"
66
embeddedclusterv1beta1 "github.com/replicatedhq/embedded-cluster/kinds/apis/v1beta1"
7+
velerov1 "github.com/vmware-tanzu/velero/pkg/apis/velero/v1"
78
utilruntime "k8s.io/apimachinery/pkg/util/runtime"
89
"k8s.io/client-go/kubernetes/scheme"
910
)
@@ -12,4 +13,5 @@ func init() {
1213
utilruntime.Must(autopilotv1beta2.AddToScheme(scheme.Scheme))
1314
utilruntime.Must(k0sv1beta1.AddToScheme(scheme.Scheme))
1415
utilruntime.Must(embeddedclusterv1beta1.AddToScheme(scheme.Scheme))
16+
utilruntime.Must(velerov1.AddToScheme(scheme.Scheme))
1517
}

0 commit comments

Comments
 (0)