-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathinstall.sh
More file actions
executable file
·52 lines (48 loc) · 1.68 KB
/
install.sh
File metadata and controls
executable file
·52 lines (48 loc) · 1.68 KB
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
#!/bin/bash
#Installs ASDC Admin dependencies and tools
#Tested for Linux (Ubuntu) only
#Requires curl, python
#Can't source settings.env in this script as is called from settings.env! Must do it manually if running yourself
if [ -z ${KUBE_TAG+x} ];
then
echo "KUBE_TAG NOT SET!"
#Get kube_tag from cluster if running
LABELS=$(openstack coe cluster show $CLUSTER -c labels -f json)
KUBE_TAG=$(python -c "import json; j=json.loads('''${LABELS}'''); print(j['labels']['kube_tag']);")
fi
echo KUBE_TAG: $KUBE_TAG
#Install openstack python packages, use virtual env or user
if env |grep VIRTUAL_ENV;
then
echo "pip installing in virtualenv $VIRTUAL_ENV"
pip install -r requirements.txt
else
echo "pip installing with --user"
pip install --user -r requirements.txt
fi
if [ "$1" == "force" ];
then
rm ./kubectl
fi
#Install kubectl if not present
if ! command -v kubectl &> /dev/null
then
#Add cwd to path so kubectl can be run without dir
PATH=$PATH:$(pwd)
if ! command -v kubectl &> /dev/null
then
echo "kubectl could not be found! attempting to download..."
#KUBE_TAG=$(curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt)
curl -LO "https://storage.googleapis.com/kubernetes-release/release/${KUBE_TAG}/bin/linux/amd64/kubectl"
chmod +x ./kubectl
fi
fi
#Install flux if not found or version doesn't match FLUX_VERSION
FLUXVER=$(flux --version | cut -d " " -f 3)
if [ ! command -v flux &> /dev/null ] || [ "${FLUX_VERSION}" != "${FLUXVER}" ] || [ "$1" == "force" ];
then
echo "flux not found or version doesn't match! attempting to download..."
curl -s https://fluxcd.io/install.sh -o flux_install.sh
chmod 700 flux_install.sh
./flux_install.sh
fi