},
"name": "k8s-86096c30-key"
}
- ]
+ ],
+ "nodeSelector": {
+ "kubernetes.io/hostname": "node-01"
+ }
}
}
}
'command': '/bin/bash',
'args': ['-c', 'chmod 700 ~/.ssh; chmod 600 ~/.ssh/*; \
service ssh restart;while true ; do sleep 10000; done'],
- 'ssh_key': 'k8s-86096c30-key'
+ 'ssh_key': 'k8s-86096c30-key',
+ 'nodeSelector': { 'kubernetes.io/hostname': 'node-01'}
}
name = 'host-k8s-86096c30'
output_r = KubernetesObject(name, **input_s).get_template()
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 = []
},
"spec": {
"containers": [],
- "volumes": []
+ "volumes": [],
+ "nodeSelector": {}
}
}
}
self._change_value_according_name(name)
self._add_containers()
+ self._add_node_selector()
self._add_ssh_key_volume()
self._add_volumes()
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',