Merge "Make imagePullPolicy configurable"

This commit is contained in:
Jenkins 2016-12-28 01:51:21 +00:00 committed by Gerrit Code Review
commit 3a6a575d10
3 changed files with 8 additions and 4 deletions

View File

@ -7,6 +7,7 @@ DEFAULTS = {
'cert_file': None,
'insecure': False,
'cluster_domain': 'cluster.local',
'image_pull_policy': None,
},
}
@ -22,6 +23,10 @@ SCHEMA = {
'cert_file': {'anyOf': [{'type': 'string'}, {'type': 'null'}]},
'insecure': {'type': 'boolean'},
'cluster_domain': {'type': 'string'},
'image_pull_policy': {'oneOf': [
{'type': 'null'},
{'enum': ['Always', 'IfNotPresent', 'Never']},
]},
},
},
}

View File

@ -138,7 +138,7 @@ def serialize_daemon_container_spec(container):
cont_spec = {
"name": container["name"],
"image": images.image_spec(container["image"]),
"imagePullPolicy": "Always",
"imagePullPolicy": CONF.kubernetes.image_pull_policy,
"command": _get_start_cmd(container["name"]),
"volumeMounts": serialize_volume_mounts(container),
"readinessProbe": {
@ -167,7 +167,7 @@ def serialize_job_container_spec(container, job):
return {
"name": job["name"],
"image": images.image_spec(container["image"]),
"imagePullPolicy": "Always",
"imagePullPolicy": CONF.kubernetes.image_pull_policy,
"command": _get_start_cmd(job["name"]),
"volumeMounts": serialize_volume_mounts(container, job),
"env": serialize_env_variables(container)

View File

@ -8,7 +8,6 @@ class TestDeploy(base.TestCase):
container = {
"name": "name_foo",
"image": "image_foo",
"imagePullPolicy": "Always",
"command": "command_foo",
"cm_version": 1,
"env": [{
@ -30,7 +29,7 @@ class TestDeploy(base.TestCase):
expected = {
"name": "name_foo",
"image": "ccp/image_foo:latest",
"imagePullPolicy": "Always",
"imagePullPolicy": None,
"command": [
"dumb-init",
"/usr/bin/python",