Browse Source

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
tags/3.0.0
Corey O'Brien 3 years ago
parent
commit
08ac9a6cba

+ 1
- 1
.testr.conf View File

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

+ 8
- 0
magnum/templates/kubernetes/fragments/configure-kubernetes-minion.sh View File

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

+ 0
- 1
magnum/templates/kubernetes/kubecluster.yaml View File

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

+ 1
- 0
magnum/tests/contrib/copy_instance_logs.sh View File

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

+ 3
- 3
magnum/tests/functional/api/v1/clients/bay_client.py View File

@@ -112,12 +112,12 @@ class BayClient(client.MagnumClient):
112 112
 
113 113
     def wait_for_bay_to_delete(self, bay_id):
114 114
         utils.wait_for_condition(
115
-            lambda: self.does_bay_not_exist(bay_id), 10, 3600)
115
+            lambda: self.does_bay_not_exist(bay_id), 10, 600)
116 116
 
117 117
     def wait_for_created_bay(self, bay_id, delete_on_error=True):
118 118
         try:
119 119
             utils.wait_for_condition(
120
-                lambda: self.does_bay_exist(bay_id), 10, 3600)
120
+                lambda: self.does_bay_exist(bay_id), 10, 1800)
121 121
         except Exception:
122 122
             # In error state.  Clean up the bay id if desired
123 123
             self.LOG.error('Bay %s entered an exception state.' % bay_id)
@@ -129,7 +129,7 @@ class BayClient(client.MagnumClient):
129 129
 
130 130
     def wait_for_final_state(self, bay_id):
131 131
         utils.wait_for_condition(
132
-            lambda: self.is_bay_in_final_state(bay_id), 10, 3600)
132
+            lambda: self.is_bay_in_final_state(bay_id), 10, 1800)
133 133
 
134 134
     def is_bay_in_final_state(self, bay_id):
135 135
         try:

+ 1
- 1
magnum/tests/functional/api/v1/test_bay.py View File

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

+ 12
- 0
magnum/tests/functional/k8s/test_k8s_python_client.py View File

@@ -12,6 +12,7 @@
12 12
 
13 13
 from magnum.common.pythonk8sclient.swagger_client import api_client
14 14
 from magnum.common.pythonk8sclient.swagger_client.apis import apiv_api
15
+from magnum.tests.functional.common import utils
15 16
 from magnum.tests.functional.python_client_base import BayTest
16 17
 
17 18
 
@@ -32,6 +33,17 @@ class TestKubernetesAPIs(BayTest):
32 33
                                           cert_file=self.cert_file,
33 34
                                           ca_certs=self.ca_file)
34 35
         self.k8s_api = apiv_api.ApivApi(k8s_client)
36
+        # TODO(coreypobrien) https://bugs.launchpad.net/magnum/+bug/1551824
37
+        utils.wait_for_condition(self._is_api_ready, 5, 600)
38
+
39
+    def _is_api_ready(self):
40
+        try:
41
+            self.k8s_api.list_namespaced_node()
42
+            self.LOG.info("API is ready.")
43
+            return True
44
+        except Exception:
45
+            self.LOG.info("API is not ready yet.")
46
+            return False
35 47
 
36 48
     def test_pod_apis(self):
37 49
         pod_manifest = {'apiVersion': 'v1',

+ 22
- 13
magnum/tests/functional/python_client_base.py View File

@@ -27,6 +27,7 @@ from six.moves import configparser
27 27
 
28 28
 from magnum.common.utils import rmtree_without_raise
29 29
 from magnum.tests.functional.common import base
30
+from magnum.tests.functional.common import utils
30 31
 from magnumclient.common.apiclient import exceptions
31 32
 from magnumclient.common import cliutils
32 33
 from magnumclient.v1 import client as v1client
@@ -91,19 +92,23 @@ class BaseMagnumClient(base.BaseMagnumTest):
91 92
                                  magnum_url=magnum_url)
92 93
 
93 94
     @classmethod
94
-    def _wait_on_status(cls, bay, wait_status, finish_status):
95
+    def _wait_on_status(cls, bay, wait_status, finish_status, timeout=6000):
95 96
         # Check status every 60 seconds for a total of 100 minutes
96
-        for i in range(100):
97
-            # sleep 1s to wait bay status changes, this will be useful for
98
-            # the first time we wait for the status, to avoid another 59s
99
-            time.sleep(1)
97
+
98
+        def _check_status():
100 99
             status = cls.cs.bays.get(bay.uuid).status
100
+            cls.LOG.debug("Bay status is %s" % status)
101 101
             if status in wait_status:
102
-                time.sleep(59)
102
+                return False
103 103
             elif status in finish_status:
104
-                break
104
+                return True
105 105
             else:
106
-                raise Exception("Unknown Status : %s" % status)
106
+                raise Exception("Unexpected Status: %s" % status)
107
+
108
+        # sleep 1s to wait bay status changes, this will be useful for
109
+        # the first time we wait for the status, to avoid another 59s
110
+        time.sleep(1)
111
+        utils.wait_for_condition(_check_status, interval=60, timeout=timeout)
107 112
 
108 113
     @classmethod
109 114
     def _create_baymodel(cls, name, **kwargs):
@@ -157,10 +162,12 @@ class BaseMagnumClient(base.BaseMagnumTest):
157 162
         cls.cs.bays.delete(bay_uuid)
158 163
 
159 164
         try:
160
-            cls._wait_on_status(cls.bay,
161
-                                ["CREATE_COMPLETE",
162
-                                 "DELETE_IN_PROGRESS", "CREATE_FAILED"],
163
-                                ["DELETE_FAILED", "DELETE_COMPLETE"])
165
+            cls._wait_on_status(
166
+                cls.bay,
167
+                ["CREATE_COMPLETE", "DELETE_IN_PROGRESS", "CREATE_FAILED"],
168
+                ["DELETE_FAILED", "DELETE_COMPLETE"],
169
+                timeout=600
170
+            )
164 171
         except exceptions.NotFound:
165 172
             pass
166 173
         else:
@@ -171,7 +178,9 @@ class BaseMagnumClient(base.BaseMagnumTest):
171 178
         self._wait_on_status(
172 179
             bay,
173 180
             [None, "CREATE_IN_PROGRESS"],
174
-            ["CREATE_FAILED", "CREATE_COMPLETE"])
181
+            ["CREATE_FAILED", "CREATE_COMPLETE"],
182
+            timeout=1800
183
+        )
175 184
 
176 185
         if self.cs.bays.get(bay.uuid).status == 'CREATE_FAILED':
177 186
             raise Exception("bay %s created failed" % bay.uuid)

Loading…
Cancel
Save