Skip to content

Commit

Permalink
Merge 42e3efc into ed6d94b
Browse files Browse the repository at this point in the history
  • Loading branch information
katyafervent committed Sep 11, 2018
2 parents ed6d94b + 42e3efc commit b1cb697
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 6 deletions.
2 changes: 2 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ RUN pip install ./kqueen

# Avoid Ssh issues with docker overlayfs and sockets
ENV ANSIBLE_SSH_CONTROL_PATH /dev/shm/cp%%h-%%p-%%r
ENV ANSIBLE_SSH_RETRIES 3
ENV ANSIBLE_TIMEOUT 25
ENV KQUEEN_KS_KUBESPRAY_PATH /code/kubespray
ENV KQUEEN_KS_ANSIBLE_CMD /usr/local/bin/ansible
ENV KQUEEN_KS_ANSIBLE_PLAYBOOK_CMD /usr/local/bin/ansible-playbook
Expand Down
2 changes: 1 addition & 1 deletion kqueen/config/demo_mirantis.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,4 +47,4 @@ class Config(BaseConfig):
POD_INFRA_IMAGE_REPO = 'docker-prod-local.docker.mirantis.net/mirantis/kubernetes/pause-amd64'
POD_INFRA_IMAGE_TAG = 'v1.10.4-4'

KS_DEFAULT_NAMESERVERS = "172.18.80.136"
KS_DEFAULT_NAMESERVERS = "172.18.176.6"
18 changes: 14 additions & 4 deletions kqueen/engines/openstack_kubespray.py
Original file line number Diff line number Diff line change
Expand Up @@ -440,15 +440,20 @@ def _add_fip_to_lo(self, resources):
"""
cmd_fmt = (
"sudo /bin/sh -c 'cat > /etc/rc.local <<EOF\n"
"/sbin/ip addr add %s/32 dev lo\n"
"/sbin/ip addr add %s/32 scope host dev lo\n"
"EOF'"
)
for master in resources["masters"]:
ip = master["fip"]
host = "@".join((self.ssh_username, ip))
ssh_cmd = ("ssh", host) + self.ssh_common_args
subprocess.check_call(ssh_cmd + (cmd_fmt % ip, ))
subprocess.check_call(ssh_cmd + ("sudo /bin/sh /etc/rc.local", ))
try:
subprocess.check_call(ssh_cmd + (cmd_fmt % ip, ))
subprocess.check_call(ssh_cmd + ("sudo /bin/sh /etc/rc.local", ))
except subprocess.CalledProcessError as e:
raise RuntimeError("Enable to add a loopback "
"to make localhost accessible by floating IP. "
"The reason is: {}".format(e))

def scale(self, resources):
inventory = self._generate_inventory(resources)
Expand Down Expand Up @@ -596,7 +601,7 @@ def _run_ansible(self, inventory="hosts.json", playbook="cluster.yml"):
"--extra-vars", "docker_dns_servers_strict=no",
]
env = self._construct_env()
self.ansible_log = os.path.join(self._get_cluster_path(), "ansible_log.txt")
self.ansible_log = os.path.join(self._get_cluster_path(), "ansible_log_for_{0}_playbook.txt".format(playbook))
with open(self.ansible_log, "a+") as log_file:
pipe = subprocess.Popen(
args,
Expand Down Expand Up @@ -711,6 +716,9 @@ def provision(self):
image=self.meta['image'],
flavor=self.meta['master_flavor'],
network=network):
if master.status == 'ERROR':
raise RuntimeError('Could not spawn the instance with id {0}. Check Openstack logs'.format(master.id))

fip = self.c.create_floating_ip("public", server=master)
resources["masters"].append({
"id": master.id,
Expand All @@ -725,6 +733,8 @@ def provision(self):
flavor=self.meta['slave_flavor'],
network=network,
add_random_suffix=True):
if slave.status == 'ERROR':
raise RuntimeError('Could not spawn the instance with id {0}. Check Openstack logs'.format(slave.id))
resources["slaves"].append({
"id": slave.id,
"ip": list(slave.addresses.values())[0][0]["addr"],
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
'pytest',
'pytest-cov',
'pytest-env',
'pytest-flask',
'pytest-flask==0.11.0',
'pytest-ordering',
]

Expand Down

0 comments on commit b1cb697

Please sign in to comment.