From 336507e608f0546d16d67358a286365763b65c62 Mon Sep 17 00:00:00 2001 From: Kaushik Talathi Date: Fri, 24 Jan 2025 17:37:13 +0530 Subject: [PATCH] CMP-2859: filter default ImageStream constructs from the samples operator and ClusterVersion Signed-off-by: Kaushik Talathi --- .../openshift/registry/imagestream_sets_schedule/rule.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/applications/openshift/registry/imagestream_sets_schedule/rule.yml b/applications/openshift/registry/imagestream_sets_schedule/rule.yml index 0146fad94c8..5d2c0201c6c 100644 --- a/applications/openshift/registry/imagestream_sets_schedule/rule.yml +++ b/applications/openshift/registry/imagestream_sets_schedule/rule.yml @@ -32,17 +32,17 @@ references: srg: SRG-APP-000456-CTR-001125 {{% set api_path = '/apis/image.openshift.io/v1/imagestreams' %}} -{{% set jqfilter = '[.items[] | .spec.tags[]? | select(.from.kind != "ImageStreamTag") | (.importPolicy.scheduled != null and .importPolicy.scheduled != false)] | all' %}} +{{% set jqfilter = '[.items[] | select( .metadata.ownerReferences? // [] | all(.kind != "ClusterVersion")) | select(.metadata.labels[]? | select("samples.operator.openshift.io/managed: true") | not) | select(.spec.tags[]?.from.kind != "ImageStreamTag" and (.importPolicy.scheduled != null or .importPolicy.scheduled != false))] | any' %}} ocil_clause: 'imagestream is not configured to perform periodical updates' ocil: |- To list all the imagestreams and identify which imagestream tags are configured to periodically check for updates (
imagePolicy = { scheduled: true }
), run the following command: -
oc get imagestreams -A -ojson | jq '.items[] | select(.spec.tags[]?.importPolicy.scheduled == true) | .metadata.name' | sort | uniq
+
oc get imagestream -A -ojson | jq -r '.items[] | select( .metadata.ownerReferences? // [] | all(.kind == "ClusterVersion")) | select(.metadata.labels[]? | select( "samples.operator.openshift.io/managed: true")) | select( .spec.tags[]?.from.kind != "ImageStreamTag" and .importPolicy.scheduled == true).metadata.name' | sort | uniq
Alternatively, to view a list of ImageStreams that do not schedule updates, run: -
oc get imagestreams -A -ojson | jq -r '.items[] | select(.spec.tags[]? | select(.from.kind != "ImageStreamTag" and (.importPolicy.scheduled == null or .importPolicy.scheduled == false))) | "\(.metadata.namespace),\(.metadata.name)"' | sort | uniq
+
oc get imagestream -A -ojson | jq -r '.items[] | select( .metadata.ownerReferences? // [] | all(.kind != "ClusterVersion")) | select(.metadata.labels[]? | select( "samples.operator.openshift.io/managed: true") | not) | select( .spec.tags[]?.from.kind != "ImageStreamTag" and (.importPolicy.scheduled == null or .importPolicy.scheduled == false)) | "\(.metadata.namespace),\(.metadata.name)"' | sort | uniq
warnings: - general: |-