diff --git a/Makefile b/Makefile index 0cdd685cf8..e2f87fad1c 100644 --- a/Makefile +++ b/Makefile @@ -206,7 +206,9 @@ e2e-templates: $(addprefix $(E2E_NO_ARTIFACT_TEMPLATES_DIR)/, \ cluster-template-health-monitor.yaml \ cluster-template-capi-v1beta1.yaml \ cluster-template-cluster-identity.yaml \ - cluster-template-topology-autoscaler.yaml) + cluster-template-topology-autoscaler.yaml \ + cluster-template-topology-ubuntu.yaml \ + cluster-template-topology-bastion.yaml) # Currently no templates that require CI artifacts # $(addprefix $(E2E_TEMPLATES_DIR)/, add-templates-here.yaml) \ diff --git a/test/e2e/data/e2e_conf.yaml b/test/e2e/data/e2e_conf.yaml index 26f78b4226..b02673b9a3 100644 --- a/test/e2e/data/e2e_conf.yaml +++ b/test/e2e/data/e2e_conf.yaml @@ -138,6 +138,8 @@ providers: - sourcePath: "./infrastructure-openstack-no-artifact/cluster-template-without-lb.yaml" - sourcePath: "./infrastructure-openstack-no-artifact/cluster-template-cluster-identity.yaml" - sourcePath: "./infrastructure-openstack-no-artifact/cluster-template-topology-autoscaler.yaml" + - sourcePath: "./infrastructure-openstack-no-artifact/cluster-template-topology-ubuntu.yaml" + - sourcePath: "./infrastructure-openstack-no-artifact/cluster-template-topology-bastion.yaml" - sourcePath: "../../../templates/clusterclass-dev-test.yaml" replacements: - old: gcr.io/k8s-staging-capi-openstack/capi-openstack-controller:dev diff --git a/test/e2e/data/kustomize/topology-bastion/cluster.yaml b/test/e2e/data/kustomize/topology-bastion/cluster.yaml new file mode 100644 index 0000000000..44864c906a --- /dev/null +++ b/test/e2e/data/kustomize/topology-bastion/cluster.yaml @@ -0,0 +1,39 @@ +# Topology cluster using a standard ubuntu image with bastion enabled. +apiVersion: cluster.x-k8s.io/v1beta2 +kind: Cluster +metadata: + name: ${CLUSTER_NAME} +spec: + topology: + classRef: + name: dev-test + version: ${KUBERNETES_VERSION} + controlPlane: + replicas: ${CONTROL_PLANE_MACHINE_COUNT} + workers: + machineDeployments: + - class: default-worker + name: md-0 + replicas: ${WORKER_MACHINE_COUNT} + variables: + - name: identityRef + value: + name: ${CLUSTER_NAME}-cloud-config + cloudName: ${OPENSTACK_CLOUD} + - name: imageRef + value: node-image + - name: addImageVersion + value: false + - name: injectIgnitionSysext + value: false + - name: allowedCIDRs + value: ${OPENSTACK_API_SERVER_ALLOWED_CIDRS:=[]} + - name: bastion + value: + enabled: true + spec: + flavor: ${OPENSTACK_BASTION_FLAVOR:=m1.small} + image: + imageRef: + name: bastion-image + sshKeyName: ${OPENSTACK_SSH_KEY_NAME:=""} diff --git a/test/e2e/data/kustomize/topology-bastion/kustomization.yaml b/test/e2e/data/kustomize/topology-bastion/kustomization.yaml new file mode 100644 index 0000000000..e4ce23d7a7 --- /dev/null +++ b/test/e2e/data/kustomize/topology-bastion/kustomization.yaml @@ -0,0 +1,10 @@ +apiVersion: kustomize.config.k8s.io/v1beta1 +kind: Kustomization + +resources: +- cluster.yaml +- secret.yaml + +components: +- ../components/images +- ../components/cluster-resource-sets diff --git a/test/e2e/data/kustomize/topology-bastion/secret.yaml b/test/e2e/data/kustomize/topology-bastion/secret.yaml new file mode 100644 index 0000000000..2d6641ada9 --- /dev/null +++ b/test/e2e/data/kustomize/topology-bastion/secret.yaml @@ -0,0 +1,9 @@ +apiVersion: v1 +data: + cacert: ${OPENSTACK_CLOUD_CACERT_B64} + clouds.yaml: ${OPENSTACK_CLOUD_YAML_B64} +kind: Secret +metadata: + labels: + clusterctl.cluster.x-k8s.io/move: "true" + name: ${CLUSTER_NAME}-cloud-config diff --git a/test/e2e/data/kustomize/topology-ubuntu/cluster.yaml b/test/e2e/data/kustomize/topology-ubuntu/cluster.yaml new file mode 100644 index 0000000000..bbdfa26bc2 --- /dev/null +++ b/test/e2e/data/kustomize/topology-ubuntu/cluster.yaml @@ -0,0 +1,39 @@ +# Topology cluster using a standard ubuntu image without ignition/sysext. +apiVersion: cluster.x-k8s.io/v1beta2 +kind: Cluster +metadata: + name: ${CLUSTER_NAME} +spec: + topology: + classRef: + name: dev-test + version: ${KUBERNETES_VERSION} + controlPlane: + replicas: ${CONTROL_PLANE_MACHINE_COUNT} + workers: + machineDeployments: + - class: default-worker + name: md-0 + replicas: ${WORKER_MACHINE_COUNT} + variables: + - name: identityRef + value: + name: ${CLUSTER_NAME}-cloud-config + cloudName: ${OPENSTACK_CLOUD} + - name: imageRef + value: node-image + - name: addImageVersion + value: false + - name: injectIgnitionSysext + value: false + - name: allowedCIDRs + value: ${OPENSTACK_API_SERVER_ALLOWED_CIDRS:=[]} + - name: bastion + value: + enabled: ${OPENSTACK_BASTION_ENABLED:=false} + spec: + flavor: ${OPENSTACK_BASTION_FLAVOR:=m1.small} + image: + imageRef: + name: bastion-image + sshKeyName: ${OPENSTACK_SSH_KEY_NAME:=""} diff --git a/test/e2e/data/kustomize/topology-ubuntu/kustomization.yaml b/test/e2e/data/kustomize/topology-ubuntu/kustomization.yaml new file mode 100644 index 0000000000..e4ce23d7a7 --- /dev/null +++ b/test/e2e/data/kustomize/topology-ubuntu/kustomization.yaml @@ -0,0 +1,10 @@ +apiVersion: kustomize.config.k8s.io/v1beta1 +kind: Kustomization + +resources: +- cluster.yaml +- secret.yaml + +components: +- ../components/images +- ../components/cluster-resource-sets diff --git a/test/e2e/data/kustomize/topology-ubuntu/secret.yaml b/test/e2e/data/kustomize/topology-ubuntu/secret.yaml new file mode 100644 index 0000000000..2d6641ada9 --- /dev/null +++ b/test/e2e/data/kustomize/topology-ubuntu/secret.yaml @@ -0,0 +1,9 @@ +apiVersion: v1 +data: + cacert: ${OPENSTACK_CLOUD_CACERT_B64} + clouds.yaml: ${OPENSTACK_CLOUD_YAML_B64} +kind: Secret +metadata: + labels: + clusterctl.cluster.x-k8s.io/move: "true" + name: ${CLUSTER_NAME}-cloud-config diff --git a/test/e2e/shared/defaults.go b/test/e2e/shared/defaults.go index b344047833..b7308238a1 100644 --- a/test/e2e/shared/defaults.go +++ b/test/e2e/shared/defaults.go @@ -66,6 +66,8 @@ const ( FlavorCapiV1Beta1 = "capi-v1beta1" FlavorClusterIdentity = "cluster-identity" FlavorTopologyAutoscaler = "topology-autoscaler" + FlavorTopologyUbuntu = "topology-ubuntu" + FlavorTopologyBastion = "topology-bastion" ) // DefaultScheme returns the default scheme to use for testing. diff --git a/test/e2e/suites/e2e/clusterclass_test.go b/test/e2e/suites/e2e/clusterclass_test.go new file mode 100644 index 0000000000..5273dc14c5 --- /dev/null +++ b/test/e2e/suites/e2e/clusterclass_test.go @@ -0,0 +1,55 @@ +//go:build e2e + +/* +Copyright 2025 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 ( + "context" + + . "github.com/onsi/ginkgo/v2" + "k8s.io/utils/ptr" + capi_e2e "sigs.k8s.io/cluster-api/test/e2e" + + shared "sigs.k8s.io/cluster-api-provider-openstack/test/e2e/shared" +) + +var _ = Describe("ClusterClass with ubuntu image [ClusterClass]", func() { + capi_e2e.QuickStartSpec(context.TODO(), func() capi_e2e.QuickStartSpecInput { + return capi_e2e.QuickStartSpecInput{ + E2EConfig: e2eCtx.E2EConfig, + ClusterctlConfigPath: e2eCtx.Environment.ClusterctlConfigPath, + BootstrapClusterProxy: e2eCtx.Environment.BootstrapClusterProxy, + ArtifactFolder: e2eCtx.Settings.ArtifactFolder, + SkipCleanup: false, + Flavor: ptr.To(shared.FlavorTopologyUbuntu), + } + }) +}) + +var _ = Describe("ClusterClass with bastion [ClusterClass]", func() { + capi_e2e.QuickStartSpec(context.TODO(), func() capi_e2e.QuickStartSpecInput { + return capi_e2e.QuickStartSpecInput{ + E2EConfig: e2eCtx.E2EConfig, + ClusterctlConfigPath: e2eCtx.Environment.ClusterctlConfigPath, + BootstrapClusterProxy: e2eCtx.Environment.BootstrapClusterProxy, + ArtifactFolder: e2eCtx.Settings.ArtifactFolder, + SkipCleanup: false, + Flavor: ptr.To(shared.FlavorTopologyBastion), + } + }) +})