Skip to content

Conversation

@yiraeChristineKim
Copy link
Contributor

@yiraeChristineKim yiraeChristineKim commented Nov 20, 2025

Description:
When the subscription section of the OperatorPolicy is invalid, the status might incorrectly indicate that other parts of the policy are invalid. This, combined with the many "... because the policy is invalid" clauses in the overall status, makes it very confusing to read and understand what parts might need to be fixed by the user.

Change summary
Refactored buildResources to simplify control flow, ensure accurate changed propagation, and improve early error reporting.
Added focused unit tests and dryrun tests; refined e2e case38 to reflect new validation behavior and to fix formatting.

Previous results:
The status message was extremely long, for example:
“NonCompliant; installPlanApproval is prohibited in spec.subscription, the namespace specified in spec.operatorGroup ('example') must match the namespace used for the subscription ('openshift-operators'), the status of the OperatorGroup could not be determined because the policy is invalid, the status of the Subscription could not be determined because the policy is invalid, the status of the InstallPlan could not be determined because the policy is invalid, a relevant installed ClusterServiceVersion could not be found, no CRDs were found for the operator, there are no relevant deployments because the ClusterServiceVersion is missing, the status of the CatalogSource could not be determined because the policy is invalid.”
After the fix:
The only meaningful part is now:
“installPlanApproval is prohibited in spec.subscription.”
Everything else was just unnecessary noise and is no longer included.
This part is actually incorrect: "the namespace specified in spec.operatorGroup ('example') must match the namespace used for the subscription ('openshift-operators'),".
Ref: https://issues.redhat.com/browse/ACM-16781

@yiraeChristineKim
Copy link
Contributor Author

/ok-to-test

@yiraeChristineKim yiraeChristineKim force-pushed the ACM-16781 branch 5 times, most recently from e9a6b18 to fb4b3cd Compare November 21, 2025 19:00
@yiraeChristineKim yiraeChristineKim self-assigned this Dec 3, 2025
@yiraeChristineKim yiraeChristineKim marked this pull request as ready for review December 3, 2025 20:12
@openshift-ci openshift-ci bot requested a review from gparvin December 3, 2025 20:12
@yiraeChristineKim
Copy link
Contributor Author

/cc @dhaiducek

@openshift-ci openshift-ci bot requested a review from dhaiducek December 8, 2025 16:02
Copy link
Member

@JustinKuli JustinKuli left a comment

Choose a reason for hiding this comment

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

I was expecting to see some change around where buildResources is called, or where the full compliance message is created - how does this PR shorten the full message to only the relevant part? It seems like when the subscription or operator group are invalid (for example, specifying installPlanApproval), the compliance message will still include the repetitive/confusing "the status of the OperatorGroup could not be determined because the policy is invalid, the status of the Subscription could not be determined because the policy is invalid, the status of the InstallPlan could not be determined because the policy is invalid ..." part. I couldn't find a test that checks for that

@yiraeChristineKim
Copy link
Contributor Author

I was expecting to see some change around where buildResources is called, or where the full compliance message is created - how does this PR shorten the full message to only the relevant part? It seems like when the subscription or operator group are invalid (for example, specifying installPlanApproval), the compliance message will still include the repetitive/confusing "the status of the OperatorGroup could not be determined because the policy is invalid, the status of the Subscription could not be determined because the policy is invalid, the status of the InstallPlan could not be determined because the policy is invalid ..." part. I couldn't find a test that checks for that

TestBuildResources_subInstallPlanApprovalErrorUpdatesStatus test is for that test with message "installPlanApproval is prohibited in spec.subscription"

@yiraeChristineKim yiraeChristineKim force-pushed the ACM-16781 branch 2 times, most recently from 37e8685 to f7febe0 Compare December 18, 2025 21:48
@yiraeChristineKim yiraeChristineKim marked this pull request as draft December 18, 2025 21:59
@yiraeChristineKim yiraeChristineKim force-pushed the ACM-16781 branch 2 times, most recently from 996ca29 to b8968c4 Compare December 19, 2025 15:40
When the subscription section of the OperatorPolicy is invalid, the status might incorrectly indicate that other parts of the policy are invalid. This, combined with the many "... because the policy is invalid" clauses in the overall status, makes it very confusing to read and understand what parts might need to be fixed by the user.
Ref: https://issues.redhat.com/browse/ACM-16781
Signed-off-by: yiraeChristineKim <[email protected]>
Avoid expensive cluster-wide packagemanifest queries, add request timeouts/readiness checks, and handle kubectl failures so bootstrap doesn’t hit TLS handshake timeouts.
Signed-off-by: yiraeChristineKim <[email protected]>
Copy link
Member

@JustinKuli JustinKuli left a comment

Choose a reason for hiding this comment

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

LGTM! Thanks for the persistence!

@openshift-ci openshift-ci bot added the lgtm label Dec 19, 2025
@openshift-ci
Copy link

openshift-ci bot commented Dec 19, 2025

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: JustinKuli, yiraeChristineKim

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:
  • OWNERS [JustinKuli,yiraeChristineKim]

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-merge-bot openshift-merge-bot bot merged commit 541becd into open-cluster-management-io:main Dec 19, 2025
15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants