Skip to content

Commit

Permalink
CMP-2859: filter default ImageStream constructs from the samples oper…
Browse files Browse the repository at this point in the history
…ator and ClusterVersion

Signed-off-by: Kaushik Talathi <kaushik.talathi1@ibm.com>
  • Loading branch information
KaushikOP committed Jan 24, 2025
1 parent 2edb023 commit 336507e
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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 (<pre>imagePolicy = { scheduled: true }</pre>), run the following command:
<pre>oc get imagestreams -A -ojson | jq '.items[] | select(.spec.tags[]?.importPolicy.scheduled == true) | .metadata.name' | sort | uniq</pre>
<pre>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</pre>
Alternatively, to view a list of ImageStreams that do not schedule updates,
run:
<pre>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</pre>
<pre>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</pre>
warnings:
- general: |-
Expand Down

0 comments on commit 336507e

Please sign in to comment.