diff --git a/examples/kind-multinode/README.md b/examples/kind-multinode/README.md index 2c64a57cb..77aa06321 100644 --- a/examples/kind-multinode/README.md +++ b/examples/kind-multinode/README.md @@ -16,6 +16,7 @@ performs the following operations: - `--agent-image [:]`: Proxy server image to deploy. Default: `gcr.io/k8s-staging-kas-network-proxy/proxy-agent:master` - `--num-kcp-nodes `: Number of control plane nodes to spin up. Default: 2. - `--num-worker-nodes `: Number of worker nodes to spin up. Default: 1. +- `--server-count-override `: If this flag is >= 0, override the `--serverCount` flag in the proxy server's configuration to the provided number. Default: set `--serverCount` to equal the number of KCP nodes. - `--sideload-images`: Use `kind load ...` to sideload custom proxy server and agent images with the names set by `--server-image` and `--agent-image` into the kind cluster. Default: do not sideload. - Use this if you don't want to publish your custom KNP images to a public registry. - NOTE: You MUST specify an image tag (i.e. `my-image-name:my-image-tag` and not just `my-image-name`) and the image tag MUST NOT be `:latest` for this to work! See [`kind` docs](https://kind.sigs.k8s.io/docs/user/quick-start/#loading-an-image-into-your-cluster) for why this is necessary. @@ -33,7 +34,7 @@ make docker-build Verify that the new images are available in the local docker registry with `docker images`. Then, bring up the cluster: ```shell -cd examples/kind-multinode-kcp +cd examples/kind-multinode # These are the default values of the registry, image name, and tag used by the Makefile. # Edit them if necessary. diff --git a/examples/kind-multinode/quickstart-kind.sh b/examples/kind-multinode/quickstart-kind.sh index abb6ce7bf..fb464b5e8 100755 --- a/examples/kind-multinode/quickstart-kind.sh +++ b/examples/kind-multinode/quickstart-kind.sh @@ -10,6 +10,7 @@ NUM_WORKER_NODES=1 NUM_KCP_NODES=2 OVERWRITE_CLUSTER=false SIDELOAD_IMAGES=false +SERVER_COUNT_OVERRIDE=-1 # Provide usage info usage() { @@ -17,7 +18,7 @@ usage() { } # ARG PARSING -VALID_ARGS=$(getopt --options "h" --longoptions "sideload-images,cluster-name:,agent-image:,server-image:,num-worker-nodes:,num-kcp-nodes:,help,overwrite-cluster" --name "$0" -- "$@") || exit 2 +VALID_ARGS=$(getopt --options "h" --longoptions "sideload-images,cluster-name:,agent-image:,server-image:,num-worker-nodes:,num-kcp-nodes:,help,overwrite-cluster,server-count-override:" --name "$0" -- "$@") || exit 2 eval set -- "$VALID_ARGS" while true; do @@ -50,6 +51,10 @@ while true; do SIDELOAD_IMAGES=true shift 1 ;; + --server-count-override) + SERVER_COUNT_OVERRIDE=$2 + shift 2 + ;; --) shift break @@ -78,9 +83,16 @@ do cat templates/kind/worker.config >> rendered/kind.config done -echo "Setting server image to $SERVER_IMAGE and agent image to $AGENT_IMAGE" -sed "s|image: .*|image: $AGENT_IMAGE|" rendered/konnectivity-agent-ds.yaml -sed "s|image: .*|image: $SERVER_IMAGE|" rendered/konnectivity-server.yaml +SERVER_COUNT=$NUM_KCP_NODES +if [ "$SERVER_COUNT_OVERRIDE" -ge 0 ]; then + echo "Overriding default server count from $NUM_KCP_NODES to $SERVER_COUNT_OVERRIDE" + SERVER_COUNT=$SERVER_COUNT_OVERRIDE +fi + +echo "Setting server image to $SERVER_IMAGE, agent image to $AGENT_IMAGE, and --server-count flag on server to $SERVER_COUNT" +sed -e "s|image: .*|image: $AGENT_IMAGE|" rendered/konnectivity-agent-ds.yaml +sed -e "s|image: .*|image: $SERVER_IMAGE|" -e "s/--server-count=[0-9]\+/--server-count=$SERVER_COUNT/" rendered/konnectivity-server.yaml + # CLUSTER CREATION