diff --git a/roles/env_op_images/tasks/pulled_images_report.yml b/roles/env_op_images/tasks/pulled_images_report.yml index b24a5db7b..8aacb7710 100644 --- a/roles/env_op_images/tasks/pulled_images_report.yml +++ b/roles/env_op_images/tasks/pulled_images_report.yml @@ -18,8 +18,10 @@ # - Load cluster ImageContentSourcePolicy + ImageDigestMirrorSet objects via oc. # - Flatten them into {source, mirror} pairs (repository prefix -> mirror ref). # - For each container/initContainer in selected namespaces, compare the pod -# status image string to those prefixes: first matching rule yields +# status image string to those prefixes: first matching source rule yields # expected_pull_basis mirror and expected_pull_location from the mirror host; +# if no source rule matched, a second pass checks whether the image already +# references a known mirror prefix (direct mirror URL in the pod spec); # otherwise basis source and location from the image ref host. # Matching uses image (reference string), not imageID; pod status often keeps # the upstream registry name even when the runtime used a mirror. diff --git a/roles/env_op_images/templates/pulled_images_report.j2 b/roles/env_op_images/templates/pulled_images_report.j2 index 5e21881d6..62faa14c0 100644 --- a/roles/env_op_images/templates/pulled_images_report.j2 +++ b/roles/env_op_images/templates/pulled_images_report.j2 @@ -25,6 +25,14 @@ {% set match.expected_pull_basis = 'mirror' %} {% endif %} {% endfor %} +{% if match.expected_pull_basis != 'mirror' %} +{% for m in _pulled_report_mirror_mappings if m.mirror is defined and m.mirror and image.startswith(m.mirror) %} +{% if loop.first %} +{% set match.host = m.mirror.split('/')[0] %} +{% set match.expected_pull_basis = 'mirror' %} +{% endif %} +{% endfor %} +{% endif %} {% set _ = entries.append({ 'namespace': pod.metadata.namespace, 'pod': pod.metadata.name,