summaryrefslogtreecommitdiffstats
path: root/roles/openshift_health_checker/openshift_checks
diff options
context:
space:
mode:
authorLuke Meyer <lmeyer@redhat.com>2017-10-20 13:12:26 -0400
committerLuke Meyer <lmeyer@redhat.com>2017-11-06 14:37:03 -0500
commit37812f0da8f72df9108bfdcd882439d3faeea79b (patch)
tree55e26a77dc044bdb464a0bcb2660066641212630 /roles/openshift_health_checker/openshift_checks
parent5efcf4a2f7e9c2f21c6f9f86dc08f12fd5f56290 (diff)
downloadopenshift-37812f0da8f72df9108bfdcd882439d3faeea79b.tar.gz
openshift-37812f0da8f72df9108bfdcd882439d3faeea79b.tar.bz2
openshift-37812f0da8f72df9108bfdcd882439d3faeea79b.tar.xz
openshift-37812f0da8f72df9108bfdcd882439d3faeea79b.zip
reconcile registry-console and docker_image_availability
Fixes bug 1497310 https://bugzilla.redhat.com/show_bug.cgi?id=1497310 The registry console is a special case in more than one way. This adds logic to incorporate the openshift_cockpit_deployer_* variables into determining what its image will be in docker_image_availability. Along the way I noticed the origin and enterprise templates for this were not consistent. Now they are, and the example hosts file is updated.
Diffstat (limited to 'roles/openshift_health_checker/openshift_checks')
-rw-r--r--roles/openshift_health_checker/openshift_checks/docker_image_availability.py32
1 files changed, 26 insertions, 6 deletions
diff --git a/roles/openshift_health_checker/openshift_checks/docker_image_availability.py b/roles/openshift_health_checker/openshift_checks/docker_image_availability.py
index 5beb20503..587c6f85c 100644
--- a/roles/openshift_health_checker/openshift_checks/docker_image_availability.py
+++ b/roles/openshift_health_checker/openshift_checks/docker_image_availability.py
@@ -1,5 +1,6 @@
"""Check that required Docker images are available."""
+import re
from pipes import quote
from ansible.module_utils import six
from openshift_checks import OpenShiftCheck
@@ -11,12 +12,16 @@ DEPLOYMENT_IMAGE_INFO = {
"origin": {
"namespace": "openshift",
"name": "origin",
- "registry_console_image": "cockpit/kubernetes",
+ "registry_console_template": "${prefix}kubernetes:${version}",
+ "registry_console_prefix": "cockpit/",
+ "registry_console_default_version": "latest",
},
"openshift-enterprise": {
"namespace": "openshift3",
"name": "ose",
- "registry_console_image": "registry.access.redhat.com/openshift3/registry-console",
+ "registry_console_template": "${prefix}registry-console:${version}",
+ "registry_console_prefix": "registry.access.redhat.com/openshift3/",
+ "registry_console_default_version": "${short_version}",
},
}
@@ -151,10 +156,7 @@ class DockerImageAvailability(DockerHostMixin, OpenShiftCheck):
if 'oo_nodes_to_config' in host_groups:
for suffix in NODE_IMAGE_SUFFIXES:
required.add(image_url.replace("${component}", suffix).replace("${version}", image_tag))
- # The registry-console is for some reason not prefixed with ose- like the other components.
- # Nor is it versioned the same, so just look for latest.
- # Also a completely different name is used for Origin.
- required.add(image_info["registry_console_image"])
+ required.add(self._registry_console_image(image_tag, image_info))
# images for containerized components
if self.get_var("openshift", "common", "is_containerized"):
@@ -170,6 +172,24 @@ class DockerImageAvailability(DockerHostMixin, OpenShiftCheck):
return required
+ def _registry_console_image(self, image_tag, image_info):
+ """Returns image with logic to parallel what happens with the registry-console template."""
+ # The registry-console is for some reason not prefixed with ose- like the other components.
+ # Nor is it versioned the same. Also a completely different name is used for Origin.
+ prefix = self.get_var(
+ "openshift_cockpit_deployer_prefix",
+ default=image_info["registry_console_prefix"],
+ )
+
+ # enterprise template just uses v3.6, v3.7, etc
+ match = re.match(r'v\d+\.\d+', image_tag)
+ short_version = match.group() if match else image_tag
+ version = image_info["registry_console_default_version"].replace("${short_version}", short_version)
+ version = self.get_var("openshift_cockpit_deployer_version", default=version)
+
+ template = image_info["registry_console_template"]
+ return template.replace('${prefix}', prefix).replace('${version}', version)
+
def local_images(self, images):
"""Filter a list of images and return those available locally."""
found_images = []