Skip to content

Commit 0b9b031

Browse files
nemarjancursoragent
authored andcommitted
[env_op_images] Replace ICSP with IDMS/ITMS in pulled-images report
PR #3865 replaced deprecated ImageContentSourcePolicy with ImageDigestMirrorSet and added ImageTagMirrorSet in the openshift_setup role. Align the pulled-images report accordingly: - Remove ICSP lookup (oc get imagecontentsourcepolicy) - Add ITMS lookup (oc get imagetagmirrorset) - Update mirror mapping builder to flatten IDMS imageDigestMirrors and ITMS imageTagMirrors - Update README to reflect IDMS/ITMS terminology Related-Issue: ANVIL-58 Co-authored-by: Cursor <cursoragent@cursor.com> Signed-off-by: nemarjan <nemarjan@redhat.com>
1 parent d02617a commit 0b9b031

3 files changed

Lines changed: 29 additions & 29 deletions

File tree

docs/dictionary/en-custom.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ ICSP
1212
IDMS
1313
ImageDigestMirrorSet
1414
ImageTagMirrorSet
15+
ITMS
1516
IMVHO
1617
IdP
1718
Idempotency

roles/env_op_images/README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
# env_op_images
22

3-
This role collects OpenStack operator image references from the ClusterServiceVersion and running pods into `operator_images.yaml`, builds a **pulled-images policy report** by combining ICSP/IDMS mirror rules with pod status image references, and enriches that report with digest-level **CRI-O pull evidence** from node journals (writing a separate verified YAML artifact).
3+
This role collects OpenStack operator image references from the ClusterServiceVersion and running pods into `operator_images.yaml`, builds a **pulled-images policy report** by combining IDMS/ITMS mirror rules with pod status image references, and enriches that report with digest-level **CRI-O pull evidence** from node journals (writing a separate verified YAML artifact).
44

55
All steps that talk to the cluster require `cifmw_openshift_kubeconfig` to be defined.
66

77
## Workflow
88

99
1. **Operator images artifact** — When OpenStack is installed (or when `cifmw_env_op_images_dryrun` is true), collects images from the OpenStack operator CSV/pods and writes `{{ cifmw_env_op_images_dir }}/artifacts/{{ cifmw_env_op_images_file }}`.
10-
2. **Pulled-images report** (`tasks/pulled_images_report.yml`) — Policy-oriented view (not node-verified): loads `ImageContentSourcePolicy` and `ImageDigestMirrorSet` via `oc`, flattens mirror rules, lists pods in configured namespaces, and emits YAML with a `summary` plus per-container `images` rows (expected pull basis vs. ICSP/IDMS).
10+
2. **Pulled-images report** (`tasks/pulled_images_report.yml`) — Policy-oriented view (not node-verified): loads `ImageDigestMirrorSet` and `ImageTagMirrorSet` via `oc`, flattens mirror rules, lists pods in configured namespaces, and emits YAML with a `summary` plus per-container `images` rows (expected pull basis vs. IDMS/ITMS).
1111
3. **CRI-O verification** (`tasks/verify_pulled_report_crio.yml`) — If the pulled report file exists, fetches CRI-O unit logs per node (`oc adm node-logs <node> -u crio --since=-24h`), saves them under `cifmw_env_op_images_crio_logs_dir`, then runs the `verify_pulled_report_crio` module to write the verified report. This include is non-fatal (`ignore_errors: true`) so a failure here does not abort the rest of the play.
1212

1313
## Parameters
@@ -16,13 +16,13 @@ All steps that talk to the cluster require `cifmw_openshift_kubeconfig` to be de
1616
* `cifmw_env_op_images_file`: (String) Filename for the operator images YAML under `artifacts/`. Defaults to `operator_images.yaml`.
1717
* `cifmw_env_op_images_dryrun`: (Boolean) When true, image collection can run even if OpenStack is not reported Ready. Defaults to `false`.
1818
* `cifmw_env_op_images_pulled_report_namespaces`: (List) Namespaces whose pods are scanned for the pulled report. Defaults to `{{ cifmw_openstack_namespace | default('openstack') }}` and `{{ operator_namespace | default('openstack-operators') }}`.
19-
* `cifmw_env_op_images_pulled_report_path`: (String) Destination YAML for the pulled report: top-level `summary` (including embedded `mirror_rules` from ICSP/IDMS) and `images`. Defaults to `{{ cifmw_env_op_images_dir }}/artifacts/pulled_images_report.yaml`.
19+
* `cifmw_env_op_images_pulled_report_path`: (String) Destination YAML for the pulled report: top-level `summary` (including embedded `mirror_rules` from IDMS/ITMS) and `images`. Defaults to `{{ cifmw_env_op_images_dir }}/artifacts/pulled_images_report.yaml`.
2020
* `cifmw_env_op_images_verified_report_path`: (String) Output YAML after CRI-O enrichment (same structure as the pulled report, with extra fields on rows that could be matched). Defaults to `{{ cifmw_env_op_images_dir }}/artifacts/pulled_images_report_verified.yaml`.
2121
* `cifmw_env_op_images_crio_logs_dir`: (String) Directory for per-node `*.crio.log` files produced before verification. Defaults to `{{ cifmw_env_op_images_dir }}/artifacts/crio_logs`.
2222

2323
### Pulled report (`cifmw_env_op_images_pulled_report_path`)
2424

25-
The pulled report prefix-matches each container’s **status `image` string** (from `containerStatuses` / `initContainerStatuses`) against ICSP/IDMS `source` values; it also records `image_id`, but `expected_pull_basis` / `expected_pull_location` come from the `image` string, not from `imageID`. The first matching rule sets `expected_pull_basis` to `mirror` and `expected_pull_location` to the mirror registry host; otherwise the row uses the image reference’s host and `source`. Pod status may still show the upstream registry name even when the runtime pulled via a mirror.
25+
The pulled report prefix-matches each container’s **status `image` string** (from `containerStatuses` / `initContainerStatuses`) against IDMS/ITMS `source` values; it also records `image_id`, but `expected_pull_basis` / `expected_pull_location` come from the `image` string, not from `imageID`. The first matching rule sets `expected_pull_basis` to `mirror` and `expected_pull_location` to the mirror registry host; otherwise the row uses the image reference’s host and `source`. Pod status may still show the upstream registry name even when the runtime pulled via a mirror.
2626

2727
### Verified report (`cifmw_env_op_images_verified_report_path`)
2828

roles/env_op_images/tasks/pulled_images_report.yml

Lines changed: 24 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
# under the License.
1616

1717
# Pulled-images report (policy view, not node-verified pulls):
18-
# - Load cluster ImageContentSourcePolicy + ImageDigestMirrorSet objects via oc.
18+
# - Load cluster ImageDigestMirrorSet + ImageTagMirrorSet objects via oc.
1919
# - Flatten them into {source, mirror} pairs (repository prefix -> mirror ref).
2020
# - For each container/initContainer in selected namespaces, compare the pod
2121
# status image string to those prefixes: first matching source rule yields
@@ -39,51 +39,50 @@
3939
state: directory
4040
mode: "0755"
4141

42-
- name: Get ICSP mirror rules
43-
ansible.builtin.command:
44-
cmd: oc get imagecontentsourcepolicy -o json
45-
register: _pulled_report_icsp
46-
failed_when: false
47-
4842
- name: Get IDMS mirror rules
4943
ansible.builtin.command:
5044
cmd: oc get imagedigestmirrorset -o json
5145
register: _pulled_report_idms
5246
failed_when: false
5347

54-
# Flatten ICSP repositoryDigestMirrors and IDMS imageDigestMirrors into
55-
# a single list of {source, mirror} pairs. A source with N mirrors
56-
# produces N entries so the Jinja template can prefix-match every
57-
# mirror in one loop.
48+
- name: Get ITMS mirror rules
49+
ansible.builtin.command:
50+
cmd: oc get imagetagmirrorset -o json
51+
register: _pulled_report_itms
52+
failed_when: false
53+
54+
# Flatten IDMS imageDigestMirrors and ITMS imageTagMirrors into a single
55+
# list of {source, mirror} pairs. A source with N mirrors produces N
56+
# entries so the Jinja template can prefix-match every mirror in one loop.
5857
# Example output (_pulled_report_mirror_mappings):
5958
# - source: registry.redhat.io/openstack-k8s-operators
6059
# mirror: quay.example.com/rh-osbs/openstack-k8s-operators
6160
# - source: registry.redhat.io/openstack-k8s-operators
6261
# mirror: internal-registry.corp.net/openstack-k8s-operators
63-
- name: Build source-to-mirror mapping from ICSP/IDMS
62+
- name: Build source-to-mirror mapping from IDMS/ITMS
6463
vars:
65-
_icsp_items: >-
66-
{{ (_pulled_report_icsp.stdout | default('{}', true) | from_json).get('items', []) }}
6764
_idms_items: >-
6865
{{ (_pulled_report_idms.stdout | default('{}', true) | from_json).get('items', []) }}
66+
_itms_items: >-
67+
{{ (_pulled_report_itms.stdout | default('{}', true) | from_json).get('items', []) }}
6968
_mappings: >-
7069
{% set maps = [] %}
71-
{# ICSP spec.repositoryDigestMirrors: source repo + mirrors[] #}
72-
{% for icsp in _icsp_items %}
73-
{% for rdm in icsp.spec.get('repositoryDigestMirrors', []) %}
70+
{# IDMS spec.imageDigestMirrors: digest-based mirror rules #}
71+
{% for idms in _idms_items %}
72+
{% for rdm in idms.spec.get('imageDigestMirrors', []) %}
7473
{% if rdm.source is defined and rdm.source %}
7574
{% for m in rdm.get('mirrors', []) %}
7675
{% set _ = maps.append({'source': rdm.source, 'mirror': m}) %}
7776
{% endfor %}
7877
{% endif %}
7978
{% endfor %}
8079
{% endfor %}
81-
{# IDMS spec.imageDigestMirrors: same shape for matching purposes #}
82-
{% for idms in _idms_items %}
83-
{% for rdm in idms.spec.get('imageDigestMirrors', []) %}
84-
{% if rdm.source is defined and rdm.source %}
85-
{% for m in rdm.get('mirrors', []) %}
86-
{% set _ = maps.append({'source': rdm.source, 'mirror': m}) %}
80+
{# ITMS spec.imageTagMirrors: tag-based mirror rules #}
81+
{% for itms in _itms_items %}
82+
{% for rtm in itms.spec.get('imageTagMirrors', []) %}
83+
{% if rtm.source is defined and rtm.source %}
84+
{% for m in rtm.get('mirrors', []) %}
85+
{% set _ = maps.append({'source': rtm.source, 'mirror': m}) %}
8786
{% endfor %}
8887
{% endif %}
8988
{% endfor %}
@@ -92,11 +91,11 @@
9291
ansible.builtin.set_fact:
9392
_pulled_report_mirror_mappings: "{{ _mappings | trim | from_yaml }}"
9493

95-
- name: Warn if no ICSP/IDMS mirror rules found
94+
- name: Warn if no IDMS/ITMS mirror rules found
9695
when: _pulled_report_mirror_mappings | length == 0
9796
ansible.builtin.debug:
9897
msg: >-
99-
No ICSP or IDMS mirror rules found on the cluster.
98+
No IDMS or ITMS mirror rules found on the cluster.
10099
All rows will have expected_pull_basis: source and expected_pull_location from the image ref.
101100
102101
# Namespaces come from role default / caller; failed namespaces skip via failed_when: false.

0 commit comments

Comments
 (0)