Skip to content

Commit

Permalink
Several fixes to support clusterctl upgrade tests on supervisor
Browse files Browse the repository at this point in the history
* Use infrastructure-components-supervisor.yaml for supervisor tests of old versions
* vsphere.yaml: add variables for serviceaccount configmap, necessary to install old versions
* add net-operator for supervisor tests on separate kind cluster
* disable capv image preload because we are using kind
* fix templates used in old supervisor e2e tests
  • Loading branch information
chrischdi committed Jul 2, 2024
1 parent 67e4d22 commit fa6bd64
Show file tree
Hide file tree
Showing 7 changed files with 24 additions and 9 deletions.
8 changes: 2 additions & 6 deletions test/e2e/clusterctl_upgrade_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,6 @@ import (
. "github.com/onsi/gomega"
capi_e2e "sigs.k8s.io/cluster-api/test/e2e"
"sigs.k8s.io/cluster-api/test/framework/clusterctl"

vsphereframework "sigs.k8s.io/cluster-api-provider-vsphere/test/framework"
)

var (
Expand Down Expand Up @@ -55,7 +53,6 @@ var _ = Describe("When testing clusterctl upgrades using ClusterClass (CAPV 1.10
SkipCleanup: skipCleanup,
MgmtFlavor: testSpecificSettingsGetter().FlavorForMode("topology"),
PostNamespaceCreated: testSpecificSettingsGetter().PostNamespaceCreatedFunc,
PreUpgrade: vsphereframework.LoadImagesFunc(ctx),
InitWithBinary: fmt.Sprintf(clusterctlDownloadURL, capiStableRelease),
InitWithCoreProvider: fmt.Sprintf(providerCAPIPrefix, capiStableRelease),
InitWithBootstrapProviders: []string{fmt.Sprintf(providerKubeadmPrefix, capiStableRelease)},
Expand All @@ -69,7 +66,7 @@ var _ = Describe("When testing clusterctl upgrades using ClusterClass (CAPV 1.10
InitWithKubernetesVersion: "v1.30.0",
WorkloadKubernetesVersion: "v1.30.0",
WorkloadFlavor: testSpecificSettingsGetter().FlavorForMode("workload"),
UseKindForManagementCluster: false,
UseKindForManagementCluster: true,
}
})
}, WithIP("WORKLOAD_CONTROL_PLANE_ENDPOINT_IP"))
Expand All @@ -93,7 +90,6 @@ var _ = Describe("When testing clusterctl upgrades using ClusterClass (CAPV 1.9=
SkipCleanup: skipCleanup,
MgmtFlavor: testSpecificSettingsGetter().FlavorForMode("topology"),
PostNamespaceCreated: testSpecificSettingsGetter().PostNamespaceCreatedFunc,
PreUpgrade: vsphereframework.LoadImagesFunc(ctx),
InitWithBinary: fmt.Sprintf(clusterctlDownloadURL, capiStableRelease),
InitWithCoreProvider: fmt.Sprintf(providerCAPIPrefix, capiStableRelease),
InitWithBootstrapProviders: []string{fmt.Sprintf(providerKubeadmPrefix, capiStableRelease)},
Expand All @@ -107,7 +103,7 @@ var _ = Describe("When testing clusterctl upgrades using ClusterClass (CAPV 1.9=
InitWithKubernetesVersion: "v1.29.0",
WorkloadKubernetesVersion: "v1.29.0",
WorkloadFlavor: testSpecificSettingsGetter().FlavorForMode("workload"),
UseKindForManagementCluster: false,
UseKindForManagementCluster: true,
}
})
}, WithIP("WORKLOAD_CONTROL_PLANE_ENDPOINT_IP"))
Expand Down
3 changes: 3 additions & 0 deletions test/e2e/config/vsphere.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,9 @@ variables:
EXP_NODE_ANTI_AFFINITY: "true"
CAPI_DIAGNOSTICS_ADDRESS: ":8080"
CAPI_INSECURE_DIAGNOSTICS: "true"
# Required to be set to install capv-supervisor <= v1.10, but getting created.
SERVICE_ACCOUNTS_CM_NAMESPACE: "capv-system"
SERVICE_ACCOUNTS_CM_NAME: "service-accounts-cm"

intervals:
default/wait-controllers: ["5m", "10s"]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ spec:
name: enableSSHIntoNodes
- definitions:
- jsonPatches:
- op: add
- op: replace
path: /spec/template/spec/controlPlaneEndpoint
valueFrom:
template: |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,6 @@ patches:
- target:
kind: ClusterClass
path: ./patch-namingstrategy.yaml
- target:
kind: VSphereClusterTemplate
path: ./patch-controlplaneendpoint.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
- op: add
path: /spec/template/spec/controlPlaneEndpoint
value:
host: ""
port: 0
4 changes: 2 additions & 2 deletions test/e2e/e2e_setup_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -186,11 +186,11 @@ func Setup(specName string, f func(testSpecificSettings func() testSettings), op
})

if testMode == SupervisorTestMode {
runtimeExtensionProviders = append(runtimeExtensionProviders, "vm-operator")
runtimeExtensionProviders = append(runtimeExtensionProviders, "vm-operator", "net-operator")
}

if testTarget == VCSimTestTarget {
runtimeExtensionProviders = append(runtimeExtensionProviders, "net-operator")
runtimeExtensionProviders = append(runtimeExtensionProviders, "vcsim")
}
})
defer AfterEach(func() {
Expand Down
8 changes: 8 additions & 0 deletions test/framework/framework.go
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,15 @@ func LoadE2EConfig(ctx context.Context, configPath string, configOverridesPath,
Byf("Overriding source folder for vsphere provider to /config/supervisor in the e2e config")
for i := range config.Providers {
if config.Providers[i].Name == "vsphere" {
// Replace relativ path for latest version.
config.Providers[i].Versions[0].Value = strings.ReplaceAll(config.Providers[i].Versions[0].Value, "/config/default", "/config/supervisor")
// Replace target file in github.
for j, version := range config.Providers[i].Versions {
if strings.HasSuffix(version.Value, "infrastructure-components.yaml") {
version.Value = fmt.Sprintf("%s-supervisor.yaml", strings.TrimSuffix(version.Value, ".yaml"))
config.Providers[i].Versions[j] = version
}
}
break
}
}
Expand Down

0 comments on commit fa6bd64

Please sign in to comment.