Skip to content

Commit 093d955

Browse files
committed
Merge remote-tracking branch 'origin/main' into k0s-1-29
2 parents e7d762f + a177769 commit 093d955

File tree

9 files changed

+63
-66
lines changed

9 files changed

+63
-66
lines changed

.github/workflows/release-prod.yaml

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -284,7 +284,7 @@ jobs:
284284
export EC_VERSION="${{ github.ref_name }}"
285285
export APP_VERSION="appver-${{ github.ref_name }}"
286286
export RELEASE_YAML_DIR=e2e/kots-release-install
287-
./scripts/ci-release-app.sh
287+
./scripts/ci-release-app.sh
288288
289289
# and finally an app upgrade
290290
export EC_VERSION="${{ github.ref_name }}"
@@ -319,6 +319,19 @@ jobs:
319319
export APP_VERSION="appver-${{ github.ref_name }}-upgrade"
320320
export RELEASE_YAML_DIR=e2e/kots-release-upgrade
321321
./scripts/ci-release-app.sh
322+
- name: Create Stable release
323+
env:
324+
REPLICATED_APP: "embedded-cluster-smoke-test-staging-app"
325+
REPLICATED_API_TOKEN: ${{ secrets.STAGING_REPLICATED_API_TOKEN }}
326+
REPLICATED_API_ORIGIN: "https://api.staging.replicated.com/vendor"
327+
APP_CHANNEL: Stable
328+
USES_DEV_BUCKET: "0"
329+
run: |
330+
# install the current k0s version
331+
export EC_VERSION="${{ github.ref_name }}"
332+
export APP_VERSION="${{ github.ref_name }}"
333+
export RELEASE_YAML_DIR=e2e/kots-release-install
334+
./scripts/ci-release-app.sh
322335
323336
download-current:
324337
name: Download the current release binary

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ For more information, see the [k0s documentation](https://docs.k0sproject.io/sta
77
In Embedded Cluster, all components and functionalities are consolidated into a single binary, this binary facilitates a streamlined cluster installation process, removing the need for external dependencies (rpms, debs, etc).
88

99
Embedded Cluster includes by default the Kots Admin Console, the OpenEBS Storage provisioner, and Velero for backups and disaster recovery.
10-
Additionally, it includes a Registry when deployed in air gap mode.
10+
Additionally, it includes a Registry when deployed in air gap mode, and SeaweedFS for distributed object storage in high availability air gap mode.
1111

1212
## Development
1313

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/addons/openebs/static/metadata.yaml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,15 @@ images:
1111
kubectl:
1212
repo: proxy.replicated.com/anonymous/replicated/ec-kubectl
1313
tag:
14-
amd64: 1.31.2-r1-amd64@sha256:ff86169e548c201461e584486c75736bc537fa67bf69eda6abb61fe07c510feb
15-
arm64: 1.31.2-r1-arm64@sha256:11b83dbfde7f9b2d51206bf6616c558889086dc2326c29a306a5d9a8d1032848
14+
amd64: 1.31.2-r1-amd64@sha256:d5fe5f7ced0c6ee214a7fcd997fea646ff0ee2cab90a7e959481b25deb086c44
15+
arm64: 1.31.2-r1-arm64@sha256:a6d0fcc45acc5cdc103aeefcd28376802452a29d6e12c0865e980285afb85ef0
1616
openebs-linux-utils:
1717
repo: proxy.replicated.com/anonymous/replicated/ec-openebs-linux-utils
1818
tag:
19-
amd64: 4.1.1-amd64@sha256:01fb0149627bbe5af78541ff477542314b6e17e1b82cff79047a062de89d2d16
20-
arm64: 4.1.1-arm64@sha256:be1d3a6b9cf3be529ccb8687670311b5db9a312e553d930b034941c85b26e107
19+
amd64: 4.1.1-amd64@sha256:f2516555b0d50d8145b0c69c6b9bfa0ebf48bfd62d976835879d90f7159680ba
20+
arm64: 4.1.1-arm64@sha256:920ff7df6457467844b6b649164730cfcb10646b4f6b3f526ce55f14008c2d6e
2121
openebs-provisioner-localpv:
2222
repo: proxy.replicated.com/anonymous/replicated/ec-openebs-provisioner-localpv
2323
tag:
24-
amd64: 4.1.1-r1-amd64@sha256:1388244c8ae9e1415f6225fbcf6d16ab7bfd862085ea070517af1820316bef13
25-
arm64: 4.1.1-r1-arm64@sha256:a682a555b768c425d1ed8ddab70f7ebf43ae87a85b2e87d696e9d71667e65242
24+
amd64: 4.1.1-r1-amd64@sha256:b0e621f594c2a9e2bc9b136698fe4ebcfc726ff929f160b7bdd048a76e88056c
25+
arm64: 4.1.1-r1-arm64@sha256:8fbd265b0050fecc1c1ef792d939f846cf2dab8895f96947b62a53acd2a0ef16

pkg/addons/seaweedfs/static/metadata.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,5 @@ images:
1111
seaweedfs:
1212
repo: proxy.replicated.com/anonymous/replicated/ec-seaweedfs
1313
tag:
14-
amd64: 3.79-r0-amd64@sha256:35ab43061501726c1f585ddac5c58e648816c3506a2198d07d6f4cf755a99b38
15-
arm64: 3.79-r0-arm64@sha256:067a93a25fad6c84ae82fee5e7b300dec728dcb36fe96241084bead2b793eead
14+
amd64: 3.79-r0-amd64@sha256:aeafda6c33293e2b9cb0612ac3d0471e5db2100b910b54d94edb9e5828e59d7c
15+
arm64: 3.79-r0-arm64@sha256:8378e4e11aeeb88f71d11e1fd0b1e2b4acc4f444d50ef5f6625478856f1c02e5

pkg/addons/velero/static/metadata.yaml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,20 +11,20 @@ images:
1111
kubectl:
1212
repo: proxy.replicated.com/anonymous/replicated/ec-kubectl
1313
tag:
14-
amd64: 1.31.2-r1-amd64@sha256:ff86169e548c201461e584486c75736bc537fa67bf69eda6abb61fe07c510feb
15-
arm64: 1.31.2-r1-arm64@sha256:11b83dbfde7f9b2d51206bf6616c558889086dc2326c29a306a5d9a8d1032848
14+
amd64: 1.31.2-r1-amd64@sha256:d5fe5f7ced0c6ee214a7fcd997fea646ff0ee2cab90a7e959481b25deb086c44
15+
arm64: 1.31.2-r1-arm64@sha256:a6d0fcc45acc5cdc103aeefcd28376802452a29d6e12c0865e980285afb85ef0
1616
velero:
1717
repo: proxy.replicated.com/anonymous/replicated/ec-velero
1818
tag:
19-
amd64: 1.14.1-r1-amd64@sha256:622683d49fef78b93db433d06cf7d9d8ff6ecfe5a463fcc0fed63ff2aabb9b06
20-
arm64: 1.14.1-r1-arm64@sha256:2f8e8d968bd9e19d23816b6f4e1a35aa85f920d3f0e8dcdeb971b46b6657ec4e
19+
amd64: 1.14.1-r1-amd64@sha256:c59e4488234f089143b1724a7432c931a15aa7442859c613d164a42b6713b6a6
20+
arm64: 1.14.1-r1-arm64@sha256:526294502e65770beae7f0b4fa7b072f8e1e0a658e5859fdfe3b0655e1bd9feb
2121
velero-plugin-for-aws:
2222
repo: proxy.replicated.com/anonymous/replicated/ec-velero-plugin-for-aws
2323
tag:
24-
amd64: 1.10.1-r1-amd64@sha256:99c8181e6f0220478f8968911c0aa42d6ca492c8864ae7a4afc3e03055f94ce9
25-
arm64: 1.10.1-r1-arm64@sha256:314ad1bb0ce529ca379cfdbb068e99fca6db3849d759e62f3d0c61f789879ca0
24+
amd64: 1.10.1-r1-amd64@sha256:545673c55ceb657e54fd570139a0d116d085d94499b599b356c32c40a0d34414
25+
arm64: 1.10.1-r1-arm64@sha256:c9acd532a45a9d487d17222c5f911b1cc113499bfda40bf59cd4b17711a37a4a
2626
velero-restore-helper:
2727
repo: proxy.replicated.com/anonymous/replicated/ec-velero-restore-helper
2828
tag:
29-
amd64: 1.14.1-r1-amd64@sha256:6fa626c9ba05eaf5deb9a1071df1b1d6d5ff3aaf9accf4aa28ef4a2bff4022a7
30-
arm64: 1.14.1-r1-arm64@sha256:f9de286953b5ddafbe94fb19dabadfa3eef9b0a42c1ac93918de5b1872d51b24
29+
amd64: 1.14.1-r1-amd64@sha256:c542e55a2bfe6abbf33f5b5d4be42b1b56f70e4387e2af3ae2684b7d45b89092
30+
arm64: 1.14.1-r1-arm64@sha256:179e2f0dfee8ef2471ae2764c755918bffa807983e78ed9243f1c1e58b776ee8

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)