Make imagePullPolicy configurable
'Always' is not the best option as it adds round-trip to registry for every node even if image has already been pulled. Keeping default to be the same as in Kubernetes would make it conmfortable to use 'latest' tag during development and proper versioned tag for production-like environments. Change-Id: Ifa628e00959bae062bb5bb7e95e071af8babee32
This commit is contained in:
parent
c23aacebd0
commit
6f25340851
@ -7,6 +7,7 @@ DEFAULTS = {
|
||||
'cert_file': None,
|
||||
'insecure': None,
|
||||
'cluster_domain': 'cluster.local',
|
||||
'image_pull_policy': None,
|
||||
},
|
||||
}
|
||||
|
||||
@ -22,6 +23,10 @@ SCHEMA = {
|
||||
'cert_file': {'anyOf': [{'type': 'string'}, {'type': 'null'}]},
|
||||
'insecure': {'anyOf': [{'type': 'string'}, {'type': 'null'}]},
|
||||
'cluster_domain': {'type': 'string'},
|
||||
'image_pull_policy': {'oneOf': [
|
||||
{'type': 'null'},
|
||||
{'enum': ['Always', 'IfNotPresent', 'Never']},
|
||||
]},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
@ -123,7 +123,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": {
|
||||
@ -152,7 +152,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)
|
||||
|
@ -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",
|
||||
|
Loading…
Reference in New Issue
Block a user