This repository was archived by the owner on Jan 30, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 14
/
Copy pathrun-k8s-part2.sh
executable file
·88 lines (67 loc) · 2.9 KB
/
run-k8s-part2.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
#!/usr/bin/env bash
set -eu
################################################
# include the magic
################################################
test -s ./demo-magic.sh || curl --silent https://raw.githubusercontent.com/paxtonhare/demo-magic/master/demo-magic.sh > demo-magic.sh
# shellcheck disable=SC1091
. ./demo-magic.sh
################################################
# Configure the options
################################################
#
# speed at which to simulate typing. bigger num = faster
#
export TYPE_SPEED=60
# Uncomment to run non-interactively
export PROMPT_TIMEOUT=0
# No wait
export NO_WAIT=false
#
# custom prompt
#
# see http://www.tldp.org/HOWTO/Bash-Prompt-HOWTO/bash-prompt-escape-sequences.html for escape sequences
#
#DEMO_PROMPT="${GREEN}➜ ${CYAN}\W "
export DEMO_PROMPT="${GREEN}➜ ${CYAN}$ "
# hide the evidence
#clear
### Please run these commands before running the script
# docker run -it --rm -e USER="$USER" -e ARM_CLIENT_ID="$ARM_CLIENT_ID" -e ARM_CLIENT_SECRET="$ARM_CLIENT_SECRET" -e ARM_SUBSCRIPTION_ID="$ARM_SUBSCRIPTION_ID" -e ARM_TENANT_ID="$ARM_TENANT_ID" -e AWS_ACCESS_KEY_ID="$AWS_ACCESS_KEY_ID" -e AWS_SECRET_ACCESS_KEY="$AWS_SECRET_ACCESS_KEY" -e SSH_AUTH_SOCK=$SSH_AUTH_SOCK -v $SSH_AUTH_SOCK:$SSH_AUTH_SOCK -v $HOME/.config/hub:/root/.config/hub:ro -v $PWD:/mnt ubuntu
# echo $(hostname -I) $(hostname) >> /etc/hosts
# apt-get update -qq && apt-get install -qq -y curl git pv > /dev/null
# cd /mnt
# ./run-k8s-part2.sh
[ ! -d .git ] && git clone --quiet https://github.com/ruzickap/k8s-flagger-istio-flux && cd k8s-flagger-istio-flux
sed -n "/^\`\`\`bash.*/,/^\`\`\`$/p;/^-----$/p" docs/part-0{4,5}/README.md |
sed \
-e 's/^-----$/\np ""\np "################################################################################################### Press <ENTER> to continue"\nwait\n/' \
-e 's/^```bash.*/\npe '"'"'/' \
-e 's/^```$/'"'"'/' \
> README.sh
if [ "$#" -eq 0 ]; then
### Please run these commands before running the script
export MY_DOMAIN=${MY_DOMAIN:-myexample.dev}
export LETSENCRYPT_ENVIRONMENT=${LETSENCRYPT_ENVIRONMENT:-staging}
# export LETSENCRYPT_ENVIRONMENT="production" # Use with care - Let's Encrypt will generate real certificates
export CLOUD_PLATFORM="${CLOUD_PLATFORM:-azure}"
# ./run-k8s-part2.sh
KUBECONFIG="$PWD/$(ls terraform/kubeconfig_*)"
export KUBECONFIG
export FLUX_FORWARD_NAMESPACE=flux
if [ -z "${ARM_CLIENT_ID}" ] || [ -z "${ARM_CLIENT_SECRET}" ] || [ -z "${ARM_SUBSCRIPTION_ID}" ] || [ -z "${ARM_TENANT_ID}" ]; then
echo -e "\n*** One of the mandatory variables is not set !!\n"
exit 1
fi
awk "/${MY_DOMAIN}/" /etc/hosts
set +eux
echo "*** ${CLOUD_PLATFORM} | ${MY_DOMAIN} | ${LETSENCRYPT_ENVIRONMENT} | ${CLOUD_PLATFORM} | ${KUBECONFIG} ***"
echo -e "\n\n*** Press ENTER to start\n"
read -r
# hide the evidence
clear
# shellcheck disable=SC1091
source README.sh
else
cat README.sh
fi