Skip to content

Commit

Permalink
Adjust polarity of condition when CSV not found
Browse files Browse the repository at this point in the history
In situations where a subscription does not reference a CSV, a special
condition is created and an event emitted to report that no relevant CSV
was found. Previously, this condition was "True", which made sense with
its reason, but not with the "ClusterServiceVersionCompliant" type. Now
the condition will be "False", and the reason has been changed to still
make sense.

Refs:
 - https://issues.redhat.com/browse/ACM-10190

Signed-off-by: Justin Kulikauskas <jkulikau@redhat.com>
(cherry picked from commit 5b47b3a)
  • Loading branch information
JustinKuli authored and magic-mirror-bot[bot] committed Feb 29, 2024
1 parent 10c1e9d commit 0ddf2b5
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
4 changes: 2 additions & 2 deletions controllers/operatorpolicy_status.go
Original file line number Diff line number Diff line change
Expand Up @@ -586,8 +586,8 @@ func buildCSVCond(csv *operatorv1alpha1.ClusterServiceVersion) metav1.Condition

var noCSVCond = metav1.Condition{
Type: csvConditionType,
Status: metav1.ConditionTrue,
Reason: "NoRelevantClusterServiceVersion",
Status: metav1.ConditionFalse,
Reason: "RelevantCSVFound",
Message: "A relevant installed ClusterServiceVersion could not be found",
}

Expand Down
10 changes: 10 additions & 0 deletions test/e2e/case38_install_operator_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -718,6 +718,16 @@ var _ = Describe("Test installing an operator from OperatorPolicy", Ordered, fun
"No existing operator Deployments",
)
})

It("Should not have any compliant events", func() {
// This test is meant to find an incorrect compliant event that is emitted between some
// correct noncompliant events.
events := utils.GetMatchingEvents(
clientManaged, opPolTestNS, parentPolicyName, "", "^Compliant;", eventuallyTimeout,
)

Expect(events).To(BeEmpty())
})
})
Describe("Test status reporting for CatalogSource", Ordered, func() {
const (
Expand Down

0 comments on commit 0ddf2b5

Please sign in to comment.