Skip to content

Commit 5ed5de8

Browse files
committed
[env_op_images] Add CRI-O pull verification to pulled-images report
Cross-reference the pulled-images report with CRI-O journal logs from cluster nodes to confirm which images were actually pulled by the container runtime. Runs automatically when kubeconfig is defined, same as the pulled-images report itself. Co-authored-by: Cursor <cursor@cursor.com> Signed-off-by: nemarjan <nemarjan@redhat.com>
1 parent 2f25672 commit 5ed5de8

2 files changed

Lines changed: 12 additions & 17 deletions

File tree

plugins/modules/verify_pulled_report_crio.py

Lines changed: 11 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,7 @@
11
#!/usr/bin/python
22

3-
# Copyright Red Hat, Inc.
4-
# All Rights Reserved.
5-
#
6-
# Licensed under the Apache License, Version 2.0 (the "License"); you may
7-
# not use this file except in compliance with the License. You may obtain
8-
# a copy of the License at
9-
#
10-
# http://www.apache.org/licenses/LICENSE-2.0
11-
#
12-
# Unless required by applicable law or agreed to in writing, software
13-
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
14-
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
15-
# License for the specific language governing permissions and limitations
16-
# under the License.
3+
# Copyright: (c) 2026, Nemanja Marjanovic <nemarjan@redhat.com>
4+
# Apache License Version 2.0 (see LICENSE)
175

186
from __future__ import absolute_import, division, print_function
197

@@ -27,7 +15,7 @@
2715
2816
description:
2917
- Reads the YAML produced by the env_op_images pulled-images report role task.
30-
- Parses CRI-O journal lines for C(msg="Pulled image: ...@sha256:...").
18+
- "Parses CRI-O journal lines for C(msg=\"Pulled image: ...@sha256:...\")."
3119
- Adds per-row verification fields using trusted mirror domains from
3220
C(summary.mirror_rules).
3321
@@ -60,7 +48,7 @@
6048
type: str
6149
6250
author:
63-
- Red Hat
51+
- "Nemanja Marjanovic (@nemarjan)"
6452
6553
notes:
6654
- Requires PyYAML on the controller (same as other cifmw.general modules).
@@ -78,16 +66,20 @@
7866
changed:
7967
description: Whether the output file was written.
8068
type: bool
69+
returned: always
8170
trusted_mirrors:
8271
description: Hostnames extracted from mirror rules in the report summary.
8372
type: list
8473
elements: str
74+
returned: always
8575
log_files:
8676
description: Number of log files read.
8777
type: int
78+
returned: always
8879
entries_with_digest:
8980
description: Image rows that had a sha256 digest in C(image_id).
9081
type: int
82+
returned: always
9183
"""
9284

9385
import glob
@@ -186,7 +178,9 @@ def run_module():
186178
actual_uri = log_evidence[img_sha]
187179
actual_domain = actual_uri.split("/")[0].strip()
188180
is_mirror_domain = actual_domain in trusted_mirrors
189-
img["node_verified_image_origin"] = "mirror" if is_mirror_domain else "source"
181+
img["node_verified_image_origin"] = (
182+
"mirror" if is_mirror_domain else "source"
183+
)
190184
img["log_evidence_uri"] = actual_uri
191185
expected_domain = img.get("expected_pull_location") or ""
192186
img["verification_status"] = (

tests/sanity/ignore.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,4 @@ plugins/modules/tempest_list_skipped.py validate-modules:missing-gplv3-license #
55
plugins/modules/cephx_key.py validate-modules:missing-gplv3-license # ignore license check
66
plugins/modules/krb_request.py validate-modules:missing-gplv3-license # ignore license check
77
plugins/modules/pem_read.py validate-modules:missing-gplv3-license # ignore license check
8+
plugins/modules/verify_pulled_report_crio.py validate-modules:missing-gplv3-license # ignore license check

0 commit comments

Comments
 (0)