Skip to content

Commit

Permalink
test: add autoscaler test for supervisor including scale from/to zero
Browse files Browse the repository at this point in the history
  • Loading branch information
chrischdi committed Aug 26, 2024
1 parent 808f10b commit 933329c
Show file tree
Hide file tree
Showing 2 changed files with 64 additions and 4 deletions.
54 changes: 54 additions & 0 deletions test/e2e/autoscaler_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
/*
Copyright 2024 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

package e2e

import (
. "github.com/onsi/ginkgo/v2"
"k8s.io/utils/ptr"
capi_e2e "sigs.k8s.io/cluster-api/test/e2e"
"sigs.k8s.io/cluster-api/test/framework"
)

var _ = Describe("When using the autoscaler with Cluster API using ClusterClass and scale to zero [vcsim] [supervisor] [ClusterClass]", func() {
const specName = "autoscaler" // aligned to CAPI
Setup(specName, func(testSpecificSettingsGetter func() testSettings) {
capi_e2e.AutoscalerSpec(ctx, func() capi_e2e.AutoscalerSpecInput {
return capi_e2e.AutoscalerSpecInput{
E2EConfig: e2eConfig,
ClusterctlConfigPath: testSpecificSettingsGetter().ClusterctlConfigPath,
BootstrapClusterProxy: bootstrapClusterProxy,
ArtifactFolder: artifactFolder,
SkipCleanup: skipCleanup,
Flavor: ptr.To(testSpecificSettingsGetter().FlavorForMode("topology-autoscaler")),
PostNamespaceCreated: func(managementClusterProxy framework.ClusterProxy, workloadClusterNamespace string) {
if testMode == GovmomiTestMode {
// This test is only implemented for supervisor
Skip("This test is only implemented for supervisor")
}
testSpecificSettingsGetter().PostNamespaceCreatedFunc(managementClusterProxy, workloadClusterNamespace)
},
InfrastructureAPIGroup: "vmware.infrastructure.cluster.x-k8s.io",
InfrastructureMachineTemplateKind: "vspheremachinetemplates",
AutoscalerVersion: "v1.30.0",
ScaleToAndFromZero: true,
// We have no connectivity from the workload cluster to the kind management cluster in CI so we
// can't deploy the autoscaler to the workload cluster.
InstallOnManagementCluster: true,
}
})
})
})
14 changes: 10 additions & 4 deletions test/e2e/config/vsphere.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,7 @@ variables:
KUBERNETES_VERSION_LATEST_CI: "ci/latest-1.32"
CPI_IMAGE_K8S_VERSION: "v1.31.0"
CNI: "./data/cni/calico/calico.yaml"
AUTOSCALER_WORKLOAD: "./data/autoscaler/autoscaler-to-management-workload.yaml"
EXP_CLUSTER_RESOURCE_SET: "true"
EXP_KUBEADM_BOOTSTRAP_FORMAT_IGNITION: "true"
CONTROL_PLANE_MACHINE_COUNT: 1
Expand All @@ -273,11 +274,15 @@ variables:
VSPHERE_STORAGE_POLICY: "Cluster API vSphere Storage Policy"
VSPHERE_STORAGE_CLASS: "test-storageclass"
VSPHERE_MACHINE_CLASS_NAME: "test-machine-class"
VSPHERE_MACHINE_CLASS_CPU: "4"
VSPHERE_MACHINE_CLASS_MEMORY: "8Gi"
# CI runs vm-operator v1.8.6 on vCenter 8, setting CPU and Memory does not work and defaults to 2 CPUs / 2Gi memory.
# Changing the value results in VM's getting created but not setting the correct CPU or memory size.
VSPHERE_MACHINE_CLASS_CPU: "2"
VSPHERE_MACHINE_CLASS_MEMORY: "2Gi"
VSPHERE_MACHINE_CLASS_NAME_CONFORMANCE: "test-machine-class-conformance"
VSPHERE_MACHINE_CLASS_CPU_CONFORMANCE: "8"
VSPHERE_MACHINE_CLASS_MEMORY_CONFORMANCE: "8Gi"
# CI runs vm-operator v1.8.6 on vCenter 8, setting CPU and Memory does not work and defaults to 2 CPUs / 2Gi memory.
# Changing the value results in VM's getting created but not setting the correct CPU or memory size.
VSPHERE_MACHINE_CLASS_CPU_CONFORMANCE: "2"
VSPHERE_MACHINE_CLASS_MEMORY_CONFORMANCE: "2Gi"
VSPHERE_CONTENT_LIBRARY: "capv"
VSPHERE_CONTENT_LIBRARY_ITEMS: "ubuntu-2204-kube-v1.28.0,ubuntu-2204-kube-v1.29.0,ubuntu-2204-kube-v1.30.0,ubuntu-2404-kube-v1.31.0"
VSPHERE_IMAGE_NAME: "ubuntu-2404-kube-v1.31.0"
Expand All @@ -303,6 +308,7 @@ variables:
SERVICE_ACCOUNTS_CM_NAME: "service-accounts-cm"

intervals:
default/wait-autoscaler: ["5m", "10s"]
default/wait-controllers: ["5m", "10s"]
default/wait-cluster: ["5m", "10s"]
default/wait-control-plane: ["10m", "10s"]
Expand Down

0 comments on commit 933329c

Please sign in to comment.