diff --git a/deploy/environment/kind/deploy.sh b/deploy/environment/kind/deploy.sh deleted file mode 100755 index ce7ebd5..0000000 --- a/deploy/environment/kind/deploy.sh +++ /dev/null @@ -1,91 +0,0 @@ -#!/bin/bash - -export CLUSTER_NAME="educates" -export REGISTRY_NAME="kind-registry" -export CONTOUR_VERSION="1.21" -export WORKSHOP_NAME="${2}" -export DEFAULT_IPADDRESS="$(ifconfig | grep 'broadcast\|Bcast' | awk -F ' ' {'print $2'} | head -n 1 | sed -e 's/addr://g')" -export IPADDRESS="${3:-$DEFAULT_IPADDRESS}" -DIR=$(dirname $0) - -start() { - # create registry container unless it already exists - reg_port='5000' - running="$(docker inspect -f '{{.State.Running}}' "${REGISTRY_NAME}" 2>/dev/null || true)" - if [ "${running}" != 'true' ]; then - docker run \ - -d --restart=always -p "127.0.0.1:${reg_port}:5000" --name "${REGISTRY_NAME}" registry:2 - fi - - if [ "$(kind get clusters | grep ${CLUSTER_NAME})" == "${CLUSTER_NAME}" ]; then - echo "===== Using existing educates cluster" - docker start "${CLUSTER_NAME}-control-plane" - exit - fi - - echo "===== Dynamically populating insecure registry exceptions" - if [ -z "$IPADDRESS" ] - then - IPADDRESS="$(hostname -I |grep -oE '((1?[0-9][0-9]?|2[0-4][0-9]|25[0-5])\.){3}(1?[0-9][0-9]?|2[0-4][0-9]|25[0-5])' |head -n 1)" # workaround if ifconfig is not installed on recent versions of Debian - fi - INSECURE_REGISTRIES="" - for i in {1..9} - do - for w in {1..9} - do - INSECURE_REGISTRIES+=" [plugins.\"io.containerd.grpc.v1.cri\".registry.mirrors.\"${WORKSHOP_NAME}-w0${w}-s00${i}-registry.${IPADDRESS}.nip.io\"]" - INSECURE_REGISTRIES+="\n endpoint = [\"http:\\/\\/${WORKSHOP_NAME}-w0${w}-s00${i}-registry.${IPADDRESS}.nip.io\"]\n" - done - done - - sed "s/ #__EXTRA_REGISTRIES__/${INSECURE_REGISTRIES}/g" ${DIR}/kind-config.yaml > ${DIR}/kind-config.yaml.resolved - - echo "===== Creating cluster" - kind create cluster --name "${CLUSTER_NAME}" --config=$DIR/kind-config.yaml.resolved - rm ${DIR}/kind-config.yaml.resolved - - # connect the registry to the cluster network - # (the network may already be connected) - docker network connect "kind" "${REGISTRY_NAME}" || true - - # Document the local registry - # https://github.com/kubernetes/enhancements/tree/master/keps/sig-cluster-lifecycle/generic/1755-communicating-a-local-registry - cat <> /home/ubuntu/.k8s_env -echo "K8S_ROLE=master" >> /home/ubuntu/.k8s_env - -cat <> /home/ubuntu/.bashrc -export STRIGO_EVENT_ID="{{ .STRIGO_EVENT_ID }}" -export STRIGO_EVENT_NAME="{{ .STRIGO_EVENT_NAME }}" -export STRIGO_CLASS_ID="{{ .STRIGO_CLASS_ID }}" -export STRIGO_CLASS_NAME="{{ .STRIGO_CLASS_NAME }}" -export STRIGO_USER_ID="{{ .STRIGO_USER_ID }}" -export STRIGO_USER_EMAIL="{{ .STRIGO_USER_EMAIL }}" -export STRIGO_USER_NAME="{{ .STRIGO_USER_NAME }}" -export STRIGO_ORG_ID="{{ .STRIGO_ORG_ID }}" -export STRIGO_ORG_NAME="{{ .STRIGO_ORG_NAME }}" -export STRIGO_PARTNER_ID="{{ .STRIGO_PARTNER_ID }}" -export STRIGO_PARTNER_NAME="{{ .STRIGO_PARTNER_NAME }}" -export STRIGO_WORKSPACE_ID="{{ .STRIGO_WORKSPACE_ID }}" -export STRIGO_WORKSPACE_FLAVOR="{{ .STRIGO_WORKSPACE_FLAVOR }}" -export STRIGO_RESOURCE_NAME="{{ .STRIGO_RESOURCE_NAME }}" -export STRIGO_EVENT_HOST_EMAIL="{{ .STRIGO_EVENT_HOST_EMAIL }}" -export STRIGO_RESOURCE_0_ID="{{ .STRIGO_RESOURCE_0_ID }}" -export STRIGO_RESOURCE_0_NAME="{{ .STRIGO_RESOURCE_0_NAME }}" -export STRIGO_RESOURCE_0_DNS="{{ .STRIGO_RESOURCE_0_DNS }}" -export STRIGO_RESOURCE_1_ID="{{ .STRIGO_RESOURCE_1_ID }}" -export STRIGO_RESOURCE_1_NAME="{{ .STRIGO_RESOURCE_1_NAME }}" -export STRIGO_RESOURCE_1_DNS="{{ .STRIGO_RESOURCE_1_DNS }}" -export STRIGO_RESOURCE_2_ID="{{ .STRIGO_RESOURCE_2_ID }}" -export STRIGO_RESOURCE_2_NAME="{{ .STRIGO_RESOURCE_2_NAME }}" -export STRIGO_RESOURCE_2_DNS="{{ .STRIGO_RESOURCE_2_DNS }}" -EOF - -hostnamectl set-hostname master - -docker pull ${CONTAINER_REGISTRY}/${CONTAINER_REPOSITORY}:${version} -docker tag ${CONTAINER_REGISTRY}/${CONTAINER_REPOSITORY}:${version} lab-docs:${version} -docker rmi ${CONTAINER_REGISTRY}/${CONTAINER_REPOSITORY}:${version} -docker run -d -p 8081:8080 --name lab-docs --restart always lab-docs:${version} - -wget --retry-connrefused --waitretry=1 --read-timeout=20 --timeout=15 -t 3 http://localhost:8081/_static/lab-ff.sh -O /usr/local/bin/lab-ff -chmod 755 /usr/local/bin/lab-ff \ No newline at end of file