aboutsummaryrefslogtreecommitdiffstats
path: root/yardstick/orchestrator
diff options
context:
space:
mode:
authorRodolfo Alonso Hernandez <rodolfo.alonso.hernandez@intel.com>2018-07-19 09:09:23 +0000
committerGerrit Code Review <gerrit@opnfv.org>2018-07-19 09:09:23 +0000
commit4e058b76a3f9edd26b60f2eeaf4a4ff95e7aa0a6 (patch)
treec763b3705dcd087d02388b1b749c04ce66b51053 /yardstick/orchestrator
parent5ae93eed050cad404c9505037a1e8362e571173c (diff)
parentc8facac8b67176e61ab2e00b312cc2deafe57b79 (diff)
Merge "Add "imagePullPolicy" parameter in Kubernetes container"
Diffstat (limited to 'yardstick/orchestrator')
-rw-r--r--yardstick/orchestrator/kubernetes.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/yardstick/orchestrator/kubernetes.py b/yardstick/orchestrator/kubernetes.py
index 1da177945..bee4d4a78 100644
--- a/yardstick/orchestrator/kubernetes.py
+++ b/yardstick/orchestrator/kubernetes.py
@@ -25,6 +25,7 @@ class ContainerObject(object):
COMMAND_DEFAULT = '/bin/bash'
RESOURCES = ('requests', 'limits')
PORT_OPTIONS = ('containerPort', 'hostIP', 'hostPort', 'name', 'protocol')
+ IMAGE_PULL_POLICY = ('Always', 'IfNotPresent', 'Never')
def __init__(self, name, ssh_key, **kwargs):
self._name = name
@@ -37,6 +38,7 @@ class ContainerObject(object):
self._env = kwargs.get('env', [])
self._resources = kwargs.get('resources', {})
self._ports = kwargs.get('ports', [])
+ self._image_pull_policy = kwargs.get('imagePullPolicy')
def _create_volume_mounts(self):
"""Return all "volumeMounts" items per container"""
@@ -83,6 +85,10 @@ class ContainerObject(object):
for res in (res for res in self._resources if
res in self.RESOURCES):
container['resources'][res] = self._resources[res]
+ if self._image_pull_policy:
+ if self._image_pull_policy not in self.IMAGE_PULL_POLICY:
+ raise exceptions.KubernetesContainerWrongImagePullPolicy()
+ container['imagePullPolicy'] = self._image_pull_policy
return container