summary |
shortlog |
log |
commit | commitdiff |
review |
tree
raw |
patch |
inline | side by side (from parent 1:
4d2e646)
Change-Id: Ie1725c0017b78945e431f493743f9a01a66e83c2
Signed-off-by: Peter Mikus <pmikus@cisco.com>
raise RuntimeError('Failed to setup Kubernetes on {node}.'
.format(node=node['host']))
raise RuntimeError('Failed to setup Kubernetes on {node}.'
.format(node=node['host']))
+ KubernetesUtils.wait_for_kubernetes_pods_on_node(node,
+ nspace='kube-system')
+
@staticmethod
def setup_kubernetes_on_all_duts(nodes):
"""Set up Kubernetes on all DUTs.
@staticmethod
def setup_kubernetes_on_all_duts(nodes):
"""Set up Kubernetes on all DUTs.
- def get_kubernetes_logs_on_node(node, namespace='csit'):
+ def get_kubernetes_logs_on_node(node, nspace='csit'):
"""Get Kubernetes logs on node.
:param node: DUT node.
"""Get Kubernetes logs on node.
:param node: DUT node.
- :param namespace: Kubernetes namespace.
+ :param nspace: Kubernetes namespace.
"""
ssh = SSH()
ssh.connect(node)
cmd = "for p in $(kubectl get pods -n {namespace} --no-headers"\
" | cut -f 1 -d ' '); do echo $p; kubectl logs -n {namespace} $p; "\
"""
ssh = SSH()
ssh.connect(node)
cmd = "for p in $(kubectl get pods -n {namespace} --no-headers"\
" | cut -f 1 -d ' '); do echo $p; kubectl logs -n {namespace} $p; "\
- "done".format(namespace=namespace)
+ "done".format(namespace=nspace)
ssh.exec_command(cmd, timeout=120)
@staticmethod
ssh.exec_command(cmd, timeout=120)
@staticmethod
- def get_kubernetes_logs_on_all_duts(nodes, namespace='csit'):
+ def get_kubernetes_logs_on_all_duts(nodes, nspace='csit'):
"""Get Kubernetes logs on all DUTs.
:param nodes: Topology nodes.
"""Get Kubernetes logs on all DUTs.
:param nodes: Topology nodes.
- :param namespace: Kubernetes namespace.
+ :param nspace: Kubernetes namespace.
"""
for node in nodes.values():
if node['type'] == NodeType.DUT:
"""
for node in nodes.values():
if node['type'] == NodeType.DUT:
- KubernetesUtils.get_kubernetes_logs_on_node(node, namespace)
+ KubernetesUtils.get_kubernetes_logs_on_node(node, nspace)
@staticmethod
def reset_kubernetes_on_node(node):
@staticmethod
def reset_kubernetes_on_node(node):
KubernetesUtils.reset_kubernetes_on_node(node)
@staticmethod
KubernetesUtils.reset_kubernetes_on_node(node)
@staticmethod
- def wait_for_kubernetes_pods_on_node(node):
+ def wait_for_kubernetes_pods_on_node(node, nspace='csit'):
"""Wait for Kubernetes PODs to become in 'Running' state on node.
:param node: DUT node.
"""Wait for Kubernetes PODs to become in 'Running' state on node.
:param node: DUT node.
+ :param nspace: Kubernetes namespace.
:raises RuntimeError: If Kubernetes PODs are not ready.
"""
ssh = SSH()
ssh.connect(node)
:raises RuntimeError: If Kubernetes PODs are not ready.
"""
ssh = SSH()
ssh.connect(node)
- cmd = 'kubectl get -n csit pods --no-headers'
+ cmd = 'kubectl get -n {namespace} pods --no-headers'\
+ .format(namespace=nspace)
for _ in range(48):
(ret_code, stdout, _) = ssh.exec_command_sudo(cmd, timeout=120)
if int(ret_code) == 0:
ready = True
for line in stdout.splitlines():
for _ in range(48):
(ret_code, stdout, _) = ssh.exec_command_sudo(cmd, timeout=120)
if int(ret_code) == 0:
ready = True
for line in stdout.splitlines():
- if 'Running' in line and '1/1' in line:
- ready = True
- else:
+ try:
+ state = line.split()[1].split('/')
+ ready = True if 'Running' in line and\
+ state == state[::-1] else False
+ except ValueError, IndexError:
ready = False
if ready:
break
ready = False
if ready:
break
.format(node=node['host']))
@staticmethod
.format(node=node['host']))
@staticmethod
- def wait_for_kubernetes_pods_on_all_duts(nodes):
+ def wait_for_kubernetes_pods_on_all_duts(nodes, nspace='csit'):
"""Wait for Kubernetes PODs to become in Running state on all DUTs.
:param nodes: Topology nodes.
"""Wait for Kubernetes PODs to become in Running state on all DUTs.
:param nodes: Topology nodes.
+ :param nspace: Kubernetes namespace.
"""
for node in nodes.values():
if node['type'] == NodeType.DUT:
"""
for node in nodes.values():
if node['type'] == NodeType.DUT:
- KubernetesUtils.wait_for_kubernetes_pods_on_node(node)
+ KubernetesUtils.wait_for_kubernetes_pods_on_node(node, nspace)
@staticmethod
def create_kubernetes_vswitch_startup_config(**kwargs):
@staticmethod
def create_kubernetes_vswitch_startup_config(**kwargs):
path = ['unix', 'nodaemon']
self.add_config_item(self._nodeconfig, '', path)
path = ['unix', 'nodaemon']
self.add_config_item(self._nodeconfig, '', path)
+ def add_unix_coredump(self):
+ """Add UNIX full-coredump configuration."""
+ path = ['unix', 'full-coredump']
+ self.add_config_item(self._nodeconfig, '', path)
+
def add_unix_exec(self, value):
"""Add UNIX exec configuration."""
path = ['unix', 'exec']
def add_unix_exec(self, value):
"""Add UNIX exec configuration."""
path = ['unix', 'exec']