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 all 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
37 changes: 27 additions & 10 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 @@ -64,17 +66,23 @@ var _ = Describe("When testing clusterctl upgrades using ClusterClass (CAPV 1.10
// InitWithKubernetesVersion should be the highest kubernetes version supported by the init Cluster API version.
// This is to guarantee that both, the old and new CAPI version, support the defined version.
// Ensure all Kubernetes versions used here are covered in patch-vsphere-template.yaml
InitWithKubernetesVersion: "v1.30.0",
WorkloadKubernetesVersion: "v1.30.0",
WorkloadFlavor: testSpecificSettingsGetter().FlavorForMode("workload"),
InitWithKubernetesVersion: "v1.30.0",
WorkloadKubernetesVersion: "v1.30.0",
WorkloadFlavor: testSpecificSettingsGetter().FlavorForMode("workload"),
// We are using a separate management cluster. For running in VCSim we also have to pass WithAdditionalVCSimServer
// below otherwise there will be no VCSim instance created in the management cluster.
UseKindForManagementCluster: true,
KindManagementClusterNewClusterProxyFunc: kindManagementClusterNewClusterProxyFunc,
}
})
}, WithIP("WORKLOAD_CONTROL_PLANE_ENDPOINT_IP"))
},
WithIP("WORKLOAD_CONTROL_PLANE_ENDPOINT_IP"),
// This is required because we are using a separate management cluster with kind by passing `UseKindForManagementCluster` above.
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 @@ -102,14 +110,20 @@ var _ = Describe("When testing clusterctl upgrades using ClusterClass (CAPV 1.9=
// InitWithKubernetesVersion should be the highest kubernetes version supported by the init Cluster API version.
// This is to guarantee that both, the old and new CAPI version, support the defined version.
// Ensure all Kubernetes versions used here are covered in patch-vsphere-template.yaml
InitWithKubernetesVersion: "v1.29.0",
WorkloadKubernetesVersion: "v1.29.0",
WorkloadFlavor: testSpecificSettingsGetter().FlavorForMode("workload"),
InitWithKubernetesVersion: "v1.29.0",
WorkloadKubernetesVersion: "v1.29.0",
WorkloadFlavor: testSpecificSettingsGetter().FlavorForMode("workload"),
// We are using a separate management cluster. For running in VCSim we also have to pass WithAdditionalVCSimServer
// below otherwise there will be no VCSim instance created in the management cluster.
UseKindForManagementCluster: true,
KindManagementClusterNewClusterProxyFunc: kindManagementClusterNewClusterProxyFunc,
}
})
}, WithIP("WORKLOAD_CONTROL_PLANE_ENDPOINT_IP"))
},
WithIP("WORKLOAD_CONTROL_PLANE_ENDPOINT_IP"),
// This is required because we are using a separate management cluster with kind by passing `UseKindForManagementCluster` above.
WithAdditionalVCSimServer(true),
)
})

// getStableReleaseOfMinor returns the latest stable version of minorRelease.
Expand All @@ -119,5 +133,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 @@ -78,6 +78,8 @@ spec:
name: etchosts
- name: controlPlaneIpAddr
value: ${CONTROL_PLANE_ENDPOINT_IP}
- name: controlPlanePort
value: ${CONTROL_PLANE_ENDPOINT_PORT:=6443}
- name: credsSecretName
value: '${CLUSTER_NAME}'
version: '${KUBERNETES_VERSION}'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ 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
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