Skip to content

Commit 3a19ef5

Browse files
authored
test: add bare metal support for e2e tests (#12)
1 parent d1b09dc commit 3a19ef5

File tree

7 files changed

+65
-1
lines changed

7 files changed

+65
-1
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ test/e2e/data/infrastructure-oci/v1beta1/cluster-template-md-remediation.yaml
4040
test/e2e/data/infrastructure-oci/v1beta1/cluster-template-node-drain.yaml
4141
test/e2e/data/infrastructure-oci/v1beta1/cluster-template-oracle-linux.yaml
4242
test/e2e/data/infrastructure-oci/v1beta1/cluster-template.yaml
43+
test/e2e/data/infrastructure-oci/v1beta1/cluster-template-bare-metal.yaml
4344
test/e2e/data/infrastructure-oci/v1beta1/cluster-template-custom-networking-seclist.yaml
4445
test/e2e/data/infrastructure-oci/v1beta1/cluster-template-custom-networking-nsg.yaml
4546
test/e2e/data/infrastructure-oci/v1beta1/cluster-template-multiple-node-nsg.yaml

Makefile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ ARTIFACTS ?= $(ROOT_DIR)/_artifacts
4848
KUBETEST_CONF_PATH ?= $(abspath $(E2E_DATA_DIR)/kubetest/conformance.yaml)
4949
KUBETEST_FAST_CONF_PATH ?= $(abspath $(E2E_DATA_DIR)/kubetest/conformance-fast.yaml)
5050
GINKGO_FOCUS ?= Workload cluster creation
51-
GINKGO_SKIP ?=
51+
GINKGO_SKIP ?= "Bare Metal"
5252
# Image URL to use all building/pushing image targets
5353
IMG ?= controller:latest
5454
# Produce CRDs that work back to Kubernetes 1.11 (no version conversion)
@@ -233,6 +233,7 @@ endef
233233
.PHONY: generate-e2e-templates ## Generate OCI infrastructure templates for e2e test suite.
234234
generate-e2e-templates: kustomize
235235
$(KUSTOMIZE) build $(OCI_TEMPLATES)/v1beta1/cluster-template --load_restrictor LoadRestrictionsNone > $(OCI_TEMPLATES)/v1beta1/cluster-template.yaml
236+
$(KUSTOMIZE) build $(OCI_TEMPLATES)/v1beta1/cluster-template-bare-metal --load_restrictor LoadRestrictionsNone > $(OCI_TEMPLATES)/v1beta1/cluster-template-bare-metal.yaml
236237
$(KUSTOMIZE) build $(OCI_TEMPLATES)/v1beta1/cluster-template-md-remediation --load_restrictor LoadRestrictionsNone > $(OCI_TEMPLATES)/v1beta1/cluster-template-md-remediation.yaml
237238
$(KUSTOMIZE) build $(OCI_TEMPLATES)/v1beta1/cluster-template-kcp-remediation --load_restrictor LoadRestrictionsNone > $(OCI_TEMPLATES)/v1beta1/cluster-template-kcp-remediation.yaml
238239
$(KUSTOMIZE) build $(OCI_TEMPLATES)/v1beta1/cluster-template-node-drain --load_restrictor LoadRestrictionsNone > $(OCI_TEMPLATES)/v1beta1/cluster-template-node-drain.yaml

test/e2e/cluster_test.go

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -370,6 +370,31 @@ var _ = Describe("Workload cluster creation", func() {
370370

371371
verifyMultipleNsgSubnet(ctx, namespace.Name, clusterName, result.MachineDeployments)
372372
})
373+
374+
When("Bare Metal workload cluster creation", func() {
375+
376+
It("Bare Metal - With 1 control-plane nodes and 1 worker nodes", func() {
377+
clusterName = getClusterName(clusterNamePrefix, "bare-metal")
378+
clusterctl.ApplyClusterTemplateAndWait(ctx, clusterctl.ApplyClusterTemplateAndWaitInput{
379+
ClusterProxy: bootstrapClusterProxy,
380+
ConfigCluster: clusterctl.ConfigClusterInput{
381+
LogFolder: filepath.Join(artifactFolder, "clusters", bootstrapClusterProxy.GetName()),
382+
ClusterctlConfigPath: clusterctlConfigPath,
383+
KubeconfigPath: bootstrapClusterProxy.GetKubeconfigPath(),
384+
InfrastructureProvider: clusterctl.DefaultInfrastructureProvider,
385+
Flavor: "bare-metal",
386+
Namespace: namespace.Name,
387+
ClusterName: clusterName,
388+
KubernetesVersion: e2eConfig.GetVariable(capi_e2e.KubernetesVersion),
389+
ControlPlaneMachineCount: pointer.Int64Ptr(1),
390+
WorkerMachineCount: pointer.Int64Ptr(1),
391+
},
392+
WaitForClusterIntervals: e2eConfig.GetIntervals(specName, "wait-cluster-bare-metal"),
393+
WaitForControlPlaneIntervals: e2eConfig.GetIntervals(specName, "wait-control-plane-bare-metal"),
394+
WaitForMachineDeployments: e2eConfig.GetIntervals(specName, "wait-worker-nodes-bare-metal"),
395+
}, result)
396+
})
397+
})
373398
})
374399

375400
func verifyMultipleNsgSubnet(ctx context.Context, namespace string, clusterName string, mcDeployments []*clusterv1.MachineDeployment) {

test/e2e/config/e2e_conf.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ providers:
5353
contract: v1beta1
5454
files:
5555
- sourcePath: "../data/infrastructure-oci/v1beta1/cluster-template.yaml"
56+
- sourcePath: "../data/infrastructure-oci/v1beta1/cluster-template-bare-metal.yaml"
5657
- sourcePath: "../data/infrastructure-oci/v1beta1/cluster-template-kcp-remediation.yaml"
5758
- sourcePath: "../data/infrastructure-oci/v1beta1/cluster-template-md-remediation.yaml"
5859
- sourcePath: "../data/infrastructure-oci/v1beta1/cluster-template-node-drain.yaml"
@@ -89,6 +90,9 @@ intervals:
8990
default/wait-cluster: ["30m", "10s"]
9091
default/wait-control-plane: ["30m", "10s"]
9192
default/wait-worker-nodes: ["30m", "10s"]
93+
default/wait-cluster-bare-metal: [ "60m", "10s" ]
94+
default/wait-control-plane-bare-metal: [ "60m", "10s" ]
95+
default/wait-worker-nodes-bare-metal: [ "60m", "10s" ]
9296
default/wait-delete-cluster: ["30m", "10s"]
9397
default/wait-machine-upgrade: ["60m", "10s"]
9498
default/wait-machine-remediation: ["30m", "10s"]
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
kind: OCIMachineTemplate
2+
apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
3+
metadata:
4+
name: "${CLUSTER_NAME}-control-plane"
5+
spec:
6+
template:
7+
spec:
8+
shape: "BM.Standard2.52"
9+
shapeConfig:
10+
ocpus: "52"
11+
memoryInGBs: "768"
12+
isPvEncryptionInTransitEnabled: false
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
bases:
2+
- ../bases/cluster.yaml
3+
- ../bases/md.yaml
4+
- ../bases/crs.yaml
5+
- ../bases/ccm.yaml
6+
7+
patchesStrategicMerge:
8+
- ./cluster.yaml
9+
- ./md.yaml
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
2+
kind: OCIMachineTemplate
3+
metadata:
4+
name: "${CLUSTER_NAME}-md-0"
5+
spec:
6+
template:
7+
spec:
8+
shape: "BM.Standard2.52"
9+
shapeConfig:
10+
ocpus: "52"
11+
memoryInGBs: "768"
12+
isPvEncryptionInTransitEnabled: false

0 commit comments

Comments
 (0)