Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🌱 test: enable vcsim to run clusterctl upgrade e2e tests #3109

Merged
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion test/e2e/anti_affinity_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ var _ = Describe("Cluster creation with anti affined nodes", func() {

BeforeEach(func() {
Expect(bootstrapClusterProxy).NotTo(BeNil(), "BootstrapClusterProxy can't be nil")
namespace = setupSpecNamespace("anti-affinity-e2e")
namespace = setupSpecNamespace("anti-affinity-e2e", testSpecificSettingsGetter().PostNamespaceCreatedFunc)
})

AfterEach(func() {
Expand Down
17 changes: 11 additions & 6 deletions test/e2e/clusterctl_upgrade_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ import (
capi_e2e "sigs.k8s.io/cluster-api/test/e2e"
"sigs.k8s.io/cluster-api/test/framework"
"sigs.k8s.io/cluster-api/test/framework/clusterctl"

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

var (
Expand All @@ -36,7 +38,7 @@ var (
capvReleaseMarkerPrefix = "go://sigs.k8s.io/cluster-api-provider-vsphere@v%s"
)

var _ = Describe("When testing clusterctl upgrades using ClusterClass (CAPV 1.10=>current, CAPI 1.7=>1.8) [supervisor] [ClusterClass]", func() {
var _ = Describe("When testing clusterctl upgrades using ClusterClass (CAPV 1.10=>current, CAPI 1.7=>1.8) [vcsim] [supervisor] [ClusterClass]", func() {
const specName = "clusterctl-upgrade-1.10-current" // prefix (clusterctl-upgrade) copied from CAPI
Setup(specName, func(testSpecificSettingsGetter func() testSettings) {
capi_e2e.ClusterctlUpgradeSpec(ctx, func() capi_e2e.ClusterctlUpgradeSpecInput {
Expand Down Expand Up @@ -67,14 +69,14 @@ var _ = Describe("When testing clusterctl upgrades using ClusterClass (CAPV 1.10
InitWithKubernetesVersion: "v1.30.0",
WorkloadKubernetesVersion: "v1.30.0",
WorkloadFlavor: testSpecificSettingsGetter().FlavorForMode("workload"),
UseKindForManagementCluster: true,
UseKindForManagementCluster: testSpecificSettingsGetter().UseKindForManagementCluster,
chrischdi marked this conversation as resolved.
Show resolved Hide resolved
KindManagementClusterNewClusterProxyFunc: kindManagementClusterNewClusterProxyFunc,
}
})
}, WithIP("WORKLOAD_CONTROL_PLANE_ENDPOINT_IP"))
}, WithIP("WORKLOAD_CONTROL_PLANE_ENDPOINT_IP"), WithAdditionalVCSimServer(true))
})

var _ = Describe("When testing clusterctl upgrades using ClusterClass (CAPV 1.9=>current, CAPI 1.6=>1.8) [supervisor] [ClusterClass]", func() {
var _ = Describe("When testing clusterctl upgrades using ClusterClass (CAPV 1.9=>current, CAPI 1.6=>1.8) [vcsim] [supervisor] [ClusterClass]", func() {
const specName = "clusterctl-upgrade-1.9-current" // prefix (clusterctl-upgrade) copied from CAPI
Setup(specName, func(testSpecificSettingsGetter func() testSettings) {
capi_e2e.ClusterctlUpgradeSpec(ctx, func() capi_e2e.ClusterctlUpgradeSpecInput {
Expand Down Expand Up @@ -105,11 +107,11 @@ var _ = Describe("When testing clusterctl upgrades using ClusterClass (CAPV 1.9=
InitWithKubernetesVersion: "v1.29.0",
WorkloadKubernetesVersion: "v1.29.0",
WorkloadFlavor: testSpecificSettingsGetter().FlavorForMode("workload"),
UseKindForManagementCluster: true,
UseKindForManagementCluster: testSpecificSettingsGetter().UseKindForManagementCluster,
KindManagementClusterNewClusterProxyFunc: kindManagementClusterNewClusterProxyFunc,
}
})
}, WithIP("WORKLOAD_CONTROL_PLANE_ENDPOINT_IP"))
}, WithIP("WORKLOAD_CONTROL_PLANE_ENDPOINT_IP"), WithAdditionalVCSimServer(true))
})

// getStableReleaseOfMinor returns the latest stable version of minorRelease.
Expand All @@ -119,5 +121,8 @@ func getStableReleaseOfMinor(ctx context.Context, releaseMarkerPrefix, minorRele
}

func kindManagementClusterNewClusterProxyFunc(name string, kubeconfigPath string) framework.ClusterProxy {
if testTarget == VCSimTestTarget {
return vcsim.NewClusterProxy(name, kubeconfigPath, initScheme())
}
return framework.NewClusterProxy(name, kubeconfigPath, initScheme())
}
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ spec:
valueFrom:
template: |
host: '{{ .controlPlaneIpAddr }}'
port: 6443
port: {{ .controlPlanePort }}
- op: add
path: /spec/template/spec/identityRef
valueFrom:
Expand Down Expand Up @@ -223,6 +223,13 @@ spec:
openAPIV3Schema:
description: Floating VIP for the control plane.
type: string
- metadata: {}
name: controlPlanePort
required: true
schema:
openAPIV3Schema:
description: Port for the control plane endpoint.
type: integer
- name: credsSecretName
required: true
schema:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,8 @@ resources:
patchesStrategicMerge:
- ../commons/cluster-resource-set-label.yaml
- ../commons/cluster-network-CIDR.yaml
- ../commons/cluster-resource-set-csi-insecure.yaml
- ../commons/cluster-resource-set-csi-insecure.yaml
patches:
sbueringer marked this conversation as resolved.
Show resolved Hide resolved
- target:
kind: Cluster
path: workload-control-plane-port.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
- op: add
path: /spec/topology/variables/-
value:
name: controlPlanePort
value: ${CONTROL_PLANE_ENDPOINT_PORT:=6443}
2 changes: 1 addition & 1 deletion test/e2e/dhcp_overrides_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ var _ = Describe("DHCPOverrides configuration test", func() {
var namespace *corev1.Namespace

BeforeEach(func() {
namespace = setupSpecNamespace(specName)
namespace = setupSpecNamespace(specName, testSpecificSettingsGetter().PostNamespaceCreatedFunc)
})

AfterEach(func() {
Expand Down
Loading