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, 'cert_file': None,
'insecure': False, 'insecure': False,
'cluster_domain': 'cluster.local', 'cluster_domain': 'cluster.local',
'image_pull_policy': None,
}, },
} }
@ -22,6 +23,10 @@ SCHEMA = {
'cert_file': {'anyOf': [{'type': 'string'}, {'type': 'null'}]}, 'cert_file': {'anyOf': [{'type': 'string'}, {'type': 'null'}]},
'insecure': {'type': 'boolean'}, 'insecure': {'type': 'boolean'},
'cluster_domain': {'type': 'string'}, '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 = { cont_spec = {
"name": container["name"], "name": container["name"],
"image": images.image_spec(container["image"]), "image": images.image_spec(container["image"]),
"imagePullPolicy": "Always", "imagePullPolicy": CONF.kubernetes.image_pull_policy,
"command": _get_start_cmd(container["name"]), "command": _get_start_cmd(container["name"]),
"volumeMounts": serialize_volume_mounts(container), "volumeMounts": serialize_volume_mounts(container),
"readinessProbe": { "readinessProbe": {
@ -167,7 +167,7 @@ def serialize_job_container_spec(container, job):
return { return {
"name": job["name"], "name": job["name"],
"image": images.image_spec(container["image"]), "image": images.image_spec(container["image"]),
"imagePullPolicy": "Always", "imagePullPolicy": CONF.kubernetes.image_pull_policy,
"command": _get_start_cmd(job["name"]), "command": _get_start_cmd(job["name"]),
"volumeMounts": serialize_volume_mounts(container, job), "volumeMounts": serialize_volume_mounts(container, job),
"env": serialize_env_variables(container) "env": serialize_env_variables(container)

View File

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