forked from openfaas/faas-netes
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
7 changed files
with
82 additions
and
49 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,40 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -o errexit | ||
DEVENV=${OF_DEV_ENV:-kind} | ||
KUBE_VERSION=v1.18.8 | ||
REG_NAME=kind-registry | ||
REG_PORT=5000 | ||
|
||
./contrib/create_local_registry.sh ${REG_NAME} ${REG_PORT} | ||
echo ">>> Creating Kubernetes ${KUBE_VERSION} cluster ${DEVENV}" | ||
|
||
kind create cluster --wait 5m --image kindest/node:${KUBE_VERSION} --name "$DEVENV" -v 1 | ||
# create a cluster with the local registry enabled in containerd | ||
cat <<EOF | kind create cluster \ | ||
--wait 5m --image kindest/node:${KUBE_VERSION} --name "$DEVENV" -v 1 --config=- | ||
kind: Cluster | ||
apiVersion: kind.x-k8s.io/v1alpha4 | ||
containerdConfigPatches: | ||
- |- | ||
[plugins."io.containerd.grpc.v1.cri".registry.mirrors."localhost:${REG_PORT}"] | ||
endpoint = ["http://${REG_NAME}:${REG_PORT}"] | ||
EOF | ||
|
||
|
||
# connect the registry to the cluster network | ||
# (the network may already be connected) | ||
containers=$(docker network inspect kind -f "{{range .Containers}}{{.Name}} {{end}}") | ||
needs_connect="true" | ||
for c in $containers; do | ||
if [ "$c" = "${reg_name}" ]; then | ||
needs_connect="false" | ||
fi | ||
done | ||
if [ "${needs_connect}" = "true" ]; then | ||
docker network connect "kind" "${REG_NAME}" || true | ||
else | ||
echo ">>> Kind network already connected to local registry" | ||
fi | ||
|
||
|
||
echo ">>> Waiting for CoreDNS" | ||
kubectl --context "kind-$DEVENV" -n kube-system rollout status deployment/coredns |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# create registry container unless it already exists | ||
REG_NAME=${$1:-'kind-registry'} | ||
REG_PORT=${$2:-'5000'} | ||
running="$(docker inspect -f '{{.State.Running}}' "${REG_NAME}" 2>/dev/null || true)" | ||
if [ "${running}" != 'true' ]; then | ||
docker run \ | ||
-d --restart=always -p "127.0.0.1:${REG_PORT}:5000" --name "${REG_NAME}" \ | ||
registry:2 | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters