diff --git a/README.md b/README.md index ad24abbae..99d43dbbc 100644 --- a/README.md +++ b/README.md @@ -27,15 +27,6 @@ git clone https://github.com/adidenko/vagrant-k8s cd vagrant-k8s ``` -* If you want to run OpenStack CCP (Containerised Control Plane) then you need -to pull CCP repos and patches: - -```bash -pushd ccp -./ccp-pull.sh -popd -``` - * Prepare the virtual lab: ```bash diff --git a/ccp/ccp-build.sh b/ccp/ccp-build.sh index 4a6b42bc7..f3149e213 100755 --- a/ccp/ccp-build.sh +++ b/ccp/ccp-build.sh @@ -19,6 +19,24 @@ skip_empty = True EOF } +create_mirantis_mcp_conf() { + echo "Create mcp config" + cat > /root/mcp.conf << EOF +[builder] +push = False + +[registry] +address = "registry01-bud.ng.mirantis.net:5800" +insecure = True + +[kubernetes] +environment = "openstack" + +[repositories] +skip_empty = True +EOF +} + create_resolvconf() { DNS_IP=`kubectl get service/kubedns --namespace=kube-system --template={{.spec.clusterIP}}` cat > /root/resolv.conf << EOF @@ -61,8 +79,9 @@ hack_images() { done } -create_mcp_conf +# Switch to using prebuild images from ccp team +#create_mcp_conf +create_mirantis_mcp_conf create_registry -create_resolvconf -#hack_images -build_images +#create_resolvconf +#build_images diff --git a/ccp/ccp-deploy.sh b/ccp/ccp-deploy.sh index f3ebfd715..b8bdae0e4 100755 --- a/ccp/ccp-deploy.sh +++ b/ccp/ccp-deploy.sh @@ -14,9 +14,12 @@ nodes=( \ ) create_network_conf() { - 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 - ( echo "network:"; i=2; for ip in `cat /tmp/nodes `; do echo -e " node$i:\n private:\n address: $ip"; i=$(( i+=1 )) ; done ) > /root/cluster-topology.yaml + if [ -f /root/cluster-topology.yaml ] ; then + echo "/root/cluster-topology.yaml already exists" + else + 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 address: $ip"; i=$(( i+=1 )) ; done ) > /root/cluster-topology.yaml + fi } assign_node_roles() { @@ -28,10 +31,15 @@ assign_node_roles() { done } +delete_namespace() { + kubectl delete namespace openstack && while kubectl get namespace | grep -q ^openstack ; do sleep 5; done +} + +deploy_microservices() { + mcp-microservices --config-file=/root/mcp.conf deploy -t /root/cluster-topology.yaml &> /var/log/mcp-deploy.log +} + create_network_conf assign_node_roles - -kubectl delete namespace openstack && while kubectl get namespace | grep -q ^openstack ; do sleep 5; done - -mcp-microservices --config-file=/root/mcp.conf deploy -t /root/cluster-topology.yaml &> /var/log/mcp-deploy.log - +delete_namespace +deploy_microservices diff --git a/playbooks/ccp-build.yaml b/playbooks/ccp-build.yaml index 468e846ac..bf660a79e 100644 --- a/playbooks/ccp-build.yaml +++ b/playbooks/ccp-build.yaml @@ -9,12 +9,12 @@ rsync_opts: - "--exclude=/microservices-repos" tasks: - - name: Patch MCP - shell: patch -p1 < ../patch1 - args: - chdir: /root/ccp/microservices/ - creates: /usr/local/bin/mcp-microservices - - name: Install MCP + # - name: Patch MCP + # shell: patch -p1 < ../patch1 + # args: + # chdir: /root/ccp/microservices/ + # creates: /usr/local/bin/mcp-microservices + - name: Install MCP cli tool shell: "{{ item }}" args: chdir: /root/ccp/microservices/ @@ -22,8 +22,8 @@ with_items: - pip install . - python setup.py develop - - name: Build CCP images - shell: ./ccp-build.sh - args: - chdir: /root/ccp - run_once: true + # - name: Build CCP images + # shell: ./ccp-build.sh + # args: + # chdir: /root/ccp + # run_once: true