Skip to content

Commit 0bd48f8

Browse files
committed
Docs cleanup + server count override
1 parent a712010 commit 0bd48f8

File tree

2 files changed

+18
-5
lines changed

2 files changed

+18
-5
lines changed

examples/kind-multinode/README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ performs the following operations:
1616
- `--agent-image <IMAGE_NAME>[:<IMAGE_TAG>]`: Proxy server image to deploy. Default: `gcr.io/k8s-staging-kas-network-proxy/proxy-agent:master`
1717
- `--num-kcp-nodes <NUM>`: Number of control plane nodes to spin up. Default: 2.
1818
- `--num-worker-nodes <NUM>`: Number of worker nodes to spin up. Default: 1.
19+
- `--server-count-override <NUM>`: 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.
1920
- `--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.
2021
- Use this if you don't want to publish your custom KNP images to a public registry.
2122
- 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
3334
Verify that the new images are available in the local docker registry with `docker images`. Then, bring up the cluster:
3435

3536
```shell
36-
cd examples/kind-multinode-kcp
37+
cd examples/kind-multinode
3738

3839
# These are the default values of the registry, image name, and tag used by the Makefile.
3940
# Edit them if necessary.

examples/kind-multinode/quickstart-kind.sh

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,15 @@ NUM_WORKER_NODES=1
1010
NUM_KCP_NODES=2
1111
OVERWRITE_CLUSTER=false
1212
SIDELOAD_IMAGES=false
13+
SERVER_COUNT_OVERRIDE=-1
1314

1415
# Provide usage info
1516
usage() {
1617
printf "USAGE:\n./quickstart-kind.sh\n\t[--cluster-name <NAME>]\n\t[--server-image <IMAGE_NAME>[:<IMAGE_TAG>]]\n\t[--agent-image <IMAGE_NAME>[:<IMAGE_TAG>]]\n\t[--num-worker-nodes <NUM>]\n\t[--num-kcp-nodes <NUM>]\n\t[--overwrite-cluster]\n"
1718
}
1819

1920
# ARG PARSING
20-
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
21+
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
2122

2223
eval set -- "$VALID_ARGS"
2324
while true; do
@@ -50,6 +51,10 @@ while true; do
5051
SIDELOAD_IMAGES=true
5152
shift 1
5253
;;
54+
--server-count-override)
55+
SERVER_COUNT_OVERRIDE=$2
56+
shift 2
57+
;;
5358
--)
5459
shift
5560
break
@@ -78,9 +83,16 @@ do
7883
cat templates/kind/worker.config >> rendered/kind.config
7984
done
8085

81-
echo "Setting server image to $SERVER_IMAGE and agent image to $AGENT_IMAGE"
82-
sed "s|image: .*|image: $AGENT_IMAGE|" <templates/k8s/konnectivity-agent-ds.yaml >rendered/konnectivity-agent-ds.yaml
83-
sed "s|image: .*|image: $SERVER_IMAGE|" <templates/k8s/konnectivity-server.yaml >rendered/konnectivity-server.yaml
86+
SERVER_COUNT=$NUM_KCP_NODES
87+
if [ "$SERVER_COUNT_OVERRIDE" -ge 0 ]; then
88+
echo "Overriding default server count from $NUM_KCP_NODES to $SERVER_COUNT_OVERRIDE"
89+
SERVER_COUNT=$SERVER_COUNT_OVERRIDE
90+
fi
91+
92+
echo "Setting server image to $SERVER_IMAGE, agent image to $AGENT_IMAGE, and --server-count flag on server to $SERVER_COUNT"
93+
sed -e "s|image: .*|image: $AGENT_IMAGE|" <templates/k8s/konnectivity-agent-ds.yaml >rendered/konnectivity-agent-ds.yaml
94+
sed -e "s|image: .*|image: $SERVER_IMAGE|" -e "s/--server-count=[0-9]\+/--server-count=$SERVER_COUNT/" <templates/k8s/konnectivity-server.yaml >rendered/konnectivity-server.yaml
95+
8496

8597

8698
# CLUSTER CREATION

0 commit comments

Comments
 (0)