mirror of
https://github.com/hyperledger/fabric-samples.git
synced 2026-06-17 15:35:09 +00:00
* This is the initial add of a test-network-kind Signed-off-by: Josh Kneubuhl <jkneubuh@us.ibm.com> * Update the test-network-kind README; removes the local docker registry; updated 'clean' instructions Signed-off-by: Josh Kneubuhl <jkneubuh@us.ibm.com> Co-authored-by: Matthew B White <mbwhite@users.noreply.github.com>
31 lines
996 B
Bash
Executable file
31 lines
996 B
Bash
Executable file
#!/bin/sh
|
|
set -o errexit
|
|
|
|
# create registry container unless it already exists
|
|
reg_name='kind-registry'
|
|
reg_port='5000'
|
|
running="$(docker inspect -f '{{.State.Running}}' "${reg_name}" 2>/dev/null || true)"
|
|
if [ "${running}" != 'true' ]; then
|
|
docker run \
|
|
-d --restart=always -p "${reg_port}:5000" --name "${reg_name}" \
|
|
registry:2
|
|
fi
|
|
|
|
# create a cluster with the local registry enabled in containerd
|
|
cat <<EOF | kind create cluster --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
|
|
docker network connect "kind" "${reg_name}"
|
|
|
|
# tell https://tilt.dev to use the registry
|
|
# https://docs.tilt.dev/choosing_clusters.html#discovering-the-registry
|
|
for node in $(kind get nodes); do
|
|
kubectl annotate node "${node}" "kind.x-k8s.io/registry=localhost:${reg_port}";
|
|
done
|