Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CMP-2859: Resolve failing Image-stream-sets-schedule #12895

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

KaushikOP
Copy link

@KaushikOP KaushikOP commented Jan 24, 2025

Description:

  • Resolve failing Image-stream-sets-schedule. Changes to samples operator which were not accounted for, and ClusterVersion managed imagestreams should be excluded.

Rationale:

  • fixes failing rule

  • Fixes #CMP-2859

Review Hints:

  • Part of DISA-STIG profile for OCP

…ator and ClusterVersion

Signed-off-by: Kaushik Talathi <[email protected]>
@openshift-ci openshift-ci bot added the needs-ok-to-test Used by openshift-ci bot. label Jan 24, 2025
Copy link

openshift-ci bot commented Jan 24, 2025

Hi @KaushikOP. Thanks for your PR.

I'm waiting for a ComplianceAsCode member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@KaushikOP KaushikOP changed the title CMP2859: Resolve failing Image-stream-sets-schedule CMP-2859: Resolve failing Image-stream-sets-schedule Jan 24, 2025
@prb112
Copy link
Contributor

prb112 commented Jan 24, 2025

/jira-refresh

@@ -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' %}}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. Gather all ImageStreams - .items[]
  2. Select only those not managed by ClusterVersion - select( .metadata.ownerReferences? // [] | all(.kind != "ClusterVersion"))
  • ClusterVersion implies on upgrade that these ImageStream entries are upgraded
  1. From those that remain, check if it's managed by the Samples Operator, if so ignore those - select(.metadata.labels[]? | select("samples.operator.openshift.io/managed: true") | not)
  2. Check the Remaining ones are not tags - select(.spec.tags[]?.from.kind != "ImageStreamTag" and (partial query here)
  • e.g. ImageStreamTag latest points to v1.2.3
  1. The ones that remain from that check to see if scheduled is false or not set - (.importPolicy.scheduled != null or .importPolicy.scheduled != false))] | any' %}}

If any fail the last condition it returns false for the query.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs-ok-to-test Used by openshift-ci bot.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants