forked from kubevirt/kubevirt
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add possibility to deploy OpenShift in vagrant machine
Signed-off-by: Lukianov Artyom <[email protected]>
- Loading branch information
Lukianov Artyom
committed
Jan 24, 2018
1 parent
07a16aa
commit 09235bd
Showing
7 changed files
with
117 additions
and
43 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
#!/bin/bash | ||
master_ip=$1 | ||
nodes=$2 | ||
|
||
sed -i -e "s/PasswordAuthentication no/PasswordAuthentication yes/" /etc/ssh/sshd_config | ||
systemctl restart sshd | ||
# FIXME, sometimes eth1 does not come up on Vagrant on latest fc26 | ||
sudo ifup eth1 | ||
sed -i "/$(hostname)/d" /etc/hosts | ||
grep 'master' /etc/hosts || echo "$master_ip master" >> /etc/hosts | ||
IFS=. read ip1 ip2 ip3 ip4 <<< "$master_ip" | ||
for node in $(seq 0 $(($nodes - 1))); do | ||
node_hostname="node$node" | ||
node_ip="$ip1.$ip2.$ip3.$(($ip4 + node + 1))" | ||
grep $node_hostname /etc/hosts || echo "$node_ip $node_hostname" >> /etc/hosts | ||
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
yum install -y centos-release-openshift-origin | ||
yum install -y wget git net-tools bind-utils iptables-services bridge-utils bash-completion kexec-tools sos psacct docker | ||
systemctl start docker | ||
systemctl enable docker | ||
yum -y update | ||
yum --enablerepo=centos-openshift-origin-testing install -y atomic-openshift-utils |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
#!/bin/bash | ||
master_ip=$1 | ||
nodes=$2 | ||
|
||
bash /vagrant/cluster/vagrant/setup_openshift_common.sh | ||
|
||
sed -i '/host_key_checking/s/^#//g' /etc/ansible/ansible.cfg | ||
IFS=. read ip1 ip2 ip3 ip4 <<< "$master_ip" | ||
nodes="" | ||
for node in $(seq 0 $(($2 - 1))); do | ||
node_ip="$ip1.$ip2.$ip3.$(($ip4 + node + 1))" | ||
node_hostname="node$node openshift_node_labels=\"{'region': 'infra','zone': 'default'}\" openshift_ip=$node_ip" | ||
nodes="$nodes$node_hostname\n" | ||
done | ||
cat > inventory <<EOF | ||
[OSEv3:children] | ||
masters | ||
nodes | ||
[OSEv3:vars] | ||
ansible_ssh_user=root | ||
ansible_ssh_pass=vagrant | ||
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 | ||
openshift_repos_enable_testing=True | ||
[masters] | ||
master openshift_ip=$master_ip | ||
[etcd] | ||
master openshift_ip=$master_ip | ||
[nodes] | ||
master openshift_node_labels="{'region': 'infra','zone': 'default'}" openshift_schedulable=true openshift_ip=$master_ip | ||
$nodes | ||
EOF | ||
|
||
ansible-playbook -i inventory /usr/share/ansible/openshift-ansible/playbooks/byo/config.yml | ||
|
||
# Create OpenShift user | ||
oc create user admin | ||
oc create identity allow_all_auth:admin | ||
oc create useridentitymapping allow_all_auth:admin admin | ||
oadm policy add-cluster-role-to-user cluster-admin admin | ||
|
||
echo -e "\033[0;32m Deployment was successful!\033[0m" |