-
Notifications
You must be signed in to change notification settings - Fork 3
/
install.sh
executable file
·169 lines (143 loc) · 4.99 KB
/
install.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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
#!/bin/bash
set -e
export SHELLOPTS
function get_latest {
latest_content=$(curl -H "Authorization: token $GITHUB_TOKEN" --silent "https://api.github.com/repos/$1/releases/latest")
latest_url=$(echo $latest_content | jq -r '.assets[] | select(.browser_download_url | test("'$2'")) | .browser_download_url')
if [ ! -z "$latest_url" ]; then
echo $latest_url
else
echo "Failed to get $1: $latest_content"
exit 2
fi
}
function get_most_recent_matching {
releases=$(curl -H "Authorization: token $GITHUB_TOKEN" --silent "https://api.github.com/repos/$1/releases")
most_recent_matching=$(echo -E $releases | jq -r '.[] | .assets | .[] | select(.browser_download_url | test("'$2'")) | .browser_download_url' | head -n 1)
if [ ! -z "$most_recent_matching" ]; then
echo $most_recent_matching
else
echo "Failed to get $1: $releases"
exit 2
fi
}
# NVM for Node.JS
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.3/install.sh | bash
source /root/.nvm/nvm.sh
nvm install 14
npm install -g nodemon
# SoftLayer
echo ">> softlayer"
pip install softlayer
# IBM Cloud CLI
echo ">> ibmcloud"
curl -fsSL https://clis.cloud.ibm.com/install/linux > /tmp/bxinstall.sh
sh /tmp/bxinstall.sh
rm /tmp/bxinstall.sh
# IBM Cloud CLI plugins
echo ">> ibmcloud plugins"
ibmcloud_plugins=( \
catalogs-management \
code-engine \
cloud-databases \
cloud-dns-services \
cloud-internet-services \
cloud-object-storage \
container-registry \
container-service \
vpc-infrastructure \
key-protect \
project \
power-iaas \
schematics \
sl \
tg \
tke \
)
for plugin in "${ibmcloud_plugins[@]}"
do
ibmcloud plugin install $plugin -f -r "IBM Cloud"
done
# OpenShift CLI
echo ">> openshift 4.x client tools"
curl -LO https://mirror.openshift.com/pub/openshift-v4/x86_64/clients/ocp/stable/openshift-client-linux.tar.gz
tar zxvf openshift-client-linux.tar.gz
mv oc /usr/local/bin/oc
rm -rf README.md kubectl openshift-client-linux.tar.gz
# Kubernetes
echo ">> kubectl"
curl -LO https://storage.googleapis.com/kubernetes-release/release/$(curl --retry 10 --retry-delay 5 -s https://storage.googleapis.com/kubernetes-release/release/stable.txt)/bin/linux/amd64/kubectl
mv kubectl /usr/local/bin/kubectl
chmod +x /usr/local/bin/kubectl
# Kubetail
echo ">> kubetail"
curl -LO https://raw.githubusercontent.com/johanhaleby/kubetail/master/kubetail
mv kubetail /usr/local/bin/kubetail
chmod +x /usr/local/bin/kubetail
# Kail https://github.com/boz/kail
echo ">> kail"
curl -LO $(get_latest "boz/kail" linux_amd64.tar.gz)
mkdir kail
tar zxvf kail*linux*.tar.gz -C kail
mv kail/kail /usr/local/bin/kail
rm -rf kail kail*linux*.tar.gz
# stern https://github.com/stern/stern
echo ">> stern"
curl -LO $(get_latest "stern/stern" linux_amd64)
mkdir stern
tar zxvf stern*.tar.gz -C stern
mv stern/stern /usr/local/bin/stern
rm -rf stern stern*.tar.gz
# Istio
echo ">> istio"
curl -LO $(get_most_recent_matching "istio/istio" "istio-(.*)linux-amd64.tar.gz$")
tar zxvf istio-*.tar.gz
rm -f istio-*.tar.gz
mv istio-* /usr/local/
ln -s /usr/local/istio* /usr/local/istio
# Knative CLI https://github.com/cppforlife/knctl
echo ">> knctl"
curl -LO $(get_latest "cppforlife/knctl" linux-amd64)
mv knctl* /usr/local/bin/knctl
chmod +x /usr/local/bin/knctl
# Helm
echo ">> helm 3"
curl https://raw.githubusercontent.com/helm/helm/master/scripts/get-helm-3 | bash
# Expose configuration to be overriden
mkdir -p /root/mnt/config
# IBM Cloud CLI configuration
rm /root/.bluemix/config.json
touch /root/mnt/config/bx-config.json
ln -s /root/mnt/config/bx-config.json /root/.bluemix/config.json
# IBM Cloud Cloud Functions configuration
touch /root/mnt/config/wsk.props
ln -s /root/mnt/config/wsk.props /root/.wskprops
# IBM Cloud container-registry
mkdir /root/mnt/config/container-registry
ln -s /root/mnt/config/container-registry/config.json /root/.bluemix/plugins/container-registry/config.json
# IBM Cloud container-service
mkdir /root/mnt/config/container-service
ln -s /root/mnt/config/container-service/config.json /root/.bluemix/plugins/container-service/config.json
ln -s /root/mnt/config/container-service/clusters /root/.bluemix/plugins/container-service/clusters
# IBM Cloud code-engine
mkdir /root/mnt/config/code-engine
rm -f /root/.bluemix/plugins/code-engine/config.json
ln -s /root/mnt/config/code-engine/config.json /root/.bluemix/plugins/code-engine/config.json
# IBM Cloud vpc-infrastructure
rm -f /root/.bluemix/plugins/vpc-infrastructure/config.json
mkdir /root/mnt/config/vpc-infrastructure
ln -s /root/mnt/config/vpc-infrastructure/config.json /root/.bluemix/plugins/vpc-infrastructure/config.json
# SoftLayer CLI
touch /root/mnt/config/slcli.conf
ln -s /root/mnt/config/slcli.conf /root/.softlayer
# IBM Cloud SoftLayer service
mkdir /root/mnt/config/softlayer
ln -s /root/mnt/config/softlayer /root/.bluemix/plugins/softlayer
# Helm configuration
mkdir /root/mnt/config/helm
ln -s /root/mnt/config/helm /root/.helm
# Docker configuration
mkdir /root/mnt/config/docker
ln -s /root/mnt/config/docker /root/.docker
# Clean up
nvm cache clear