Skip to content

Commit a4ad55f

Browse files
authored
Sync the Kind setup with the downstream (mongodb#1199)
1 parent 2e94145 commit a4ad55f

File tree

1 file changed

+19
-5
lines changed

1 file changed

+19
-5
lines changed

scripts/dev/setup_kind_cluster.sh

+19-5
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
#!/usr/bin/env bash
22
set -Eeou pipefail
33

4+
####
5+
# This file is copy-pasted from https://github.com/mongodb/mongodb-kubernetes-operator/blob/master/scripts/dev/setup_kind_cluster.sh
6+
# Do not edit !!!
7+
####
8+
49
function usage() {
510
echo "Deploy local registry and create kind cluster configured to use this registry. Local Docker registry is deployed at localhost:5000.
611
@@ -10,22 +15,28 @@ Usage:
1015
setup_kind_cluster.sh [-n <cluster_name>] [-e] [-r]
1116
1217
Options:
13-
-n <cluster_name> (optional) Set kind cluster name to <cluster_name>. Creates kubeconfig in ~/.kube/<cluster_name>. The default name is 'kind' if not set.
14-
-e (optional) Export newly created kind cluster's credentials to ~/.kube/<cluster_name> and set current kubectl context.
15-
-h (optional) Shows this screen.
16-
-r (optional) Recreate cluster if needed
18+
-n <cluster_name> (optional) Set kind cluster name to <cluster_name>. Creates kubeconfig in ~/.kube/<cluster_name>. The default name is 'kind' if not set.
19+
-e (optional) Export newly created kind cluster's credentials to ~/.kube/<cluster_name> and set current kubectl context.
20+
-h (optional) Shows this screen.
21+
-r (optional) Recreate cluster if needed
22+
-p <pod network> (optional) Network reserved for Pods, e.g. 10.244.0.0/16
23+
-s <service network> (optional) Network reserved for Services, e.g. 10.96.0.0/16
1724
"
1825
exit 0
1926
}
2027

2128
cluster_name=${CLUSTER_NAME:-"kind"}
2229
export_kubeconfig=0
2330
recreate=0
24-
while getopts ':n:her' opt; do
31+
pod_network="10.244.0.0/16"
32+
service_network="10.96.0.0/16"
33+
while getopts ':p:s:n:her' opt; do
2534
case $opt in
2635
(n) cluster_name=$OPTARG;;
2736
(e) export_kubeconfig=1;;
2837
(r) recreate=1;;
38+
(p) pod_network=$OPTARG;;
39+
(s) service_network=$OPTARG;;
2940
(h) usage;;
3041
(*) usage;;
3142
esac
@@ -56,6 +67,9 @@ fi
5667
cat <<EOF | kind create cluster --name "${cluster_name}" --kubeconfig "${kubeconfig_path}" --config=-
5768
kind: Cluster
5869
apiVersion: kind.x-k8s.io/v1alpha4
70+
networking:
71+
podSubnet: "${pod_network}"
72+
serviceSubnet: "${service_network}"
5973
containerdConfigPatches:
6074
- |-
6175
[plugins."io.containerd.grpc.v1.cri".registry.mirrors."localhost:${reg_port}"]

0 commit comments

Comments
 (0)