mirror of
https://github.com/vmware-tanzu/velero.git
synced 2026-03-24 02:25:06 +00:00
Compare commits
4 Commits
main
...
topic/xj01
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9bfc78e769 | ||
|
|
c9e26256fa | ||
|
|
6e315c32e2 | ||
|
|
91cbc40956 |
@@ -13,7 +13,7 @@
|
||||
# limitations under the License.
|
||||
|
||||
# Velero binary build section
|
||||
FROM --platform=$BUILDPLATFORM golang:1.25-bookworm AS velero-builder
|
||||
FROM --platform=$BUILDPLATFORM golang:1.25.7-bookworm AS velero-builder
|
||||
|
||||
ARG GOPROXY
|
||||
ARG BIN
|
||||
@@ -49,7 +49,7 @@ RUN mkdir -p /output/usr/bin && \
|
||||
go clean -modcache -cache
|
||||
|
||||
# Restic binary build section
|
||||
FROM --platform=$BUILDPLATFORM golang:1.25-bookworm AS restic-builder
|
||||
FROM --platform=$BUILDPLATFORM golang:1.25.7-bookworm AS restic-builder
|
||||
|
||||
ARG GOPROXY
|
||||
ARG BIN
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
ARG OS_VERSION=1809
|
||||
|
||||
# Velero binary build section
|
||||
FROM --platform=$BUILDPLATFORM golang:1.25-bookworm AS velero-builder
|
||||
FROM --platform=$BUILDPLATFORM golang:1.25.7-bookworm AS velero-builder
|
||||
|
||||
ARG GOPROXY
|
||||
ARG BIN
|
||||
|
||||
2
Tiltfile
2
Tiltfile
@@ -52,7 +52,7 @@ git_sha = str(local("git rev-parse HEAD", quiet = True, echo_off = True)).strip(
|
||||
|
||||
tilt_helper_dockerfile_header = """
|
||||
# Tilt image
|
||||
FROM golang:1.25 as tilt-helper
|
||||
FROM golang:1.25.7 as tilt-helper
|
||||
|
||||
# Support live reloading with Tilt
|
||||
RUN wget --output-document /restart.sh --quiet https://raw.githubusercontent.com/windmilleng/rerun-process-wrapper/master/restart.sh && \
|
||||
|
||||
@@ -16,7 +16,7 @@ https://velero.io/docs/v1.18/upgrade-to-1.18/
|
||||
#### Concurrent backup
|
||||
In v1.18, Velero is capable to process multiple backups concurrently. This is a significant usability improvement, especially for multiple tenants or multiple users case, backups submitted from different users could run their backups simultaneously without interfering with each other.
|
||||
|
||||
Check design https://github.com/vmware-tanzu/velero/blob/main/design/concurrent-backup-processing.md for more details.
|
||||
Check design https://github.com/vmware-tanzu/velero/blob/main/design/Implemented/concurrent-backup-processing.md for more details.
|
||||
|
||||
#### Cache volume for data movers
|
||||
In v1.18, Velero allows users to configure cache volumes for data mover pods during restore for CSI snapshot data movement and fs-backup. This brings below benefits:
|
||||
@@ -24,7 +24,7 @@ In v1.18, Velero allows users to configure cache volumes for data mover pods dur
|
||||
- Solve the problem that multiple data mover pods fail to run concurrently in one node when the node's ephemeral disk is limited
|
||||
- Working together with backup repository's cache limit configuration, cache volume with appropriate size helps to improve the restore throughput
|
||||
|
||||
Check design https://github.com/vmware-tanzu/velero/blob/main/design/backup-repo-cache-volume.md for more details.
|
||||
Check design https://github.com/vmware-tanzu/velero/blob/main/design/Implemented/backup-repo-cache-volume.md for more details.
|
||||
|
||||
#### Incremental size for data movers
|
||||
In v1.18, Velero allows users to observe the incremental size of data movers backups for CSI snapshot data movement and fs-backup, so that users could visually see the data reduction due to incremental backup.
|
||||
|
||||
2
go.mod
2
go.mod
@@ -1,6 +1,6 @@
|
||||
module github.com/vmware-tanzu/velero
|
||||
|
||||
go 1.25.0
|
||||
go 1.25.7
|
||||
|
||||
require (
|
||||
cloud.google.com/go/storage v1.57.2
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
FROM --platform=$TARGETPLATFORM golang:1.25-bookworm
|
||||
FROM --platform=$TARGETPLATFORM golang:1.25.7-bookworm
|
||||
|
||||
ARG GOPROXY
|
||||
|
||||
@@ -21,9 +21,11 @@ ENV GO111MODULE=on
|
||||
ENV GOPROXY=${GOPROXY}
|
||||
|
||||
# kubebuilder test bundle is separated from kubebuilder. Need to setup it for CI test.
|
||||
RUN curl -sSLo envtest-bins.tar.gz https://go.kubebuilder.io/test-tools/1.22.1/linux/$(go env GOARCH) && \
|
||||
mkdir /usr/local/kubebuilder && \
|
||||
tar -C /usr/local/kubebuilder --strip-components=1 -zvxf envtest-bins.tar.gz
|
||||
# Using setup-envtest to download envtest binaries
|
||||
RUN go install sigs.k8s.io/controller-runtime/tools/setup-envtest@latest && \
|
||||
mkdir -p /usr/local/kubebuilder/bin && \
|
||||
ENVTEST_ASSETS_DIR=$(setup-envtest use 1.33.0 --bin-dir /usr/local/kubebuilder/bin -p path) && \
|
||||
cp -r ${ENVTEST_ASSETS_DIR}/* /usr/local/kubebuilder/bin/
|
||||
|
||||
RUN wget --quiet https://github.com/kubernetes-sigs/kubebuilder/releases/download/v3.2.0/kubebuilder_linux_$(go env GOARCH) && \
|
||||
mv kubebuilder_linux_$(go env GOARCH) /usr/local/kubebuilder/bin/kubebuilder && \
|
||||
|
||||
@@ -76,7 +76,7 @@ HAS_VSPHERE_PLUGIN ?= false
|
||||
RESTORE_HELPER_IMAGE ?=
|
||||
|
||||
#Released version only
|
||||
UPGRADE_FROM_VELERO_VERSION ?= v1.15.2,v1.16.2
|
||||
UPGRADE_FROM_VELERO_VERSION ?= v1.16.2,v1.17.2
|
||||
|
||||
# UPGRADE_FROM_VELERO_CLI can has the same format(a list divided by comma) with UPGRADE_FROM_VELERO_VERSION
|
||||
# Upgrade tests will be executed sequently according to the list by UPGRADE_FROM_VELERO_VERSION
|
||||
@@ -85,7 +85,7 @@ UPGRADE_FROM_VELERO_VERSION ?= v1.15.2,v1.16.2
|
||||
# to the end, nil string will be set if UPGRADE_FROM_VELERO_CLI is shorter than UPGRADE_FROM_VELERO_VERSION
|
||||
UPGRADE_FROM_VELERO_CLI ?=
|
||||
|
||||
MIGRATE_FROM_VELERO_VERSION ?= v1.16.2,$(VERSION)
|
||||
MIGRATE_FROM_VELERO_VERSION ?= v1.17.2,$(VERSION)
|
||||
MIGRATE_FROM_VELERO_CLI ?=
|
||||
|
||||
VELERO_NAMESPACE ?= velero
|
||||
|
||||
@@ -365,7 +365,7 @@ func VersionNoOlderThan(version string, targetVersion string) (bool, error) {
|
||||
matches := tagRe.FindStringSubmatch(targetVersion)
|
||||
targetMajor := matches[1]
|
||||
targetMinor := matches[2]
|
||||
if major > targetMajor && minor >= targetMinor {
|
||||
if major >= targetMajor && minor >= targetMinor {
|
||||
return true, nil
|
||||
} else {
|
||||
return false, nil
|
||||
|
||||
65
test/util/velero/install_test.go
Normal file
65
test/util/velero/install_test.go
Normal file
@@ -0,0 +1,65 @@
|
||||
/*
|
||||
Copyright the Velero contributors.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
package velero
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
func Test_VersionNoOlderThan(t *testing.T) {
|
||||
type versionTest struct {
|
||||
caseName string
|
||||
version string
|
||||
targetVersion string
|
||||
result bool
|
||||
err error
|
||||
}
|
||||
tests := []versionTest{
|
||||
{
|
||||
caseName: "branch version compare",
|
||||
version: "release-1.18",
|
||||
targetVersion: "v1.16",
|
||||
result: true,
|
||||
err: nil,
|
||||
},
|
||||
{
|
||||
caseName: "tag version compare",
|
||||
version: "v1.18.0",
|
||||
targetVersion: "v1.16",
|
||||
result: true,
|
||||
err: nil,
|
||||
},
|
||||
{
|
||||
caseName: "main version compare",
|
||||
version: "main",
|
||||
targetVersion: "v1.15",
|
||||
result: true,
|
||||
err: nil,
|
||||
},
|
||||
}
|
||||
|
||||
for _, test := range tests {
|
||||
t.Run(test.caseName, func(t *testing.T) {
|
||||
res, err := VersionNoOlderThan(test.version, test.targetVersion)
|
||||
|
||||
require.Equal(t, test.err, err)
|
||||
require.Equal(t, test.result, res)
|
||||
})
|
||||
}
|
||||
}
|
||||
@@ -99,6 +99,15 @@ var ImagesMatrix = map[string]map[string][]string{
|
||||
"velero": {"velero/velero:v1.16.2"},
|
||||
"velero-restore-helper": {"velero/velero:v1.16.2"},
|
||||
},
|
||||
"v1.17": {
|
||||
"aws": {"velero/velero-plugin-for-aws:v1.13.2"},
|
||||
"azure": {"velero/velero-plugin-for-microsoft-azure:v1.13.2"},
|
||||
"vsphere": {"vsphereveleroplugin/velero-plugin-for-vsphere:v1.5.2"},
|
||||
"gcp": {"velero/velero-plugin-for-gcp:v1.13.2"},
|
||||
"datamover": {"velero/velero-plugin-for-aws:v1.13.2"},
|
||||
"velero": {"velero/velero:v1.17.2"},
|
||||
"velero-restore-helper": {"velero/velero:v1.17.2"},
|
||||
},
|
||||
"main": {
|
||||
"aws": {"velero/velero-plugin-for-aws:main"},
|
||||
"azure": {"velero/velero-plugin-for-microsoft-azure:main"},
|
||||
@@ -128,16 +137,13 @@ func SetImagesToDefaultValues(config VeleroConfig, version string) (VeleroConfig
|
||||
|
||||
ret.Plugins = ""
|
||||
|
||||
versionWithoutPatch := "main"
|
||||
if version != "main" {
|
||||
versionWithoutPatch = semver.MajorMinor(version)
|
||||
}
|
||||
versionWithoutPatch := getVersionWithoutPatch(version)
|
||||
|
||||
// Read migration case needs images from the PluginsMatrix map.
|
||||
images, ok := ImagesMatrix[versionWithoutPatch]
|
||||
if !ok {
|
||||
return config, fmt.Errorf("fail to read the images for version %s from the ImagesMatrix",
|
||||
versionWithoutPatch)
|
||||
fmt.Printf("Cannot read the images for version %s from the ImagesMatrix. Use the original values.\n", versionWithoutPatch)
|
||||
return config, nil
|
||||
}
|
||||
|
||||
ret.VeleroImage = images[Velero][0]
|
||||
@@ -164,6 +170,27 @@ func SetImagesToDefaultValues(config VeleroConfig, version string) (VeleroConfig
|
||||
return ret, nil
|
||||
}
|
||||
|
||||
func getVersionWithoutPatch(version string) string {
|
||||
versionWithoutPatch := ""
|
||||
|
||||
mainRe := regexp.MustCompile(`^main$`)
|
||||
releaseRe := regexp.MustCompile(`^release-(\d+)\.(\d+)(-dev)?$`)
|
||||
|
||||
switch {
|
||||
case mainRe.MatchString(version):
|
||||
versionWithoutPatch = "main"
|
||||
case releaseRe.MatchString(version):
|
||||
matches := releaseRe.FindStringSubmatch(version)
|
||||
versionWithoutPatch = fmt.Sprintf("v%s.%s", matches[1], matches[2])
|
||||
default:
|
||||
versionWithoutPatch = semver.MajorMinor(version)
|
||||
}
|
||||
|
||||
fmt.Println("The version is ", versionWithoutPatch)
|
||||
|
||||
return versionWithoutPatch
|
||||
}
|
||||
|
||||
func getPluginsByVersion(version string, cloudProvider string, needDataMoverPlugin bool) ([]string, error) {
|
||||
var cloudMap map[string][]string
|
||||
arr := strings.Split(version, ".")
|
||||
|
||||
54
test/util/velero/velero_utils_test.go
Normal file
54
test/util/velero/velero_utils_test.go
Normal file
@@ -0,0 +1,54 @@
|
||||
/*
|
||||
Copyright the Velero contributors.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
package velero
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
func Test_getVersionWithoutPatch(t *testing.T) {
|
||||
versionTests := []struct {
|
||||
caseName string
|
||||
version string
|
||||
result string
|
||||
}{
|
||||
{
|
||||
caseName: "main version",
|
||||
version: "main",
|
||||
result: "main",
|
||||
},
|
||||
{
|
||||
caseName: "release version",
|
||||
version: "release-1.18-dev",
|
||||
result: "v1.18",
|
||||
},
|
||||
{
|
||||
caseName: "tag version",
|
||||
version: "v1.17.2",
|
||||
result: "v1.17",
|
||||
},
|
||||
}
|
||||
|
||||
for _, test := range versionTests {
|
||||
t.Run(test.caseName, func(t *testing.T) {
|
||||
res := getVersionWithoutPatch(test.version)
|
||||
require.Equal(t, test.result, res)
|
||||
})
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user