Skip to content

Commit 6dee4bc

Browse files
Merge pull request #1954 from Nordix/Add-fakeIPA-e2e-test/mboukhalfa
🌱 Add e2e scalability test with fake systems
2 parents 4e67d9f + 08eda7d commit 6dee4bc

File tree

14 files changed

+645
-35
lines changed

14 files changed

+645
-35
lines changed

Makefile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,8 @@ E2E_TEMPLATES_DIR ?= $(ROOT_DIR)/test/e2e/data/infrastructure-metal3
173173
cluster-templates: $(KUSTOMIZE) ## Generate cluster templates
174174
$(KUSTOMIZE) build $(E2E_TEMPLATES_DIR)/cluster-template-ubuntu > $(E2E_OUT_DIR)/cluster-template-ubuntu.yaml
175175
$(KUSTOMIZE) build $(E2E_TEMPLATES_DIR)/cluster-template-centos > $(E2E_OUT_DIR)/cluster-template-centos.yaml
176+
$(KUSTOMIZE) build $(E2E_TEMPLATES_DIR)/cluster-template-centos-fake > $(E2E_OUT_DIR)/cluster-template-centos-fake.yaml
177+
$(KUSTOMIZE) build $(E2E_TEMPLATES_DIR)/clusterclass-metal3 > $(E2E_OUT_DIR)/clusterclass-metal3.yaml
176178
$(KUSTOMIZE) build $(E2E_TEMPLATES_DIR)/cluster-template-upgrade-workload > $(E2E_OUT_DIR)/cluster-template-upgrade-workload.yaml
177179
$(KUSTOMIZE) build $(E2E_TEMPLATES_DIR)/cluster-template-centos-md-remediation > $(E2E_OUT_DIR)/cluster-template-centos-md-remediation.yaml
178180
$(KUSTOMIZE) build $(E2E_TEMPLATES_DIR)/cluster-template-ubuntu-md-remediation > $(E2E_OUT_DIR)/cluster-template-ubuntu-md-remediation.yaml

scripts/ci-e2e.sh

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,18 +34,24 @@ export KUBERNETES_VERSION=${KUBERNETES_VERSION}
3434
export IMAGE_OS=${IMAGE_OS}
3535
export FORCE_REPO_UPDATE="false"
3636
EOF
37-
# if running a clusterctl-upgrade test skip apply bmhs in dev-env
37+
# if running a scalability test skip apply bmhs in dev-env and run fakeIPA
3838
if [[ ${GINKGO_FOCUS:-} == "clusterctl-upgrade" ]]; then
3939
echo 'export SKIP_APPLY_BMH="true"' >>"${M3_DEV_ENV_PATH}/config_${USER}.sh"
4040
fi
4141
if [[ ${GINKGO_FOCUS:-} == "features" ]]; then
4242
mkdir -p "$CAPI_CONFIG_FOLDER"
4343
echo "ENABLE_BMH_NAME_BASED_PREALLOCATION: true" >"$CAPI_CONFIG_FOLDER/clusterctl.yaml"
4444
fi
45-
# if running a scalability test skip apply bmhs in dev-env and run fakeIPA
45+
# if running a scalability tests, configure dev-env with fakeIPA
4646
if [[ ${GINKGO_FOCUS:-} == "scalability" ]]; then
47-
echo 'export SKIP_APPLY_BMH="true"' >>"${M3_DEV_ENV_PATH}/config_${USER}.sh"
4847
echo 'export NODES_PLATFORM="fake"' >>"${M3_DEV_ENV_PATH}/config_${USER}.sh"
48+
echo 'export SKIP_APPLY_BMH="true"' >>"${M3_DEV_ENV_PATH}/config_${USER}.sh"
49+
mkdir -p "$CAPI_CONFIG_FOLDER"
50+
echo 'CLUSTER_TOPOLOGY: true' >"$CAPI_CONFIG_FOLDER/clusterctl.yaml"
51+
echo 'export EPHEMERAL_CLUSTER="minikube"' >>"${M3_DEV_ENV_PATH}/config_${USER}.sh"
52+
else
53+
# Don't run scalability tests if not asked for.
54+
export GINKGO_SKIP="${GINKGO_SKIP:-} scalability"
4955
fi
5056
# Run make devenv to boot the source cluster
5157
pushd "${M3_DEV_ENV_PATH}" || exit 1

scripts/environment.sh

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,11 @@ fi
6464

6565
# Scalability test environment vars and config
6666
if [[ ${GINKGO_FOCUS:-} == "scalability" ]]; then
67-
export NUM_NODES=${NUM_NODES:-"100"}
68-
export BMH_BATCH_SIZE=${BMH_BATCH_SIZE:-"20"}
67+
export NUM_NODES=${NUM_NODES:-"10"}
68+
export BMH_BATCH_SIZE=${BMH_BATCH_SIZE:-"2"}
69+
export CONTROL_PLANE_MACHINE_COUNT=${CONTROL_PLANE_MACHINE_COUNT:-"1"}
70+
export WORKER_MACHINE_COUNT=${WORKER_MACHINE_COUNT:-"0"}
71+
export KUBERNETES_VERSION_UPGRADE_FROM=${FROM_K8S_VERSION}
6972
fi
7073

7174
# Integration test environment vars and config

test/e2e/config/e2e_conf.yaml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,8 +188,13 @@ providers:
188188
targetName: "cluster-template-ubuntu.yaml"
189189
- sourcePath: "../_out/cluster-template-centos.yaml"
190190
targetName: "cluster-template-centos.yaml"
191+
- sourcePath: "../_out/cluster-template-centos-fake.yaml"
192+
targetName: "cluster-template-centos-fake.yaml"
193+
- sourcePath: "../_out/cluster-template-centos-fake.yaml"
194+
targetName: "cluster-template-ubuntu-fake.yaml"
191195
- sourcePath: "../_out/clusterclass.yaml"
192196
targetName: "clusterclass-test-clusterclass.yaml"
197+
- sourcePath: "../_out/clusterclass-metal3.yaml"
193198
- sourcePath: "../_out/cluster-template-centos-md-remediation.yaml"
194199
targetName: "cluster-template-centos-md-remediation.yaml"
195200
- sourcePath: "../_out/cluster-template-ubuntu-md-remediation.yaml"
@@ -246,7 +251,8 @@ variables:
246251
BMO_RELEASE_0.6: "data/bmo-deployment/overlays/release-0.6"
247252
BMO_RELEASE_0.8: "data/bmo-deployment/overlays/release-0.8"
248253
BMO_RELEASE_LATEST: "data/bmo-deployment/overlays/release-latest"
249-
254+
FKAS_RELEASE_LATEST: "data/fkas"
255+
250256
intervals:
251257
default/wait-controllers: ["10m", "10s"]
252258
default/wait-cluster: ["20m", "30s"] # The second time to check the availibility of the cluster should happen late, so kcp object has time to be created
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
resources:
2+
- resources.yaml

test/e2e/data/fkas/resources.yaml

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
---
2+
apiVersion: v1
3+
kind: Namespace
4+
metadata:
5+
name: fkas-system
6+
---
7+
apiVersion: v1
8+
kind: ServiceAccount
9+
metadata:
10+
name: metal3-fkas-sa
11+
namespace: fkas-system
12+
---
13+
apiVersion: rbac.authorization.k8s.io/v1
14+
kind: ClusterRole
15+
metadata:
16+
name: metal3-fkas-role
17+
rules:
18+
- apiGroups: ["metal3.io", "infrastructure.cluster.x-k8s.io"]
19+
resources: ["baremetalhosts", "metal3machines"]
20+
verbs: ["get", "list", "watch"]
21+
- apiGroups: ["cluster.x-k8s.io"]
22+
resources: ["machines"]
23+
verbs: ["get", "list", "watch"]
24+
- apiGroups: [""]
25+
resources: ["secrets"]
26+
verbs: ["get", "list"]
27+
---
28+
apiVersion: rbac.authorization.k8s.io/v1
29+
kind: ClusterRoleBinding
30+
metadata:
31+
name: metal3-fkas-rolebinding
32+
subjects:
33+
- kind: ServiceAccount
34+
name: metal3-fkas-sa
35+
namespace: fkas-system
36+
roleRef:
37+
kind: ClusterRole
38+
name: metal3-fkas-role
39+
apiGroup: rbac.authorization.k8s.io
40+
---
41+
apiVersion: apps/v1
42+
kind: Deployment
43+
metadata:
44+
name: metal3-fkas-system
45+
namespace: fkas-system
46+
spec:
47+
replicas: 1
48+
selector:
49+
matchLabels:
50+
app: metal3-fkas-system
51+
template:
52+
metadata:
53+
labels:
54+
app: metal3-fkas-system
55+
spec:
56+
serviceAccountName: metal3-fkas-sa
57+
hostNetwork: true
58+
containers:
59+
- name: metal3-fkas-reconciler
60+
image: quay.io/metal3-io/metal3-fkas:latest
61+
imagePullPolicy: IfNotPresent
62+
command: ["/reconciler"]
63+
env:
64+
- name: DEBUG
65+
value: "true"
66+
- image: quay.io/metal3-io/metal3-fkas:latest
67+
imagePullPolicy: IfNotPresent
68+
ports:
69+
- containerPort: 3333
70+
env:
71+
- name: POD_IP
72+
valueFrom:
73+
fieldRef:
74+
fieldPath: status.podIP
75+
- name: DEBUG
76+
value: "true"
77+
name: metal3-fkas
Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
---
2+
apiVersion: cluster.x-k8s.io/v1beta1
3+
kind: Cluster
4+
metadata:
5+
labels:
6+
cni: ${CLUSTER_NAME}-crs-0
7+
name: ${CLUSTER_NAME}
8+
namespace: ${NAMESPACE}
9+
spec:
10+
clusterNetwork:
11+
pods:
12+
cidrBlocks: ["${POD_CIDR}"]
13+
services:
14+
cidrBlocks: ["${SERVICE_CIDR}"]
15+
topology:
16+
class: metal3
17+
version: ${KUBERNETES_VERSION}
18+
controlPlane:
19+
replicas: ${CONTROL_PLANE_MACHINE_COUNT}
20+
workers:
21+
machineDeployments:
22+
- class: worker
23+
name: ${CLUSTER_NAME}-machine
24+
replicas: ${WORKER_MACHINE_COUNT}
25+
variables:
26+
- name: image
27+
value:
28+
checksum: ${IMAGE_RAW_CHECKSUM}
29+
checksumType: ${IMAGE_CHECKSUM_TYPE}
30+
format: raw
31+
url: ${IMAGE_RAW_URL}
32+
- name: controlPlaneEndpoint
33+
value:
34+
host: CLUSTER_APIENDPOINT_HOST_HOLDER
35+
port: CLUSTER_APIENDPOINT_PORT_HOLDER
36+
- name: controlPlaneDataTemplate
37+
value: ${CLUSTER_NAME}-controlplane-template
38+
---
39+
apiVersion: ipam.metal3.io/v1alpha1
40+
kind: IPPool
41+
metadata:
42+
name: ${CLUSTER_NAME}-baremetalv4-pool
43+
spec:
44+
clusterName: ${CLUSTER_NAME}
45+
gateway: 192.168.111.1
46+
namePrefix: ${CLUSTER_NAME}-bmv4
47+
pools:
48+
- end: 192.168.111.240
49+
start: 192.168.111.201
50+
prefix: 24
51+
---
52+
apiVersion: ipam.metal3.io/v1alpha1
53+
kind: IPPool
54+
metadata:
55+
name: ${CLUSTER_NAME}-provisioning-pool
56+
spec:
57+
clusterName: ${CLUSTER_NAME}
58+
namePrefix: ${CLUSTER_NAME}-prov
59+
pools:
60+
- end: 172.22.0.240
61+
start: 172.22.0.201
62+
prefix: 24
63+
---
64+
apiVersion: infrastructure.cluster.x-k8s.io/${CAPM3_VERSION}
65+
kind: Metal3DataTemplate
66+
metadata:
67+
name: ${CLUSTER_NAME}-controlplane-template
68+
spec:
69+
clusterName: ${CLUSTER_NAME}
70+
metaData:
71+
ipAddressesFromIPPool:
72+
- key: provisioningIP
73+
name: ${CLUSTER_NAME}-provisioning-pool
74+
objectNames:
75+
- key: name
76+
object: machine
77+
- key: local-hostname
78+
object: machine
79+
- key: local_hostname
80+
object: machine
81+
prefixesFromIPPool:
82+
- key: provisioningCIDR
83+
name: ${CLUSTER_NAME}-provisioning-pool
84+
networkData:
85+
links:
86+
ethernets:
87+
- id: enp1s0
88+
macAddress:
89+
fromHostInterface: enp1s0
90+
type: phy
91+
- id: enp2s0
92+
macAddress:
93+
fromHostInterface: enp2s0
94+
type: phy
95+
networks:
96+
ipv4:
97+
- id: baremetalv4
98+
ipAddressFromIPPool: ${CLUSTER_NAME}-baremetalv4-pool
99+
link: enp2s0
100+
routes:
101+
- gateway:
102+
fromIPPool: ${CLUSTER_NAME}-baremetalv4-pool
103+
network: 0.0.0.0
104+
prefix: 0
105+
services:
106+
dns:
107+
- 8.8.8.8
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
resources:
2+
- cluster-with-topology.yaml
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
resources:
2+
- ../bases/cluster-with-topology

0 commit comments

Comments
 (0)