-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinstall-okd.sh
82 lines (62 loc) · 1.82 KB
/
install-okd.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
#!/bin/bash
user=$1
if [ -z $user ]; then
echo "ERROR: Need paramter 'user'"
exit 1
fi
ip=$2
if [ -z $ip ]; then
echo "ERROR: Need paramter 'ip'"
exit 1
fi
echo "User='$user'"
echo "Ip='$ip'"
home=/home/$user
owner_group=`grep "^$user" /etc/passwd | cut -d':' -f4`
yum -y update --exclude=WALinuxAgent
yum install -y yum-utils device-mapper-persistent-data lvm2
yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
yum install -y docker-ce docker-ce-cli containerd.io
yum -y install centos-release-openshift-origin311 epel-release git pyOpenSSL
yum -y install origin-clients
systemctl start docker
systemctl enable docker
mkdir /etc/docker /etc/containers
tee /etc/containers/registries.conf<<EOF
[registries.insecure]
registries = ['172.30.0.0/16']
EOF
tee /etc/docker/daemon.json<<EOF
{
"insecure-registries": [
"172.30.0.0/16"
]
}
EOF
systemctl daemon-reload
systemctl restart docker
echo "net.ipv4.ip_forward = 1" | sudo tee -a /etc/sysctl.conf
home=/home/$user
owner_group=`grep "^$user" /etc/passwd | cut -d':' -f4`
docker_group=`grep docker /etc/group | cut -d':' -f 3`
usermod -aG docker $user
cd $home
systemctl restart docker
echo "Running cluster"
cat > $home/run_cluster_during_install.sh <<EOF
#!/bin/bash
newgrp docker << END
export ip=$ip
oc cluster up --public-hostname=$ip --routing-suffix=$ip.xip.io
END
EOF
cd $home
chown $owner_group:$docker_group run_cluster_during_install.sh
#initial run
su -c "bash -xv run_cluster_during_install.sh" - $user
#restarting for config changes
su -c "oc cluster down" - $user
sed -i -e "s|https://127.0.0.1|https://$ip|" /home/$user/openshift.local.clusterup/openshift-controller-manager/openshift-master.kubeconfig
#actual run
su -c "bash -xv run_cluster_during_install.sh" - $user
echo "****************** END ******************"