Switch to using upstream fuel-ccp project
This commit is contained in:
parent
b4dfd8c973
commit
8b3112d287
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -1 +1,2 @@
|
||||||
ssh
|
ssh
|
||||||
|
nodes
|
||||||
|
|
6
Vagrantfile
vendored
6
Vagrantfile
vendored
|
@ -89,6 +89,12 @@ Vagrant.configure("2") do |config|
|
||||||
:libvirt__network_name => "#{$instance_name_prefix}-private",
|
:libvirt__network_name => "#{$instance_name_prefix}-private",
|
||||||
:libvirt__dhcp_enabled => false,
|
:libvirt__dhcp_enabled => false,
|
||||||
:libvirt__forward_mode => "none"
|
:libvirt__forward_mode => "none"
|
||||||
|
# "neutron" isolated network
|
||||||
|
test_vm.vm.network :private_network,
|
||||||
|
:model_type => "e1000",
|
||||||
|
:libvirt__network_name => "#{$instance_name_prefix}-neutron",
|
||||||
|
:libvirt__dhcp_enabled => false,
|
||||||
|
:libvirt__forward_mode => "none"
|
||||||
|
|
||||||
# Provisioning
|
# Provisioning
|
||||||
config.vm.provision "file", source: "ssh", destination: "~/ssh"
|
config.vm.provision "file", source: "ssh", destination: "~/ssh"
|
||||||
|
|
|
@ -24,5 +24,5 @@ kargo --version || (
|
||||||
test -f ./nodes || cp /var/tmp/nodes ./nodes
|
test -f ./nodes || cp /var/tmp/nodes ./nodes
|
||||||
|
|
||||||
# Either pull or copy microservices repos
|
# Either pull or copy microservices repos
|
||||||
cp -a /var/tmp/microservices* ./ccp/
|
cp -a /var/tmp/microservices* ./ccp/ || touch /var/tmp/ccp-download
|
||||||
|
|
||||||
|
|
|
@ -1,94 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
|
|
||||||
set -e
|
|
||||||
|
|
||||||
PREBUILT="$1"
|
|
||||||
|
|
||||||
create_mcp_conf() {
|
|
||||||
echo "Create mcp config"
|
|
||||||
cat > /root/mcp.conf << EOF
|
|
||||||
[builder]
|
|
||||||
push = True
|
|
||||||
|
|
||||||
[registry]
|
|
||||||
address = "127.0.0.1:31500"
|
|
||||||
|
|
||||||
[kubernetes]
|
|
||||||
environment = "openstack"
|
|
||||||
|
|
||||||
[repositories]
|
|
||||||
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"
|
|
||||||
insecure = True
|
|
||||||
|
|
||||||
[images]
|
|
||||||
namespace = "nextgen"
|
|
||||||
|
|
||||||
[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
|
|
||||||
search openstack.svc.cluster.local svc.cluster.local cluster.local default.svc.cluster.local svc.cluster.local cluster.local
|
|
||||||
nameserver $DNS_IP
|
|
||||||
options attempts:2
|
|
||||||
options ndots:5
|
|
||||||
EOF
|
|
||||||
}
|
|
||||||
|
|
||||||
create_registry() {
|
|
||||||
if kubectl get pods | grep registry ; then
|
|
||||||
echo "Registry is already running"
|
|
||||||
else
|
|
||||||
echo "Create registry"
|
|
||||||
kubectl create -f registry_pod.yaml
|
|
||||||
kubectl create -f registry_svc.yaml
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
build_images() {
|
|
||||||
echo "Waiting for registry to start..."
|
|
||||||
while true
|
|
||||||
do
|
|
||||||
STATUS=$(kubectl get pod | awk '/registry/ {print $3}')
|
|
||||||
if [ "$STATUS" == "Running" ]
|
|
||||||
then
|
|
||||||
break
|
|
||||||
fi
|
|
||||||
sleep 1
|
|
||||||
done
|
|
||||||
mcp-microservices --config-file /root/mcp.conf build &> /var/log/mcp-build.log
|
|
||||||
}
|
|
||||||
|
|
||||||
hack_images() {
|
|
||||||
# useless, but let's keep it just in case we need to hack something else
|
|
||||||
for dir in ~/microservices-repos/ms-*/docker/* ; do
|
|
||||||
cp /root/resolv.conf $dir/
|
|
||||||
sed '/MAINTAINER/a COPY resolv.conf /var/tmp/resolv.conf' -i $dir/Dockerfile.j2
|
|
||||||
done
|
|
||||||
}
|
|
||||||
|
|
||||||
create_registry
|
|
||||||
|
|
||||||
if [ -n "$PREBUILT" ]; then
|
|
||||||
create_mirantis_mcp_conf
|
|
||||||
else
|
|
||||||
create_mcp_conf
|
|
||||||
build_images
|
|
||||||
fi
|
|
|
@ -1,49 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
|
|
||||||
set -e
|
|
||||||
|
|
||||||
# FIXME: hardcoded roles
|
|
||||||
declare -A nodes
|
|
||||||
nodes=( \
|
|
||||||
["node2"]="openstack-controller=true"
|
|
||||||
["node3"]="openstack-controller=true"
|
|
||||||
["node4"]="openstack-controller=true"
|
|
||||||
["node5"]="openstack-compute=true"
|
|
||||||
["node6"]="openstack-compute=true"
|
|
||||||
["node7"]="openstack-compute=true"
|
|
||||||
)
|
|
||||||
|
|
||||||
create_network_conf() {
|
|
||||||
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() {
|
|
||||||
all_label='openstack-compute-controller=true'
|
|
||||||
for i in "${!nodes[@]}"
|
|
||||||
do
|
|
||||||
node=$i
|
|
||||||
label=${nodes[$i]}
|
|
||||||
kubectl get nodes $node --show-labels | grep -q "$label" || kubectl label nodes $node $label
|
|
||||||
kubectl get nodes $node --show-labels | grep -q "$all_label" || kubectl label nodes $node $all_label
|
|
||||||
done
|
|
||||||
}
|
|
||||||
|
|
||||||
delete_namespace() {
|
|
||||||
if kubectl get namespace | grep -q ^openstack ; then
|
|
||||||
kubectl delete namespace openstack && while kubectl get namespace | grep -q ^openstack ; do sleep 5; done
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
deploy_microservices() {
|
|
||||||
mcp-microservices --config-file=/root/mcp.conf --deploy-config=deploy-config.yaml deploy &> /var/log/mcp-deploy.log
|
|
||||||
}
|
|
||||||
|
|
||||||
create_network_conf
|
|
||||||
assign_node_roles
|
|
||||||
delete_namespace
|
|
||||||
deploy_microservices
|
|
|
@ -1,92 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
|
|
||||||
set -e
|
|
||||||
|
|
||||||
GERRIT_USER=${1:-$USER}
|
|
||||||
LOCAL_REPO="microservices-repos"
|
|
||||||
PROTO="ssh://$GERRIT_USER@"
|
|
||||||
REMOTE_REPOS="
|
|
||||||
review.fuel-infra.org:29418/nextgen/ms-aodh
|
|
||||||
review.fuel-infra.org:29418/nextgen/ms-ceilometer
|
|
||||||
review.fuel-infra.org:29418/nextgen/ms-ceph
|
|
||||||
review.fuel-infra.org:29418/nextgen/ms-cinder
|
|
||||||
review.fuel-infra.org:29418/nextgen/ms-debian-base
|
|
||||||
review.fuel-infra.org:29418/nextgen/ms-designate
|
|
||||||
review.fuel-infra.org:29418/nextgen/ms-elasticsearch
|
|
||||||
review.fuel-infra.org:29418/nextgen/ms-ext-config
|
|
||||||
review.fuel-infra.org:29418/nextgen/ms-glance
|
|
||||||
review.fuel-infra.org:29418/nextgen/ms-grafana
|
|
||||||
review.fuel-infra.org:29418/nextgen/ms-heat
|
|
||||||
review.fuel-infra.org:29418/nextgen/ms-horizon
|
|
||||||
review.fuel-infra.org:29418/nextgen/ms-influxdb
|
|
||||||
review.fuel-infra.org:29418/nextgen/ms-ironic
|
|
||||||
review.fuel-infra.org:29418/nextgen/ms-keystone
|
|
||||||
review.fuel-infra.org:29418/nextgen/ms-kibana
|
|
||||||
review.fuel-infra.org:29418/nextgen/ms-lma
|
|
||||||
review.fuel-infra.org:29418/nextgen/ms-magnum
|
|
||||||
review.fuel-infra.org:29418/nextgen/ms-manila
|
|
||||||
review.fuel-infra.org:29418/nextgen/ms-mariadb
|
|
||||||
review.fuel-infra.org:29418/nextgen/ms-memcached
|
|
||||||
review.fuel-infra.org:29418/nextgen/ms-mistral
|
|
||||||
review.fuel-infra.org:29418/nextgen/ms-mongodb
|
|
||||||
review.fuel-infra.org:29418/nextgen/ms-murano
|
|
||||||
review.fuel-infra.org:29418/nextgen/ms-neutron
|
|
||||||
review.fuel-infra.org:29418/nextgen/ms-nova
|
|
||||||
review.fuel-infra.org:29418/nextgen/ms-openstack-base
|
|
||||||
review.fuel-infra.org:29418/nextgen/ms-openvswitch
|
|
||||||
review.fuel-infra.org:29418/nextgen/ms-rabbitmq
|
|
||||||
review.fuel-infra.org:29418/nextgen/ms-sahara
|
|
||||||
review.fuel-infra.org:29418/nextgen/ms-swift
|
|
||||||
review.fuel-infra.org:29418/nextgen/ms-tempest
|
|
||||||
review.fuel-infra.org:29418/nextgen/ms-toolbox
|
|
||||||
review.fuel-infra.org:29418/nextgen/ms-trove
|
|
||||||
review.fuel-infra.org:29418/nextgen/ms-zaqar
|
|
||||||
"
|
|
||||||
|
|
||||||
cleanup() {
|
|
||||||
mkdir -p $LOCAL_REPO
|
|
||||||
rm -rf $LOCAL_REPO/ms-*
|
|
||||||
rm -rf microservices
|
|
||||||
}
|
|
||||||
|
|
||||||
fetch_mcp() {
|
|
||||||
git clone "${PROTO}review.fuel-infra.org:29418/nextgen/microservices"
|
|
||||||
# pushd microservices
|
|
||||||
# git review -d 22660
|
|
||||||
# popd
|
|
||||||
}
|
|
||||||
|
|
||||||
fetch_repos() {
|
|
||||||
pushd $LOCAL_REPO
|
|
||||||
for remote in $REMOTE_REPOS ; do
|
|
||||||
git clone "${PROTO}${remote}"
|
|
||||||
done
|
|
||||||
popd
|
|
||||||
}
|
|
||||||
|
|
||||||
fetch_app_def() {
|
|
||||||
echo "Fetch app-def repos"
|
|
||||||
neutron=21886
|
|
||||||
ovs=21951
|
|
||||||
nova=21871
|
|
||||||
|
|
||||||
cd $LOCAL_REPO
|
|
||||||
|
|
||||||
cd ms-neutron
|
|
||||||
git review -d $neutron
|
|
||||||
cd -
|
|
||||||
cd ms-openvswitch
|
|
||||||
git review -d $ovs
|
|
||||||
cd -
|
|
||||||
cd ms-nova
|
|
||||||
git review -d $nova
|
|
||||||
cd -
|
|
||||||
}
|
|
||||||
|
|
||||||
cleanup
|
|
||||||
fetch_mcp
|
|
||||||
fetch_repos
|
|
||||||
|
|
||||||
#fetch_app_def
|
|
||||||
|
|
||||||
echo "Microservices pull is complete"
|
|
16
ccp/ccp.conf
Normal file
16
ccp/ccp.conf
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
[DEFAULT]
|
||||||
|
deploy_config = /root/ccp/deploy-config.yaml
|
||||||
|
|
||||||
|
[builder]
|
||||||
|
push = True
|
||||||
|
|
||||||
|
[registry]
|
||||||
|
address = "127.0.0.1:31500"
|
||||||
|
|
||||||
|
[kubernetes]
|
||||||
|
namespace = "openstack"
|
||||||
|
|
||||||
|
[repositories]
|
||||||
|
skip_empty = True
|
||||||
|
protocol = https
|
||||||
|
port = 443
|
|
@ -1,2 +1,4 @@
|
||||||
configs:
|
configs:
|
||||||
neutron_external_interface: eth1
|
public_interface: eth1
|
||||||
|
private_interface: eth2
|
||||||
|
neutron_external_interface: eth3
|
||||||
|
|
28
ccp/patch1
28
ccp/patch1
|
@ -1,28 +0,0 @@
|
||||||
diff --git a/microservices/build.py b/microservices/build.py
|
|
||||||
index 1f26b5a..e419343 100644
|
|
||||||
--- a/microservices/build.py
|
|
||||||
+++ b/microservices/build.py
|
|
||||||
@@ -84,7 +84,7 @@ def find_dockerfiles(repository_name, tmp_dir, match=True):
|
|
||||||
return dockerfiles
|
|
||||||
|
|
||||||
|
|
||||||
-IMAGE_FULL_NAME_RE = "(([\\w_-]+)\\/)?([\\w_-]+)(:([\\w_.-]+))?"
|
|
||||||
+IMAGE_FULL_NAME_RE = "(.*\/)?(([\\w_-]+)\\/)?([\\w_-]+)(:([\\w_.-]+))?"
|
|
||||||
IMAGE_FULL_NAME_PATTERN = re.compile(IMAGE_FULL_NAME_RE)
|
|
||||||
|
|
||||||
DOCKER_FILE_FROM_PATTERN = re.compile(
|
|
||||||
|
|
||||||
diff --git a/microservices/common/jinja_utils.py b/microservices/common/jinja_utils.py
|
|
||||||
index c9c8cd2..37ff6f2 100644
|
|
||||||
--- a/microservices/common/jinja_utils.py
|
|
||||||
+++ b/microservices/common/jinja_utils.py
|
|
||||||
@@ -16,6 +16,9 @@ def str_to_bool(text):
|
|
||||||
|
|
||||||
def jinja_render(path):
|
|
||||||
variables = {k: v for k, v in CONF.images.items()}
|
|
||||||
+ if CONF.builder.push and CONF.registry.address:
|
|
||||||
+ variables['namespace'] = '%s/%s' % (CONF.registry.address,
|
|
||||||
+ variables['namespace'])
|
|
||||||
|
|
||||||
env = jinja2.Environment(loader=jinja2.FileSystemLoader(
|
|
||||||
os.path.dirname(path)))
|
|
|
@ -1,31 +1,45 @@
|
||||||
- hosts: all
|
|
||||||
tasks:
|
|
||||||
- lineinfile:
|
|
||||||
dest: /etc/hosts
|
|
||||||
regexp: 'registry01-bud.ng.mirantis.net'
|
|
||||||
line: '172.16.180.121 registry01-bud.ng.mirantis.net'
|
|
||||||
|
|
||||||
- hosts: kube-master
|
- hosts: kube-master
|
||||||
pre_tasks:
|
pre_tasks:
|
||||||
- name: Rsync CCP repos
|
- name: Download fuel-ccp
|
||||||
synchronize: src=../ccp/microservices-repos/ dest=/root/microservices-repos/
|
shell: git clone https://git.openstack.org/openstack/fuel-ccp
|
||||||
- name: Rsync MCP scripts and repo
|
args:
|
||||||
|
chdir: /usr/local/src
|
||||||
|
creates: /usr/local/src/fuel-ccp/setup.py
|
||||||
|
- name: Upload ccp configs to master nodes
|
||||||
synchronize:
|
synchronize:
|
||||||
src: ../ccp/
|
src: ../ccp/
|
||||||
dest: /root/ccp/
|
dest: /root/ccp/
|
||||||
rsync_opts:
|
|
||||||
- "--exclude=/microservices-repos"
|
|
||||||
tasks:
|
tasks:
|
||||||
- name: Install MCP cli tool
|
- name: Install CCP cli tool
|
||||||
shell: "{{ item }}"
|
shell: pip install -U fuel-ccp/
|
||||||
args:
|
args:
|
||||||
chdir: /root/ccp/microservices/
|
chdir: /usr/local/src
|
||||||
creates: /usr/local/bin/mcp-microservices
|
creates: /usr/local/bin/mcp-microservices
|
||||||
with_items:
|
- name: Get pods
|
||||||
- pip install .
|
shell: kubectl get pods
|
||||||
- python setup.py develop
|
register: get_pod
|
||||||
- name: Build CCP images
|
run_once: true
|
||||||
shell: ./ccp-build.sh
|
- name: Get services
|
||||||
|
shell: kubectl get svc
|
||||||
|
register: get_svc
|
||||||
|
run_once: true
|
||||||
|
- name: Create registry pod
|
||||||
|
shell: kubectl create -f registry_pod.yaml
|
||||||
|
args:
|
||||||
|
chdir: /root/ccp
|
||||||
|
run_once: true
|
||||||
|
- name: Create registry svc
|
||||||
|
shell: kubectl create -f registry_svc.yaml
|
||||||
|
args:
|
||||||
|
chdir: /root/ccp
|
||||||
|
run_once: true
|
||||||
|
when: get_svc.stdout.find('registry') == -1
|
||||||
|
- name: Fetch CCP images
|
||||||
|
shell: mcp-microservices --config-file=/root/ccp/ccp.conf fetch
|
||||||
|
chdir: /usr/local/src
|
||||||
|
run_once: true
|
||||||
|
- name: Build CCP images
|
||||||
|
shell: mcp-microservices --config-file=/root/ccp/ccp.conf build
|
||||||
args:
|
args:
|
||||||
chdir: /root/ccp
|
chdir: /root/ccp
|
||||||
run_once: true
|
run_once: true
|
||||||
|
|
|
@ -1,14 +1,17 @@
|
||||||
- hosts: kube-master
|
- hosts: kube-master
|
||||||
pre_tasks:
|
pre_tasks:
|
||||||
- name: Rsync MCP scripts and repo
|
- name: Rsync CCP configs
|
||||||
synchronize:
|
synchronize:
|
||||||
src: ../ccp/
|
src: ../ccp/
|
||||||
dest: /root/ccp/
|
dest: /root/ccp/
|
||||||
rsync_opts:
|
|
||||||
- "--exclude=/microservices-repos"
|
|
||||||
tasks:
|
tasks:
|
||||||
|
- name: Get namespaces
|
||||||
|
shell: kubectl get namespace
|
||||||
|
register: get_ns
|
||||||
|
run_once: true
|
||||||
- name: Deploy CCP
|
- name: Deploy CCP
|
||||||
shell: ./ccp-deploy.sh
|
shell: mcp-microservices --config-file=/root/ccp/ccp.conf deploy
|
||||||
args:
|
args:
|
||||||
chdir: /root/ccp
|
chdir: /root/ccp
|
||||||
run_once: true
|
run_once: true
|
||||||
|
when: get_ns.stdout.find('openstack') == -1
|
||||||
|
|
Loading…
Reference in a new issue