Switch to using prebuilt CCP images

This commit is contained in:
Aleksandr Didenko 2016-07-01 17:19:41 +02:00
parent ca8ef29ae4
commit 4d295d567b
4 changed files with 50 additions and 32 deletions

View file

@ -27,15 +27,6 @@ git clone https://github.com/adidenko/vagrant-k8s
cd 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: * Prepare the virtual lab:
```bash ```bash

View file

@ -19,6 +19,24 @@ skip_empty = True
EOF 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() { create_resolvconf() {
DNS_IP=`kubectl get service/kubedns --namespace=kube-system --template={{.spec.clusterIP}}` DNS_IP=`kubectl get service/kubedns --namespace=kube-system --template={{.spec.clusterIP}}`
cat > /root/resolv.conf << EOF cat > /root/resolv.conf << EOF
@ -61,8 +79,9 @@ hack_images() {
done done
} }
create_mcp_conf # Switch to using prebuild images from ccp team
#create_mcp_conf
create_mirantis_mcp_conf
create_registry create_registry
create_resolvconf #create_resolvconf
#hack_images #build_images
build_images

View file

@ -14,9 +14,12 @@ nodes=( \
) )
create_network_conf() { 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 if [ -f /root/cluster-topology.yaml ] ; then
# ( 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 "/root/cluster-topology.yaml already exists"
( 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 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() { assign_node_roles() {
@ -28,10 +31,15 @@ assign_node_roles() {
done 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 create_network_conf
assign_node_roles assign_node_roles
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

View file

@ -9,12 +9,12 @@
rsync_opts: rsync_opts:
- "--exclude=/microservices-repos" - "--exclude=/microservices-repos"
tasks: tasks:
- name: Patch MCP # - name: Patch MCP
shell: patch -p1 < ../patch1 # shell: patch -p1 < ../patch1
args: # args:
chdir: /root/ccp/microservices/ # chdir: /root/ccp/microservices/
creates: /usr/local/bin/mcp-microservices # creates: /usr/local/bin/mcp-microservices
- name: Install MCP - name: Install MCP cli tool
shell: "{{ item }}" shell: "{{ item }}"
args: args:
chdir: /root/ccp/microservices/ chdir: /root/ccp/microservices/
@ -22,8 +22,8 @@
with_items: with_items:
- pip install . - pip install .
- python setup.py develop - python setup.py develop
- name: Build CCP images # - name: Build CCP images
shell: ./ccp-build.sh # shell: ./ccp-build.sh
args: # args:
chdir: /root/ccp # chdir: /root/ccp
run_once: true # run_once: true