Browse Source

Log additional hyperkube info after cluster deployment

Since we no longer have additional info in the hyperkube image tag
gather this info using docker inspect

Change-Id: I3a68da3c84071f6d093e35e5a56737ce8f6d088c
Volodymyr Shypyguzov 2 years ago
parent
commit
401621434e

+ 26
- 0
fuel_ccp_tests/helpers/post_install_k8s_checks.py View File

@@ -13,6 +13,7 @@
13 13
 #    under the License.
14 14
 
15 15
 import re
16
+import json
16 17
 
17 18
 from devops.helpers import helpers
18 19
 
@@ -61,3 +62,28 @@ def required_images_exists(node_name, underlay, required_images):
61 62
                      .format(required_image), image)
62 63
             for image in images)
63 64
         for required_image in required_images)
65
+
66
+
67
+def inspect_docker_containers(image_name, underlay, host_ip):
68
+    result = None
69
+    cmd = "docker inspect " \
70
+          "$(docker ps --filter ancestor={image_name} --format={{{{.ID}}}})"\
71
+        .format(image_name=image_name)
72
+    if underlay:
73
+        with underlay.remote(host=host_ip) as remote:
74
+            result = remote.execute(cmd)
75
+    if result:
76
+        LOG.info("Inspecting running containers with name={name}: on: {node}".
77
+                 format(name=image_name, node=host_ip))
78
+        for container in result.stdout_json:
79
+            raw_out = container['Config']['Labels']
80
+            labels = json.dumps(
81
+                raw_out,
82
+                indent=4,
83
+                separators=(',', ': '),
84
+                sort_keys=True
85
+            )
86
+            LOG.info("Docker container {name} Labels: {labels}".format(
87
+                name=container['Name'],
88
+                labels=labels)
89
+            )

+ 9
- 0
fuel_ccp_tests/managers/k8smanager.py View File

@@ -20,6 +20,7 @@ from devops.helpers import helpers
20 20
 
21 21
 from fuel_ccp_tests.helpers import exceptions
22 22
 from fuel_ccp_tests.helpers import _subprocess_runner
23
+from fuel_ccp_tests.helpers import post_install_k8s_checks
23 24
 from fuel_ccp_tests import logger
24 25
 from fuel_ccp_tests import settings
25 26
 from fuel_ccp_tests.managers.k8s import cluster
@@ -158,6 +159,14 @@ class K8SManager(object):
158 159
 
159 160
         self.mark_lvm_nodes(lvm_config)
160 161
 
162
+        hkube_image_name = '{}:{}'.format(
163
+            settings.HYPERKUBE_IMAGE_REPO, settings.HYPERKUBE_IMAGE_TAG
164
+        )
165
+        post_install_k8s_checks.inspect_docker_containers(
166
+            image_name=hkube_image_name,
167
+            underlay=self.__underlay,
168
+            host_ip=k8s_admin_ip)
169
+
161 170
         return result
162 171
 
163 172
     @property

Loading…
Cancel
Save