Skip to content

Commit

Permalink
Add Scalability test
Browse files Browse the repository at this point in the history
Signed-off-by: Mohammed Boukhalfa <[email protected]>
  • Loading branch information
mboukhalfa committed Oct 21, 2024
1 parent 627f9ba commit 1099be2
Show file tree
Hide file tree
Showing 18 changed files with 1,022 additions and 22 deletions.
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,7 @@ E2E_TEMPLATES_DIR ?= $(ROOT_DIR)/test/e2e/data/infrastructure-metal3
cluster-templates: $(KUSTOMIZE) ## Generate cluster templates
$(KUSTOMIZE) build $(E2E_TEMPLATES_DIR)/cluster-template-ubuntu > $(E2E_OUT_DIR)/cluster-template-ubuntu.yaml
$(KUSTOMIZE) build $(E2E_TEMPLATES_DIR)/cluster-template-centos > $(E2E_OUT_DIR)/cluster-template-centos.yaml
$(KUSTOMIZE) build $(E2E_TEMPLATES_DIR)/cluster-template-centos-fake > $(E2E_OUT_DIR)/cluster-template-centos-fake.yaml
$(KUSTOMIZE) build $(E2E_TEMPLATES_DIR)/cluster-template-upgrade-workload > $(E2E_OUT_DIR)/cluster-template-upgrade-workload.yaml
$(KUSTOMIZE) build $(E2E_TEMPLATES_DIR)/cluster-template-centos-md-remediation > $(E2E_OUT_DIR)/cluster-template-centos-md-remediation.yaml
$(KUSTOMIZE) build $(E2E_TEMPLATES_DIR)/cluster-template-ubuntu-md-remediation > $(E2E_OUT_DIR)/cluster-template-ubuntu-md-remediation.yaml
Expand Down
2 changes: 1 addition & 1 deletion docs/ip_reuse.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ included) to the `preAllocations` field in the `IPPool`, i.e:
apiVersion: ipam.metal3.io/v1alpha1
kind: IPPool
metadata:
name: baremetalv4-pool
name: baremetalv4-pool-${CLUSTER_NAME}
namespace: metal3
spec:
clusterName: test1
Expand Down
2 changes: 2 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ require (

replace github.com/metal3-io/cluster-api-provider-metal3/api => ./api

replace sigs.k8s.io/cluster-api/test => github.com/Nordix/cluster-api/test v1.0.1-0.20241021093551-8634871d5229

require (
github.com/NYTimes/gziphandler v1.1.1 // indirect
github.com/antlr/antlr4/runtime/Go/antlr/v4 v4.0.0-20230305170008-8188dc5388df // indirect
Expand Down
8 changes: 6 additions & 2 deletions scripts/ci-e2e.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ source "${REPO_ROOT}/scripts/environment.sh"
# Clone dev-env repo
sudo mkdir -p ${WORKING_DIR}
sudo chown "${USER}":"${USER}" ${WORKING_DIR}
M3_DEV_ENV_REPO="https://github.com/metal3-io/metal3-dev-env.git"
M3_DEV_ENV_BRANCH=main
M3_DEV_ENV_REPO="https://github.com/Nordix/metal3-dev-env.git"
M3_DEV_ENV_BRANCH=Integrate-fakeIPA/mohammed
M3_DEV_ENV_PATH="${M3_DEV_ENV_PATH:-${WORKING_DIR}/metal3-dev-env}"
clone_repo "${M3_DEV_ENV_REPO}" "${M3_DEV_ENV_BRANCH}" "${M3_DEV_ENV_PATH}"

Expand All @@ -42,6 +42,10 @@ if [[ ${GINKGO_FOCUS:-} == "features" ]]; then
mkdir -p "$CAPI_CONFIG_FOLDER"
echo "ENABLE_BMH_NAME_BASED_PREALLOCATION: true" >"$CAPI_CONFIG_FOLDER/clusterctl.yaml"
fi
# if running a scalability test run DevEnv with fakeIPA
if [[ ${GINKGO_FOCUS:-} == "scalability" ]]; then
echo 'export NODES_PLATFORM="fake"' >>"${M3_DEV_ENV_PATH}/config_${USER}.sh"
fi
# Run make devenv to boot the source cluster
pushd "${M3_DEV_ENV_PATH}" || exit 1
make
Expand Down
8 changes: 8 additions & 0 deletions scripts/environment.sh
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,14 @@ if [[ ${GINKGO_FOCUS:-} == "clusterctl-upgrade" ]]; then
export NUM_NODES="5"
fi

# Scalability test environment vars and config
if [[ ${GINKGO_FOCUS:-} == "scalability" ]]; then
export NUM_NODES=${NUM_NODES:-"40"}
export BMH_BATCH_SIZE=${BMH_BATCH_SIZE:-"5"}
export CONTROL_PLANE_MACHINE_COUNT=${CONTROL_PLANE_MACHINE_COUNT:-"1"}
export WORKER_MACHINE_COUNT=${WORKER_MACHINE_COUNT:-"1"}
fi

# Integration test environment vars and config
if [[ ${GINKGO_FOCUS:-} == "integration" || ${GINKGO_FOCUS:-} == "basic" ]]; then
export NUM_NODES=${NUM_NODES:-"2"}
Expand Down
5 changes: 4 additions & 1 deletion test/e2e/config/e2e_conf.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,8 @@ providers:
targetName: "cluster-template-ubuntu.yaml"
- sourcePath: "../_out/cluster-template-centos.yaml"
targetName: "cluster-template-centos.yaml"
- sourcePath: "../_out/cluster-template-centos-fake.yaml"
targetName: "cluster-template-centos-fake.yaml"
- sourcePath: "../_out/clusterclass.yaml"
targetName: "clusterclass-test-clusterclass.yaml"
- sourcePath: "../_out/cluster-template-centos-md-remediation.yaml"
Expand Down Expand Up @@ -210,7 +212,8 @@ variables:
BMO_RELEASE_0.5: "data/bmo-deployment/overlays/release-0.5"
BMO_RELEASE_0.6: "data/bmo-deployment/overlays/release-0.6"
BMO_RELEASE_LATEST: "data/bmo-deployment/overlays/release-latest"

FKAS_RELEASE_LATEST: "data/fkas"

intervals:
default/wait-controllers: ["10m", "10s"]
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
Expand Down
2 changes: 2 additions & 0 deletions test/e2e/data/fkas/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
resources:
- resources.yaml
77 changes: 77 additions & 0 deletions test/e2e/data/fkas/resources.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
---
apiVersion: v1
kind: Namespace
metadata:
name: fkas-system
---
apiVersion: v1
kind: ServiceAccount
metadata:
name: metal3-fkas-sa
namespace: fkas-system
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: metal3-fkas-role
rules:
- apiGroups: ["metal3.io", "infrastructure.cluster.x-k8s.io"]
resources: ["baremetalhosts", "metal3machines"]
verbs: ["get", "list", "watch"]
- apiGroups: ["cluster.x-k8s.io"]
resources: ["machines"]
verbs: ["get", "list", "watch"]
- apiGroups: [""]
resources: ["secrets"]
verbs: ["get", "list"]
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: metal3-fkas-rolebinding
subjects:
- kind: ServiceAccount
name: metal3-fkas-sa
namespace: fkas-system
roleRef:
kind: ClusterRole
name: metal3-fkas-role
apiGroup: rbac.authorization.k8s.io
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: metal3-fkas-system
namespace: fkas-system
spec:
replicas: 1
selector:
matchLabels:
app: metal3-fkas-system
template:
metadata:
labels:
app: metal3-fkas-system
spec:
serviceAccountName: metal3-fkas-sa
hostNetwork: true
containers:
- name: metal3-fkas-reconciler
image: 192.168.111.1:5000/localimages/api-server
imagePullPolicy: IfNotPresent
command: ["/reconciler"]
env:
- name: DEBUG
value: "true"
- image: 192.168.111.1:5000/localimages/api-server
imagePullPolicy: IfNotPresent
ports:
- containerPort: 3333
env:
- name: POD_IP
valueFrom:
fieldRef:
fieldPath: status.podIP
- name: DEBUG
value: "true"
name: metal3-fkas
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ spec:
metaData:
ipAddressesFromIPPool:
- key: provisioningIP
name: provisioning-pool
name: provisioning-pool-${CLUSTER_NAME}
objectNames:
- key: name
object: machine
Expand All @@ -92,7 +92,7 @@ spec:
object: machine
prefixesFromIPPool:
- key: provisioningCIDR
name: provisioning-pool
name: provisioning-pool-${CLUSTER_NAME}
networkData:
links:
ethernets:
Expand All @@ -107,11 +107,11 @@ spec:
networks:
ipv4:
- id: baremetalv4
ipAddressFromIPPool: baremetalv4-pool
ipAddressFromIPPool: baremetalv4-pool-${CLUSTER_NAME}
link: enp2s0
routes:
- gateway:
fromIPPool: baremetalv4-pool
fromIPPool: baremetalv4-pool-${CLUSTER_NAME}
network: 0.0.0.0
prefix: 0
services:
Expand Down
8 changes: 4 additions & 4 deletions test/e2e/data/infrastructure-metal3/bases/cluster/md.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ spec:
metaData:
ipAddressesFromIPPool:
- key: provisioningIP
name: provisioning-pool
name: provisioning-pool-${CLUSTER_NAME}
objectNames:
- key: name
object: machine
Expand All @@ -69,7 +69,7 @@ spec:
object: machine
prefixesFromIPPool:
- key: provisioningCIDR
name: provisioning-pool
name: provisioning-pool-${CLUSTER_NAME}
networkData:
links:
ethernets:
Expand All @@ -84,11 +84,11 @@ spec:
networks:
ipv4:
- id: baremetalv4
ipAddressFromIPPool: baremetalv4-pool
ipAddressFromIPPool: baremetalv4-pool-${CLUSTER_NAME}
link: enp2s0
routes:
- gateway:
fromIPPool: baremetalv4-pool
fromIPPool: baremetalv4-pool-${CLUSTER_NAME}
network: 0.0.0.0
prefix: 0
services:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ spec:
metaData:
ipAddressesFromIPPool:
- key: provisioningIP
name: provisioning-pool
name: provisioning-pool-${CLUSTER_NAME}
objectNames:
- key: name
object: machine
Expand All @@ -53,7 +53,7 @@ spec:
object: machine
prefixesFromIPPool:
- key: provisioningCIDR
name: provisioning-pool
name: provisioning-pool-${CLUSTER_NAME}
networkData:
links:
ethernets:
Expand All @@ -68,11 +68,11 @@ spec:
networks:
ipv4:
- id: baremetalv4
ipAddressFromIPPool: baremetalv4-pool
ipAddressFromIPPool: baremetalv4-pool-${CLUSTER_NAME}
link: enp2s0
routes:
- gateway:
fromIPPool: baremetalv4-pool
fromIPPool: baremetalv4-pool-${CLUSTER_NAME}
network: 0.0.0.0
prefix: 0
services:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ spec:
metaData:
ipAddressesFromIPPool:
- key: provisioningIP
name: provisioning-pool
name: provisioning-pool-${CLUSTER_NAME}
objectNames:
- key: name
object: machine
Expand All @@ -34,7 +34,7 @@ spec:
object: machine
prefixesFromIPPool:
- key: provisioningCIDR
name: provisioning-pool
name: provisioning-pool-${CLUSTER_NAME}
networkData:
links:
ethernets:
Expand All @@ -49,11 +49,11 @@ spec:
networks:
ipv4:
- id: baremetalv4
ipAddressFromIPPool: baremetalv4-pool
ipAddressFromIPPool: baremetalv4-pool-${CLUSTER_NAME}
link: enp2s0
routes:
- gateway:
fromIPPool: baremetalv4-pool
fromIPPool: baremetalv4-pool-${CLUSTER_NAME}
network: 0.0.0.0
prefix: 0
services:
Expand Down
4 changes: 2 additions & 2 deletions test/e2e/data/infrastructure-metal3/bases/ippool/ippool.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
apiVersion: ipam.metal3.io/v1alpha1
kind: IPPool
metadata:
name: provisioning-pool
name: provisioning-pool-${CLUSTER_NAME}
namespace: ${NAMESPACE}
spec:
clusterName: ${CLUSTER_NAME}
Expand All @@ -15,7 +15,7 @@ spec:
apiVersion: ipam.metal3.io/v1alpha1
kind: IPPool
metadata:
name: baremetalv4-pool
name: baremetalv4-pool-${CLUSTER_NAME}
namespace: ${NAMESPACE}
spec:
clusterName: ${CLUSTER_NAME}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
resources:
- ../bases/ippool
- ../bases/centos-kubeadm-config
Loading

0 comments on commit 1099be2

Please sign in to comment.