Skip to content

Commit 1d4f147

Browse files
authored
Merge pull request #8349 from blackpiglet/fix_v1.15.0_migration_case_error
Fix v1.15.0 migration case error
2 parents d2dec9d + 6f79c54 commit 1d4f147

File tree

5 files changed

+60
-76
lines changed

5 files changed

+60
-76
lines changed

test/Makefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ run-e2e: ginkgo
197197
--standby-cluster-name=$(STANDBY_CLUSTER_NAME) \
198198
--eks-policy-arn=$(EKS_POLICY_ARN) \
199199
--default-cls-service-account-name=$(DEFAULT_CLS_SERVICE_ACCOUNT_NAME) \
200-
--standby-cls-service-account-name=$(STANDBY_CLS_SERVICE_ACCOUNT_NAME)
200+
--standby-cls-service-account-name=$(STANDBY_CLS_SERVICE_ACCOUNT_NAME) \
201201
--kibishii-directory=$(KIBISHII_DIRECTORY) \
202202
--disable-informer-cache=$(DISABLE_INFORMER_CACHE)
203203

test/e2e/migration/migration.go

+16-12
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ import (
2525
"github.com/google/uuid"
2626
. "github.com/onsi/ginkgo/v2"
2727
. "github.com/onsi/gomega"
28+
"golang.org/x/mod/semver"
2829

2930
. "github.com/vmware-tanzu/velero/test"
3031
util "github.com/vmware-tanzu/velero/test/util/csi"
@@ -146,24 +147,27 @@ func MigrationTest(useVolumeSnapshots bool, veleroCLI2Version VeleroCLI2Version)
146147
OriginVeleroCfg.RestoreHelperImage = ""
147148
OriginVeleroCfg.Plugins = ""
148149

149-
// It is for v1.13.x migration scenario only, because since v1.14, nightly CI won't
150-
// pass velero-plugin-for-csi to E2E test anymore, and velero installation will not
151-
// fetch velero-plugin-for-csi automatically, so add it as hardcode below.
152-
// TODO: remove this section from future version like v1.15, e.g.
150+
versionWithoutPatch := semver.MajorMinor(veleroCLI2Version.VeleroVersion)
151+
// Read migration case needs plugins from the PluginsMatrix map.
152+
migrationNeedPlugins, ok := PluginsMatrix[versionWithoutPatch]
153+
Expect(ok).To(BeTrue())
154+
153155
if OriginVeleroCfg.CloudProvider == Azure {
154-
OriginVeleroCfg.Plugins = "velero/velero-plugin-for-microsoft-azure:v1.9.0"
156+
OriginVeleroCfg.Plugins = migrationNeedPlugins[Azure][0]
155157
}
156158
if OriginVeleroCfg.CloudProvider == AWS {
157-
OriginVeleroCfg.Plugins = "velero/velero-plugin-for-aws:v1.9.0"
159+
OriginVeleroCfg.Plugins = migrationNeedPlugins[AWS][0]
158160
}
159-
if strings.Contains(OriginVeleroCfg.Features, FeatureCSI) {
160-
OriginVeleroCfg.Plugins = OriginVeleroCfg.Plugins + ",velero/velero-plugin-for-csi:v0.7.0"
161+
// Because Velero CSI plugin is deprecated in v1.14,
162+
// only need to install it for version lower than v1.14.
163+
if strings.Contains(OriginVeleroCfg.Features, FeatureCSI) &&
164+
semver.Compare(versionWithoutPatch, "v1.14") < 0 {
165+
OriginVeleroCfg.Plugins = OriginVeleroCfg.Plugins + "," + migrationNeedPlugins[CSI][0]
161166
}
162-
if OriginVeleroCfg.SnapshotMoveData {
163-
if OriginVeleroCfg.CloudProvider == Azure {
164-
OriginVeleroCfg.Plugins = OriginVeleroCfg.Plugins + ",velero/velero-plugin-for-aws:v1.9.0"
165-
}
167+
if OriginVeleroCfg.SnapshotMoveData && OriginVeleroCfg.CloudProvider == Azure {
168+
OriginVeleroCfg.Plugins = OriginVeleroCfg.Plugins + "," + migrationNeedPlugins[AWS][0]
166169
}
170+
167171
veleroCLI2Version.VeleroCLI, err = InstallVeleroCLI(veleroCLI2Version.VeleroVersion)
168172
Expect(err).To(Succeed())
169173
}

test/types.go

+3-2
Original file line numberDiff line numberDiff line change
@@ -35,12 +35,13 @@ const Azure = "azure"
3535
const AzureCSI = "azure-csi"
3636
const AwsCSI = "aws-csi"
3737
const AWS = "aws"
38-
const Gcp = "gcp"
38+
const GCP = "gcp"
3939
const Vsphere = "vsphere"
40+
const CSI = "csi"
4041

4142
const UploaderTypeRestic = "restic"
4243

43-
var PublicCloudProviders = []string{AWS, Azure, Gcp, Vsphere}
44+
var PublicCloudProviders = []string{AWS, Azure, GCP, Vsphere}
4445
var LocalCloudProviders = []string{Kind, VanillaZFS}
4546
var CloudProviders = append(PublicCloudProviders, LocalCloudProviders...)
4647

test/util/providers/common.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ func getProvider(cloudProvider string) (ObjectsInStorage, error) {
7878
case AWS, Vsphere:
7979
aws := AWSStorage("")
8080
s = &aws
81-
case Gcp:
81+
case GCP:
8282
gcs := GCSStorage("")
8383
s = &gcs
8484
case Azure:

test/util/velero/velero_utils.go

+39-60
Original file line numberDiff line numberDiff line change
@@ -54,88 +54,67 @@ const BackupObjectsPrefix = "backups"
5454
const RestoreObjectsPrefix = "restores"
5555
const PluginsObjectsPrefix = "plugins"
5656

57-
var pluginsMatrix = map[string]map[string][]string{
58-
"v1.7": {
59-
"aws": {"velero/velero-plugin-for-aws:v1.3.0"},
60-
"azure": {"velero/velero-plugin-for-microsoft-azure:v1.3.0"},
61-
"vsphere": {"vsphereveleroplugin/velero-plugin-for-vsphere:v1.3.0"},
62-
"gcp": {"velero/velero-plugin-for-gcp:v1.3.0"},
63-
"csi": {"velero/velero-plugin-for-csi:v0.2.0"},
64-
},
65-
"v1.8": {
66-
"aws": {"velero/velero-plugin-for-aws:v1.4.0"},
67-
"azure": {"velero/velero-plugin-for-microsoft-azure:v1.4.0"},
68-
"vsphere": {"vsphereveleroplugin/velero-plugin-for-vsphere:v1.3.1"},
69-
"gcp": {"velero/velero-plugin-for-gcp:v1.4.0"},
70-
"csi": {"velero/velero-plugin-for-csi:v0.2.0"},
71-
},
72-
"v1.9": {
73-
"aws": {"velero/velero-plugin-for-aws:v1.5.0"},
74-
"azure": {"velero/velero-plugin-for-microsoft-azure:v1.5.0"},
75-
"vsphere": {"vsphereveleroplugin/velero-plugin-for-vsphere:v1.4.0"},
76-
"gcp": {"velero/velero-plugin-for-gcp:v1.5.0"},
77-
"csi": {"velero/velero-plugin-for-csi:v0.3.0"},
78-
},
57+
var PluginsMatrix = map[string]map[string][]string{
7958
"v1.10": {
80-
"aws": {"velero/velero-plugin-for-aws:v1.6.0"},
81-
"azure": {"velero/velero-plugin-for-microsoft-azure:v1.6.0"},
82-
"vsphere": {"vsphereveleroplugin/velero-plugin-for-vsphere:v1.5.1"},
83-
"gcp": {"velero/velero-plugin-for-gcp:v1.6.0"},
84-
"csi": {"velero/velero-plugin-for-csi:v0.4.0"},
59+
"aws": {"gcr.io/velero-gcp/velero-plugin-for-aws:v1.6.0"},
60+
"azure": {"gcr.io/velero-gcp/velero-plugin-for-microsoft-azure:v1.6.0"},
61+
"vsphere": {"gcr.io/velero-gcp/velero-plugin-for-vsphere:v1.5.1"},
62+
"gcp": {"gcr.io/velero-gcp/velero-plugin-for-gcp:v1.6.0"},
63+
"csi": {"gcr.io/velero-gcp/velero-plugin-for-csi:v0.4.0"},
8564
},
8665
"v1.11": {
87-
"aws": {"velero/velero-plugin-for-aws:v1.7.0"},
88-
"azure": {"velero/velero-plugin-for-microsoft-azure:v1.7.0"},
89-
"vsphere": {"vsphereveleroplugin/velero-plugin-for-vsphere:v1.5.1"},
90-
"gcp": {"velero/velero-plugin-for-gcp:v1.7.0"},
91-
"csi": {"velero/velero-plugin-for-csi:v0.5.0"},
66+
"aws": {"gcr.io/velero-gcp/velero-plugin-for-aws:v1.7.0"},
67+
"azure": {"gcr.io/velero-gcp/velero-plugin-for-microsoft-azure:v1.7.0"},
68+
"vsphere": {"gcr.io/velero-gcp/velero-plugin-for-vsphere:v1.5.1"},
69+
"gcp": {"gcr.io/velero-gcp/velero-plugin-for-gcp:v1.7.0"},
70+
"csi": {"gcr.io/velero-gcp/velero-plugin-for-csi:v0.5.0"},
9271
},
9372
"v1.12": {
94-
"aws": {"velero/velero-plugin-for-aws:v1.8.0"},
95-
"azure": {"velero/velero-plugin-for-microsoft-azure:v1.8.0"},
96-
"vsphere": {"vsphereveleroplugin/velero-plugin-for-vsphere:v1.5.1"},
97-
"gcp": {"velero/velero-plugin-for-gcp:v1.8.0"},
98-
"csi": {"velero/velero-plugin-for-csi:v0.6.0"},
73+
"aws": {"gcr.io/velero-gcp/velero-plugin-for-aws:v1.8.0"},
74+
"azure": {"gcr.io/velero-gcp/velero-plugin-for-microsoft-azure:v1.8.0"},
75+
"vsphere": {"gcr.io/velero-gcp/velero-plugin-for-vsphere:v1.5.1"},
76+
"gcp": {"gcr.io/velero-gcp/velero-plugin-for-gcp:v1.8.0"},
77+
"csi": {"gcr.io/velero-gcp/velero-plugin-for-csi:v0.6.0"},
9978
},
10079
"v1.13": {
101-
"aws": {"velero/velero-plugin-for-aws:v1.9.2"},
102-
"azure": {"velero/velero-plugin-for-microsoft-azure:v1.9.2"},
103-
"vsphere": {"vsphereveleroplugin/velero-plugin-for-vsphere:v1.5.2"},
104-
"gcp": {"velero/velero-plugin-for-gcp:v1.9.2"},
105-
"csi": {"velero/velero-plugin-for-csi:v0.7.1"},
106-
"datamover": {"velero/velero-plugin-for-aws:v1.9.2"},
80+
"aws": {"gcr.io/velero-gcp/velero-plugin-for-aws:v1.9.2"},
81+
"azure": {"gcr.io/velero-gcp/velero-plugin-for-microsoft-azure:v1.9.2"},
82+
"vsphere": {"gcr.io/velero-gcp/velero-plugin-for-vsphere:v1.5.2"},
83+
"gcp": {"gcr.io/velero-gcp/velero-plugin-for-gcp:v1.9.2"},
84+
"csi": {"gcr.io/velero-gcp/velero-plugin-for-csi:v0.7.1"},
85+
"datamover": {"gcr.io/velero-gcp/velero-plugin-for-aws:v1.9.2"},
10786
},
10887
"v1.14": {
109-
"aws": {"velero/velero-plugin-for-aws:v1.10.1"},
110-
"azure": {"velero/velero-plugin-for-microsoft-azure:v1.10.1"},
111-
"vsphere": {"vsphereveleroplugin/velero-plugin-for-vsphere:v1.5.2"},
112-
"gcp": {"velero/velero-plugin-for-gcp:v1.10.1"},
113-
"datamover": {"velero/velero-plugin-for-aws:v1.10.1"},
88+
"aws": {"gcr.io/velero-gcp/velero-plugin-for-aws:v1.10.1"},
89+
"azure": {"gcr.io/velero-gcp/velero-plugin-for-microsoft-azure:v1.10.1"},
90+
"vsphere": {"gcr.io/velero-gcp/velero-plugin-for-vsphere:v1.5.2"},
91+
"gcp": {"gcr.io/velero-gcp/velero-plugin-for-gcp:v1.10.1"},
92+
"datamover": {"gcr.io/velero-gcp/velero-plugin-for-aws:v1.10.1"},
11493
},
11594
"v1.15": {
116-
"aws": {"velero/velero-plugin-for-aws:v1.11.0"},
117-
"azure": {"velero/velero-plugin-for-microsoft-azure:v1.11.0"},
118-
"vsphere": {"vsphereveleroplugin/velero-plugin-for-vsphere:v1.5.2"},
119-
"gcp": {"velero/velero-plugin-for-gcp:v1.11.0"},
120-
"datamover": {"velero/velero-plugin-for-aws:v1.11.0"},
95+
"aws": {"gcr.io/velero-gcp/velero-plugin-for-aws:v1.11.0"},
96+
"azure": {"gcr.io/velero-gcp/velero-plugin-for-microsoft-azure:v1.11.0"},
97+
"vsphere": {"gcr.io/velero-gcp/velero-plugin-for-vsphere:v1.5.2"},
98+
"gcp": {"gcr.io/velero-gcp/velero-plugin-for-gcp:v1.11.0"},
99+
"datamover": {"gcr.io/velero-gcp/velero-plugin-for-aws:v1.11.0"},
121100
},
122101
"main": {
123-
"aws": {"velero/velero-plugin-for-aws:main"},
124-
"azure": {"velero/velero-plugin-for-microsoft-azure:main"},
125-
"vsphere": {"vsphereveleroplugin/velero-plugin-for-vsphere:v1.5.2"},
126-
"gcp": {"velero/velero-plugin-for-gcp:main"},
127-
"datamover": {"velero/velero-plugin-for-aws:main"},
102+
"aws": {"gcr.io/velero-gcp/velero-plugin-for-aws:main"},
103+
"azure": {"gcr.io/velero-gcp/velero-plugin-for-microsoft-azure:main"},
104+
"vsphere": {"gcr.io/velero-gcp/velero-plugin-for-vsphere:v1.5.2"},
105+
"gcp": {"gcr.io/velero-gcp/velero-plugin-for-gcp:main"},
106+
"datamover": {"gcr.io/velero-gcp/velero-plugin-for-aws:main"},
128107
},
129108
}
130109

131110
func getPluginsByVersion(version, cloudProvider, objectStoreProvider string, needDataMoverPlugin bool) ([]string, error) {
132111
var cloudMap map[string][]string
133112
arr := strings.Split(version, ".")
134113
if len(arr) >= 3 {
135-
cloudMap = pluginsMatrix[arr[0]+"."+arr[1]]
114+
cloudMap = PluginsMatrix[arr[0]+"."+arr[1]]
136115
}
137116
if len(cloudMap) == 0 {
138-
cloudMap = pluginsMatrix["main"]
117+
cloudMap = PluginsMatrix["main"]
139118
if len(cloudMap) == 0 {
140119
return nil, errors.Errorf("fail to get plugins by version: main")
141120
}

0 commit comments

Comments
 (0)