Skip to content

Commit

Permalink
chore: support multi nodes cluster (envoyproxy#3422)
Browse files Browse the repository at this point in the history
* chore: support multi nodes cluster

Signed-off-by: zirain <[email protected]>

* nit

Signed-off-by: zirain <[email protected]>

---------

Signed-off-by: zirain <[email protected]>
  • Loading branch information
zirain authored May 17, 2024
1 parent fe862e8 commit aa854c1
Showing 1 changed file with 23 additions and 2 deletions.
25 changes: 23 additions & 2 deletions tools/hack/create-cluster.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,33 @@ set -euo pipefail
CLUSTER_NAME=${CLUSTER_NAME:-"envoy-gateway"}
METALLB_VERSION=${METALLB_VERSION:-"v0.13.10"}
KIND_NODE_TAG=${KIND_NODE_TAG:-"v1.28.0"}
NUM_WORKERS=${NUM_WORKERS:-""}


KIND_CFG=$(cat <<-EOM
kind: Cluster
apiVersion: kind.x-k8s.io/v1alpha4
nodes:
- role: control-plane
EOM
)

# https://kind.sigs.k8s.io/docs/user/quick-start/#multi-node-clusters
if [[ -n "${NUM_WORKERS}" ]]; then
for _ in $(seq 1 "${NUM_WORKERS}"); do
KIND_CFG+=$(printf "\n%s" "- role: worker")
done
fi

## Create kind cluster.
if [[ -z "${KIND_NODE_TAG}" ]]; then
tools/bin/kind create cluster --name "${CLUSTER_NAME}"
cat << EOF | tools/bin/kind create cluster --name "${CLUSTER_NAME}" --config -
${KIND_CFG}
EOF
else
tools/bin/kind create cluster --image "kindest/node:${KIND_NODE_TAG}" --name "${CLUSTER_NAME}"
cat << EOF | tools/bin/kind create cluster --image "kindest/node:${KIND_NODE_TAG}" --name "${CLUSTER_NAME}" --config -
${KIND_CFG}
EOF
fi

## Install MetalLB.
Expand Down

0 comments on commit aa854c1

Please sign in to comment.