Skip to content

Commit

Permalink
Merge pull request #8315 from blackpiglet/8298_fix
Browse files Browse the repository at this point in the history
Modifications to support VKS environment
  • Loading branch information
reasonerjt authored Oct 30, 2024
2 parents 8320df4 + 29d84fe commit db470a7
Show file tree
Hide file tree
Showing 8 changed files with 197 additions and 143 deletions.
2 changes: 1 addition & 1 deletion test/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ run-e2e: ginkgo
--standby-cluster-name=$(STANDBY_CLUSTER_NAME) \
--eks-policy-arn=$(EKS_POLICY_ARN) \
--default-cls-service-account-name=$(DEFAULT_CLS_SERVICE_ACCOUNT_NAME) \
--standby-cls-service-account-name=$(STANDBY_CLS_SERVICE_ACCOUNT_NAME)
--standby-cls-service-account-name=$(STANDBY_CLS_SERVICE_ACCOUNT_NAME) \
--kibishii-directory=$(KIBISHII_DIRECTORY) \
--disable-informer-cache=$(DISABLE_INFORMER_CACHE)

Expand Down
23 changes: 14 additions & 9 deletions test/e2e/migration/migration.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import (
"github.com/google/uuid"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
"golang.org/x/mod/semver"

. "github.com/vmware-tanzu/velero/test"
util "github.com/vmware-tanzu/velero/test/util/csi"
Expand Down Expand Up @@ -146,22 +147,26 @@ func MigrationTest(useVolumeSnapshots bool, veleroCLI2Version VeleroCLI2Version)
OriginVeleroCfg.RestoreHelperImage = ""
OriginVeleroCfg.Plugins = ""

// It is for v1.13.x migration scenario only, because since v1.14, nightly CI won't
// pass velero-plugin-for-csi to E2E test anymore, and velero installation will not
// fetch velero-plugin-for-csi automatically, so add it as hardcode below.
// TODO: remove this section from future version like v1.15, e.g.
versionWithoutPatch := semver.MajorMinor(veleroCLI2Version.VeleroVersion)
// Read migration case needs plugins from the PluginsMatrix map.
migrationNeedPlugins, ok := PluginsMatrix[versionWithoutPatch]
Expect(ok).To(BeTrue())

if OriginVeleroCfg.CloudProvider == Azure {
OriginVeleroCfg.Plugins = "velero/velero-plugin-for-microsoft-azure:v1.9.0"
OriginVeleroCfg.Plugins = migrationNeedPlugins[Azure][0]
}
if OriginVeleroCfg.CloudProvider == AWS {
OriginVeleroCfg.Plugins = "velero/velero-plugin-for-aws:v1.9.0"
OriginVeleroCfg.Plugins = migrationNeedPlugins[AWS][0]
}
if strings.Contains(OriginVeleroCfg.Features, FeatureCSI) {
OriginVeleroCfg.Plugins = OriginVeleroCfg.Plugins + ",velero/velero-plugin-for-csi:v0.7.0"
// Because Velero CSI plugin is deprecated in v1.14,
// only need to install it for version lower than v1.14.
if strings.Contains(OriginVeleroCfg.Features, FeatureCSI) &&
semver.Compare(versionWithoutPatch, "v1.14") < 0 {
OriginVeleroCfg.Plugins = OriginVeleroCfg.Plugins + "," + migrationNeedPlugins[CSI][0]
}
if OriginVeleroCfg.SnapshotMoveData {
if OriginVeleroCfg.CloudProvider == Azure {
OriginVeleroCfg.Plugins = OriginVeleroCfg.Plugins + ",velero/velero-plugin-for-aws:v1.9.0"
OriginVeleroCfg.Plugins = OriginVeleroCfg.Plugins + "," + migrationNeedPlugins[AWS][0]
}
}
veleroCLI2Version.VeleroCLI, err = InstallVeleroCLI(veleroCLI2Version.VeleroVersion)
Expand Down
3 changes: 2 additions & 1 deletion test/testdata/storage-class/vsphere-csi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ metadata:
annotations:
storageclass.kubernetes.io/is-default-class: "false"
parameters:
StoragePolicyName: "vSAN Default Storage Policy"
# StoragePolicyName: "vSAN Default Storage Policy" # This is used for the TKGm environment.
svStorageClass: worker-storagepolicy # This is used for TKGs/uTKG environment.
provisioner: csi.vsphere.vmware.com
reclaimPolicy: Delete
volumeBindingMode: WaitForFirstConsumer
3 changes: 2 additions & 1 deletion test/testdata/storage-class/vsphere.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ metadata:
annotations:
storageclass.kubernetes.io/is-default-class: "false"
parameters:
StoragePolicyName: "vSAN Default Storage Policy"
#StoragePolicyName: "vSAN Default Storage Policy" # This is used for TKGm environment.
svStorageClass: worker-storagepolicy # This is used for TKGs/uTKG environment.
provisioner: csi.vsphere.vmware.com
reclaimPolicy: Delete
volumeBindingMode: WaitForFirstConsumer
20 changes: 14 additions & 6 deletions test/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import (
"github.com/google/uuid"

"github.com/vmware-tanzu/velero/pkg/cmd/cli/install"
. "github.com/vmware-tanzu/velero/test/util/k8s"
"github.com/vmware-tanzu/velero/test/util/k8s"
)

const StorageClassName = "e2e-storage-class"
Expand All @@ -35,12 +35,20 @@ const Azure = "azure"
const AzureCSI = "azure-csi"
const AwsCSI = "aws-csi"
const AWS = "aws"
const Gcp = "gcp"
const GCP = "gcp"
const Vsphere = "vsphere"
const CSI = "csi"

const UploaderTypeRestic = "restic"

var PublicCloudProviders = []string{AWS, Azure, Gcp, Vsphere}
const (
KubeSystemNamespace = "kube-system"
VSphereCSIControllerNamespace = "vmware-system-csi"
VeleroVSphereSecretName = "velero-vsphere-config-secret"
VeleroVSphereConfigMapName = "velero-vsphere-plugin-config"
)

var PublicCloudProviders = []string{AWS, Azure, GCP, Vsphere}
var LocalCloudProviders = []string{Kind, VanillaZFS}
var CloudProviders = append(PublicCloudProviders, LocalCloudProviders...)

Expand Down Expand Up @@ -87,9 +95,9 @@ type VeleroConfig struct {
GCFrequency string
DefaultClusterContext string
StandbyClusterContext string
ClientToInstallVelero *TestClient
DefaultClient *TestClient
StandbyClient *TestClient
ClientToInstallVelero *k8s.TestClient
DefaultClient *k8s.TestClient
StandbyClient *k8s.TestClient
ClusterToInstallVelero string
DefaultClusterName string
StandbyClusterName string
Expand Down
2 changes: 1 addition & 1 deletion test/util/providers/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ func getProvider(cloudProvider string) (ObjectsInStorage, error) {
case AWS, Vsphere:
aws := AWSStorage("")
s = &aws
case Gcp:
case GCP:
gcs := GCSStorage("")
s = &gcs
case Azure:
Expand Down
Loading

0 comments on commit db470a7

Please sign in to comment.