Skip to content

Commit

Permalink
update clueter-cluster shell
Browse files Browse the repository at this point in the history
Signed-off-by: changzhen <[email protected]>
  • Loading branch information
XiShanYongYe-Chang committed Feb 9, 2023
1 parent 57236e5 commit aee17da
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 13 deletions.
1 change: 0 additions & 1 deletion artifacts/kindClusterConfig/general-config.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
kind: Cluster
apiVersion: "kind.x-k8s.io/v1alpha4"
networking:
disableDefaultCNI: {{disable_cni}}
podSubnet: {{pod_cidr}}
serviceSubnet: {{service_cidr}}
nodes:
Expand Down
12 changes: 0 additions & 12 deletions hack/create-cluster.sh
Original file line number Diff line number Diff line change
Expand Up @@ -72,20 +72,10 @@ if [[ -z "${SERVICE_CIDR}" ]]; then
SERVICE_CIDR=$(generate_cidr 100)
fi

function deploy_weave_cni() {
echo "Applying weave network..."
kubectl --kubeconfig=$1 apply -f "https://cloud.weave.works/k8s/net?k8s-version=$(kubectl --kubeconfig=$1 version | base64 | tr -d '\n')&env.IPALLOC_RANGE=$2"
echo "Waiting for weave-net pods to be ready..."
kubectl --kubeconfig=$1 wait --for=condition=Ready pods -l name=weave-net -n kube-system --timeout=10m
echo "Waiting for core-dns deployment to be ready..."
kubectl --kubeconfig=$1 -n kube-system rollout status deploy/coredns --timeout=5m
}

#generate for kindClusterConfig
TEMP_PATH=$(mktemp -d)
trap '{ rm -rf ${TEMP_PATH}; }' EXIT
cp -rf "${REPO_ROOT}"/artifacts/kindClusterConfig/general-config.yaml "${TEMP_PATH}"/"${CLUSTER_NAME}"-config.yaml
sed -i'' -e "s#{{disable_cni}}#true#g" "${TEMP_PATH}"/"${CLUSTER_NAME}"-config.yaml
sed -i'' -e "s#{{pod_cidr}}#${POD_CIDR}#g" "${TEMP_PATH}"/"${CLUSTER_NAME}"-config.yaml
sed -i'' -e "s#{{service_cidr}}#${SERVICE_CIDR}#g" "${TEMP_PATH}"/"${CLUSTER_NAME}"-config.yaml

Expand All @@ -100,6 +90,4 @@ kubectl config rename-context "kind-${CLUSTER_NAME}" "${CLUSTER_NAME}" --kubecon
container_ip=$(docker inspect --format='{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' "${CLUSTER_NAME}-control-plane")
kubectl config set-cluster "kind-${CLUSTER_NAME}" --server="https://${container_ip}:6443" --kubeconfig="${KUBECONFIG}"

deploy_weave_cni "${KUBECONFIG}" "${POD_CIDR}"

echo "cluster \"${CLUSTER_NAME}\" is created successfully!"

0 comments on commit aee17da

Please sign in to comment.