c12s-kubespray/ccp/ccp-deploy.sh

29 lines
1.2 KiB
Bash
Raw Normal View History

2016-06-27 15:57:29 +00:00
#!/bin/bash
set -e
create_network_conf() {
# FIXME: hardcoded network topology:
# public_ip: \d+.\d+.0.\d+ pubcic_iface: eth1
# private_ip: \d+.\d+.1.\d+ private_iface: eth2
kubectl get nodes -o go-template='{{range .items}}{{range .status.addresses}}{{if or (eq .type "ExternalIP") (eq .type "LegacyHostIP")}}{{.address}}{{print "\n"}}{{end}}{{end}}{{end}}'> /tmp/nodes
( echo "network:"; i=2; for ip in `cat /tmp/nodes `; do echo -e " node$i:\n private:\n iface: eth2\n address: $ip"; pip=`echo $ip | perl -pe 's/(\d+).(\d+).1/\${1}.\${2}.0/g'`; echo -e " public:\n iface: eth1\n address: $pip" ; i=$(( i+=1 )) ;done ) > /root/cluster-topology.yaml
2016-06-27 15:57:29 +00:00
}
assign_node_roles() {
# FIXME: hardcoded roles
kubectl label nodes node2 openstack-controller=true
kubectl label nodes node3 openstack-controller=true
kubectl label nodes node4 openstack-controller=true
kubectl label nodes node5 openstack-compute=true
kubectl label nodes node6 openstack-compute=true
kubectl label nodes node7 openstack-compute=true
2016-06-27 15:57:29 +00:00
}
create_network_conf
assign_node_roles
kubectl delete namespace openstack && sleep 40
2016-06-27 16:04:14 +00:00
mcp-microservices --config-file=/root/mcp.conf deploy -t /root/cluster-topology.yaml
2016-06-27 15:57:29 +00:00