github.com/tickoalcantara12/micro/v3@v3.0.0-20221007104245-9d75b9bcbab9/scripts/kind-launch.sh (about) 1 #!/bin/bash 2 3 # This script installs the platform on a local k8s (kind) cluster 4 # It assumes: 5 # - kind is already running and kubectl context is pointed to it 6 # - the following tools are installed 7 # - helm 8 # - cfssl - https://github.com/cloudflare/cfssl 9 # - yq - https://github.com/mikefarah/yq 10 # 11 # Warning: This script will modify some yaml files so please don't commit the modifications 12 13 set -e 14 set -x 15 16 DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" 17 18 # safety first 19 kubectl config use-context kind-kind 20 21 tmp=$TMPDIR 22 if [[ ! $tmp ]]; then 23 tmp=/tmp 24 fi 25 26 KUBE_DIR=$tmp/micro-kind/cmd/platform/kubernetes 27 28 if [[ ! -d $tmp/micro-kind ]]; then 29 mkdir $tmp/micro-kind 30 cp -R $DIR/../* $tmp/micro-kind/ 31 fi 32 33 pushd $tmp/micro-kind 34 35 yq write -i $KUBE_DIR/service/router.yaml "spec.template.spec.containers[0].env.(name==MICRO_ENABLE_ACME).value" --tag '!!str' 'false' 36 yq write -i $KUBE_DIR/service/proxy.yaml "spec.template.spec.containers[0].env.(name==MICRO_ENABLE_ACME).value" --tag '!!str' 'false' 37 yq delete -i $KUBE_DIR/service/proxy.yaml "spec.template.spec.containers[0].env.(name==CF_API_TOKEN)" 38 yq write -i $KUBE_DIR/service/api.yaml "spec.template.spec.containers[0].env.(name==MICRO_ENABLE_ACME).value" --tag '!!str' 'false' 39 yq delete -i $KUBE_DIR/service/api.yaml "spec.template.spec.containers[0].env.(name==CF_API_TOKEN)" 40 yq write -i $KUBE_DIR/service/api.yaml "spec.template.spec.containers[0].ports.(name==api-port).containerPort" 8080 41 42 # install metrics server 43 kubectl apply -f scripts/kind/metrics/components.yaml 44 45 pushd $KUBE_DIR 46 ./install.sh dev 47 kubectl wait deployment --all --timeout=180s -n default --for=condition=available 48 popd 49 50 popd