Remove minion dependency on master

Make thhe minions work correctly without depending on the master.
Removing this dependency decreases provisioning time by provisioning
nodes in parallel.

Change-Id: I025dbf54ef0cdafc4fe26acc33a9faed8cacd1ca
Partial-Bug: 1536739
Partial-Bug: 1551824
This commit is contained in:
Corey O'Brien 2016-02-02 15:57:40 -05:00
parent 16603db200
commit 08ac9a6cba
8 changed files with 48 additions and 19 deletions

View File

@ -1,7 +1,7 @@
[DEFAULT] [DEFAULT]
test_command=OS_STDOUT_CAPTURE=${OS_STDOUT_CAPTURE:-1} \ test_command=OS_STDOUT_CAPTURE=${OS_STDOUT_CAPTURE:-1} \
OS_STDERR_CAPTURE=${OS_STDERR_CAPTURE:-1} \ OS_STDERR_CAPTURE=${OS_STDERR_CAPTURE:-1} \
OS_TEST_TIMEOUT=${OS_TEST_TIMEOUT:-160} \ OS_TEST_TIMEOUT=${OS_TEST_TIMEOUT:-45} \
${PYTHON:-python} -m subunit.run discover -t ./ ${OS_TEST_PATH:-./magnum/tests/unit} $LISTOPT $IDOPTION ${PYTHON:-python} -m subunit.run discover -t ./ ${OS_TEST_PATH:-./magnum/tests/unit} $LISTOPT $IDOPTION
test_id_option=--load-list $IDFILE test_id_option=--load-list $IDFILE
test_list_option=--list test_list_option=--list

View File

@ -36,6 +36,14 @@ if [ "$NETWORK_DRIVER" == "flannel" ]; then
sed -i ' sed -i '
/^FLANNEL_ETCD=/ s|=.*|="http://'"$ETCD_SERVER_IP"':2379"| /^FLANNEL_ETCD=/ s|=.*|="http://'"$ETCD_SERVER_IP"':2379"|
' /etc/sysconfig/flanneld ' /etc/sysconfig/flanneld
# Make sure etcd has a flannel configuration
. /etc/sysconfig/flanneld
until curl -sf "$FLANNEL_ETCD/v2/keys/coreos.com/network/config?quorum=false&recursive=false&sorted=false"
do
echo "Waiting for flannel configuration in etcd..."
sleep 5
done
fi fi
cat >> /etc/environment <<EOF cat >> /etc/environment <<EOF

View File

@ -465,7 +465,6 @@ resources:
type: OS::Heat::ResourceGroup type: OS::Heat::ResourceGroup
depends_on: depends_on:
- extrouter_inside - extrouter_inside
- kube_masters
properties: properties:
count: {get_param: number_of_minions} count: {get_param: number_of_minions}
removal_policies: [{resource_list: {get_param: minions_to_remove}}] removal_policies: [{resource_list: {get_param: minions_to_remove}}]

View File

@ -48,6 +48,7 @@ if [[ "$COE" == "kubernetes" ]]; then
remote_exec $SSH_USER "sudo journalctl -u cloud-final --no-pager" cloud-final.log remote_exec $SSH_USER "sudo journalctl -u cloud-final --no-pager" cloud-final.log
remote_exec $SSH_USER "sudo journalctl -u cloud-init-local --no-pager" cloud-init-local.log remote_exec $SSH_USER "sudo journalctl -u cloud-init-local --no-pager" cloud-init-local.log
remote_exec $SSH_USER "sudo journalctl -u cloud-init --no-pager" cloud-init.log remote_exec $SSH_USER "sudo journalctl -u cloud-init --no-pager" cloud-init.log
remote_exec $SSH_USER "sudo cat /var/log/cloud-init-output.log" cloud-init-output.log
remote_exec $SSH_USER "sudo journalctl -u kubelet --no-pager" kubelet.log remote_exec $SSH_USER "sudo journalctl -u kubelet --no-pager" kubelet.log
remote_exec $SSH_USER "sudo journalctl -u kube-proxy --no-pager" kube-proxy.log remote_exec $SSH_USER "sudo journalctl -u kube-proxy --no-pager" kube-proxy.log
remote_exec $SSH_USER "sudo journalctl -u etcd --no-pager" etcd.log remote_exec $SSH_USER "sudo journalctl -u etcd --no-pager" etcd.log

View File

@ -112,12 +112,12 @@ class BayClient(client.MagnumClient):
def wait_for_bay_to_delete(self, bay_id): def wait_for_bay_to_delete(self, bay_id):
utils.wait_for_condition( utils.wait_for_condition(
lambda: self.does_bay_not_exist(bay_id), 10, 3600) lambda: self.does_bay_not_exist(bay_id), 10, 600)
def wait_for_created_bay(self, bay_id, delete_on_error=True): def wait_for_created_bay(self, bay_id, delete_on_error=True):
try: try:
utils.wait_for_condition( utils.wait_for_condition(
lambda: self.does_bay_exist(bay_id), 10, 3600) lambda: self.does_bay_exist(bay_id), 10, 1800)
except Exception: except Exception:
# In error state. Clean up the bay id if desired # In error state. Clean up the bay id if desired
self.LOG.error('Bay %s entered an exception state.' % bay_id) self.LOG.error('Bay %s entered an exception state.' % bay_id)
@ -129,7 +129,7 @@ class BayClient(client.MagnumClient):
def wait_for_final_state(self, bay_id): def wait_for_final_state(self, bay_id):
utils.wait_for_condition( utils.wait_for_condition(
lambda: self.is_bay_in_final_state(bay_id), 10, 3600) lambda: self.is_bay_in_final_state(bay_id), 10, 1800)
def is_bay_in_final_state(self, bay_id): def is_bay_in_final_state(self, bay_id):
try: try:

View File

@ -61,7 +61,7 @@ class BayTest(base.BaseMagnumTest):
# NOTE (dimtruck) by default tempest sets timeout to 20 mins. # NOTE (dimtruck) by default tempest sets timeout to 20 mins.
# We need more time. # We need more time.
test_timeout = 3600 test_timeout = 1800
self.useFixture(fixtures.Timeout(test_timeout, gentle=True)) self.useFixture(fixtures.Timeout(test_timeout, gentle=True))
except Exception: except Exception:
self.tearDown() self.tearDown()

View File

@ -12,6 +12,7 @@
from magnum.common.pythonk8sclient.swagger_client import api_client from magnum.common.pythonk8sclient.swagger_client import api_client
from magnum.common.pythonk8sclient.swagger_client.apis import apiv_api from magnum.common.pythonk8sclient.swagger_client.apis import apiv_api
from magnum.tests.functional.common import utils
from magnum.tests.functional.python_client_base import BayTest from magnum.tests.functional.python_client_base import BayTest
@ -32,6 +33,17 @@ class TestKubernetesAPIs(BayTest):
cert_file=self.cert_file, cert_file=self.cert_file,
ca_certs=self.ca_file) ca_certs=self.ca_file)
self.k8s_api = apiv_api.ApivApi(k8s_client) self.k8s_api = apiv_api.ApivApi(k8s_client)
# TODO(coreypobrien) https://bugs.launchpad.net/magnum/+bug/1551824
utils.wait_for_condition(self._is_api_ready, 5, 600)
def _is_api_ready(self):
try:
self.k8s_api.list_namespaced_node()
self.LOG.info("API is ready.")
return True
except Exception:
self.LOG.info("API is not ready yet.")
return False
def test_pod_apis(self): def test_pod_apis(self):
pod_manifest = {'apiVersion': 'v1', pod_manifest = {'apiVersion': 'v1',

View File

@ -27,6 +27,7 @@ from six.moves import configparser
from magnum.common.utils import rmtree_without_raise from magnum.common.utils import rmtree_without_raise
from magnum.tests.functional.common import base from magnum.tests.functional.common import base
from magnum.tests.functional.common import utils
from magnumclient.common.apiclient import exceptions from magnumclient.common.apiclient import exceptions
from magnumclient.common import cliutils from magnumclient.common import cliutils
from magnumclient.v1 import client as v1client from magnumclient.v1 import client as v1client
@ -91,19 +92,23 @@ class BaseMagnumClient(base.BaseMagnumTest):
magnum_url=magnum_url) magnum_url=magnum_url)
@classmethod @classmethod
def _wait_on_status(cls, bay, wait_status, finish_status): def _wait_on_status(cls, bay, wait_status, finish_status, timeout=6000):
# Check status every 60 seconds for a total of 100 minutes # Check status every 60 seconds for a total of 100 minutes
for i in range(100):
# sleep 1s to wait bay status changes, this will be useful for def _check_status():
# the first time we wait for the status, to avoid another 59s
time.sleep(1)
status = cls.cs.bays.get(bay.uuid).status status = cls.cs.bays.get(bay.uuid).status
cls.LOG.debug("Bay status is %s" % status)
if status in wait_status: if status in wait_status:
time.sleep(59) return False
elif status in finish_status: elif status in finish_status:
break return True
else: else:
raise Exception("Unknown Status : %s" % status) raise Exception("Unexpected Status: %s" % status)
# sleep 1s to wait bay status changes, this will be useful for
# the first time we wait for the status, to avoid another 59s
time.sleep(1)
utils.wait_for_condition(_check_status, interval=60, timeout=timeout)
@classmethod @classmethod
def _create_baymodel(cls, name, **kwargs): def _create_baymodel(cls, name, **kwargs):
@ -157,10 +162,12 @@ class BaseMagnumClient(base.BaseMagnumTest):
cls.cs.bays.delete(bay_uuid) cls.cs.bays.delete(bay_uuid)
try: try:
cls._wait_on_status(cls.bay, cls._wait_on_status(
["CREATE_COMPLETE", cls.bay,
"DELETE_IN_PROGRESS", "CREATE_FAILED"], ["CREATE_COMPLETE", "DELETE_IN_PROGRESS", "CREATE_FAILED"],
["DELETE_FAILED", "DELETE_COMPLETE"]) ["DELETE_FAILED", "DELETE_COMPLETE"],
timeout=600
)
except exceptions.NotFound: except exceptions.NotFound:
pass pass
else: else:
@ -171,7 +178,9 @@ class BaseMagnumClient(base.BaseMagnumTest):
self._wait_on_status( self._wait_on_status(
bay, bay,
[None, "CREATE_IN_PROGRESS"], [None, "CREATE_IN_PROGRESS"],
["CREATE_FAILED", "CREATE_COMPLETE"]) ["CREATE_FAILED", "CREATE_COMPLETE"],
timeout=1800
)
if self.cs.bays.get(bay.uuid).status == 'CREATE_FAILED': if self.cs.bays.get(bay.uuid).status == 'CREATE_FAILED':
raise Exception("bay %s created failed" % bay.uuid) raise Exception("bay %s created failed" % bay.uuid)