-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdeploy-openshift.sh
executable file
·115 lines (92 loc) · 3.8 KB
/
deploy-openshift.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
#!/bin/bash
set -ex
cd /root/
# Install epel
yum -y install epel-release
# Install storage requirements for iscsi and cluster
yum -y install centos-release-gluster
yum -y install --nogpgcheck -y glusterfs-fuse
yum -y install iscsi-initiator-utils
# Create Origin latest repo, enter correct repository address
cat >/etc/yum.repos.d/origin-latest.repo <<EOF
[centos-openshift-origin310]
name=CentOS OpenShift Origin
baseurl=http://mirror.centos.org/centos/7/paas/x86_64/openshift-origin310/
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-SIG-PaaS
[centos-openshift-origin-testing310]
name=CentOS OpenShift Origin Testing
baseurl=http://buildlogs.centos.org/centos/7/paas/x86_64/openshift-origin310/
enabled=0
gpgcheck=0
gpgkey=file:///etc/pki/rpm-gpg/openshift-ansible-CentOS-SIG-PaaS
[centos-openshift-origin-source310]
name=CentOS OpenShift Origin Source
baseurl=http://vault.centos.org/centos/7/paas/Source/openshift-origin310/
enabled=0
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/openshift-ansible-CentOS-SIG-PaaS
EOF
# Install OpenShift packages
yum install -y yum-utils \
ansible \
wget \
git \
net-tools \
bind-utils \
iptables-services \
bridge-utils \
bash-completion \
kexec-tools \
sos \
psacct \
docker
echo '{ "insecure-registries" : ["172.30.0.0/16"] }' > /etc/docker/daemon.json
systemctl start docker
systemctl enable docker
# Disable host key checking under ansible.cfg file
sed -i '/host_key_checking/s/^#//g' /etc/ansible/ansible.cfg
openshift_ansible="/root/openshift-ansible"
inventory_file="/root/inventory"
master_ip=`ifconfig eth0 | grep 'inet ' | cut -d: -f2 | awk '{print $2}'`
#git clone https://github.com/openshift/openshift-ansible.git -b v3.10.0 $openshift_ansible
# Create ansible inventory file
cat >$inventory_file <<EOF
[OSEv3:children]
masters
nodes
[OSEv3:vars]
ansible_ssh_user=root
ansible_ssh_pass=password
deployment_type=origin
openshift_deployment_type=origin
openshift_clock_enabled=true
openshift_master_identity_providers=[{'name': 'allow_all_auth', 'login': 'true', 'challenge': 'true', 'kind': 'AllowAllPasswordIdentityProvider'}]
openshift_disable_check=memory_availability,disk_availability,docker_storage,package_availability,docker_image_availability
openshift_image_tag=v3.10.0-rc.0
ansible_service_broker_registry_whitelist=['.*-apb$']
openshift_node_kubelet_args={'max-pods': ['80'], 'pods-per-core': ['80']}
openshift_master_admission_plugin_config={"ValidatingAdmissionWebhook":{"configuration":{"kind": "DefaultAdmissionConfig","apiVersion": "v1","disable": false}},"MutatingAdmissionWebhook":{"configuration":{"kind": "DefaultAdmissionConfig","apiVersion": "v1","disable": false}}}
openshift_enable_excluders=false
os_sdn_network_plugin_name='redhat/openshift-ovs-networkpolicy'
[masters]
localhost ansible_connection=local
[etcd]
localhost ansible_connection=local
[nodes]
# openshift_node_group_name should refer to a dictionary with matching key of name in list openshift_node_groups.
localhost ansible_connection=local openshift_schedulable=true openshift_ip=$master_ip openshift_node_group_name="node-config-all-in-one"
EOF
# Install prerequisites
ansible-playbook -i $inventory_file $openshift_ansible/playbooks/prerequisites.yml
touch /etc/sysconfig/origin-node
ansible-playbook -i $inventory_file $openshift_ansible/playbooks/deploy_cluster.yml
# Create OpenShift user
/usr/bin/oc create user admin
/usr/bin/oc create identity allow_all_auth:admin
/usr/bin/oc create useridentitymapping allow_all_auth:admin admin
/usr/bin/oc adm policy add-cluster-role-to-user cluster-admin admin
oc adm policy add-scc-to-user privileged system:serviceaccount:kube-system:kubevirt-privileged
oc adm policy add-scc-to-user privileged system:serviceaccount:kube-system:kubevirt-controller
oc adm policy add-scc-to-user privileged system:serviceaccount:kube-system:kubevirt-infra