aboutsummaryrefslogtreecommitdiffstats
path: root/yardstick/orchestrator
diff options
context:
space:
mode:
authorTrevor Tao <trevor.tao@arm.com>2017-09-21 14:43:29 +0800
committerTrevor Tao <trevor.tao@arm.com>2017-09-21 14:43:29 +0800
commit0f4cf413a3c527ddf2eab3d724ae758e39af1aa0 (patch)
tree12ba15eddc81f579029151c9f8cc5b167bce8ba7 /yardstick/orchestrator
parent870d2ba61b4a3352ef8485c3b39690346010e89b (diff)
Add nodeSelector to enable selecting the desired
Kubernetes running node when creating containers for Kubernetes context For example, a yaml file may looks like: servers: host: image: xxx command: /bin/bash nodeSelector: xxx: yyy Synchronously change the unit test for this function Change-Id: If74c9dad9b1a70395bb79f34708a0fde04e7e650 Signed-off-by: Trevor Tao <trevor.tao@arm.com>
Diffstat (limited to 'yardstick/orchestrator')
-rw-r--r--yardstick/orchestrator/kubernetes.py10
1 files changed, 9 insertions, 1 deletions
diff --git a/yardstick/orchestrator/kubernetes.py b/yardstick/orchestrator/kubernetes.py
index 6d7045f58..3d4548527 100644
--- a/yardstick/orchestrator/kubernetes.py
+++ b/yardstick/orchestrator/kubernetes.py
@@ -23,6 +23,7 @@ class KubernetesObject(object):
self.command = [kwargs.get('command', '/bin/bash')]
self.args = kwargs.get('args', [])
self.ssh_key = kwargs.get('ssh_key', 'yardstick_key')
+ self.node_selector = kwargs.get('nodeSelector', {})
self.volumes = []
@@ -42,7 +43,8 @@ class KubernetesObject(object):
},
"spec": {
"containers": [],
- "volumes": []
+ "volumes": [],
+ "nodeSelector": {}
}
}
}
@@ -50,6 +52,7 @@ class KubernetesObject(object):
self._change_value_according_name(name)
self._add_containers()
+ self._add_node_selector()
self._add_ssh_key_volume()
self._add_volumes()
@@ -88,6 +91,11 @@ class KubernetesObject(object):
return container
+ def _add_node_selector(self):
+ utils.set_dict_value(self.template,
+ 'spec.template.spec.nodeSelector',
+ self.node_selector)
+
def _add_volumes(self):
utils.set_dict_value(self.template,
'spec.template.spec.volumes',