Skip to content

Conversation

yiraeChristineKim
Copy link
Contributor

@yiraeChristineKim yiraeChristineKim commented Jan 22, 2025

OperatorPolicy is defined for an operator which is either running a deprecated version, or a channel for updates which is deprecated, the policy should report this in its status

Additionally, resolve the flaky OperatorPolicy issue by switching from the Quay operator to the GRC fake operator.

ref: https://issues.redhat.com/browse/ACM-16120
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.

This is looking great overall! Awesome to see the fake operator for this.

In addition to the "nothing deprecated" condition I mentioned, we should conditionally report the deprecation in the overall status:

func calculateComplianceCondition(policy *policyv1beta1.OperatorPolicy) metav1.Condition {

If you'd prefer, I'd be ok with that addition in a separate PR.

@yiraeChristineKim
Copy link
Contributor Author

yiraeChristineKim commented Jan 27, 2025

This is looking great overall! Awesome to see the fake operator for this.

In addition to the "nothing deprecated" condition I mentioned, we should conditionally report the deprecation in the overall status:

func calculateComplianceCondition(policy *policyv1beta1.OperatorPolicy) metav1.Condition {

If you'd prefer, I'd be ok with that addition in a separate PR.

so my understanding what you suggest, should deprecation status affect compliance(NoCompliant or Compliant)?

Comment on lines +580 to +585
// deprecationCond returns a Compliant condition (without affecting the condition itself),
// and a message in the format: 'The ____ (Package, Channel, Bundle) was deprecated.'
// + additional details from packageManifest.
func deprecationCond(depSchemaName string, depSchema Schema, message string) metav1.Condition {
Copy link
Member

Choose a reason for hiding this comment

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

If we don't want this to affect the final compliance, we should ensure that this returns a Status that matches whatever is Compliant. Right now it doesn't.

To allow users to determine if they want the deprecation status to affect the overall compliance, we'll need to add something to the ComplianceConfig, and pass that into this function. For example, buildDeploymentCond uses that pattern.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I see what you mean

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Could you take a look my change

OperatorPolicy is defined for an operator which is either running a deprecated version, or a channel for updates which is deprecated, the policy should report this in its status
ref: https://issues.redhat.com/browse/ACM-16120
Signed-off-by: yiraeChristineKim <[email protected]>
1. Fix host test flaky issue.  case38:3702
Signed-off-by: yiraeChristineKim <[email protected]>
@yiraeChristineKim yiraeChristineKim force-pushed the ACM-16120 branch 2 times, most recently from 6533e49 to f548dae Compare January 27, 2025 18:05
Comment on lines 137 to 143
// DeprecationAvailable specifies how the NoDeprecations condition impacts overall
// policy compliance. The default value is `Compliant`. If any deprecations are detected
// in the package, channel, or bundle with DeprecationAvailable = NonCompliant,
// then the policy compliance will be set to `Compliant`.
//
// +kubebuilder:default=Compliant
DeprecationAvailable ComplianceConfigAction `json:"deprecationAvailable,omitempty"`
Copy link
Member

Choose a reason for hiding this comment

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

Maybe DeprecationsPresent would make this more clear?

Suggested change
// DeprecationAvailable specifies how the NoDeprecations condition impacts overall
// policy compliance. The default value is `Compliant`. If any deprecations are detected
// in the package, channel, or bundle with DeprecationAvailable = NonCompliant,
// then the policy compliance will be set to `Compliant`.
//
// +kubebuilder:default=Compliant
DeprecationAvailable ComplianceConfigAction `json:"deprecationAvailable,omitempty"`
// DeprecationsPresent specifies how the overall policy compliance is affected by deprecations.
// The default value is `Compliant`. If any deprecations are detected
// while DeprecationsPresent = NonCompliant,
// then the policy compliance will be set to `NonCompliant`.
//
// +kubebuilder:default=Compliant
DeprecationsPresent ComplianceConfigAction `json:"deprecationsPresent,omitempty"`

Copy link
Contributor Author

Choose a reason for hiding this comment

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

genius


idx, cond = policy.Status.GetCondition(deprecationType)
if !policy.Spec.ComplianceType.IsMustNotHave() &&
policy.Spec.ComplianceConfig.DeprecationAvailable == "Compliant" {
Copy link
Member

Choose a reason for hiding this comment

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

Other conditions change the Status of the condition based on the complianceConfig, but I feel like your approach here is better.

If you follow my other suggestion, I think this part would need to be updated like this:

Suggested change
policy.Spec.ComplianceConfig.DeprecationAvailable == "Compliant" {
policy.Spec.ComplianceConfig.DeprecationsPresent == "NonCompliant" {

Add DeprecationsPresent to ComplianceConfigAction
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!

@openshift-ci openshift-ci bot added the lgtm label Jan 28, 2025
Copy link

openshift-ci bot commented Jan 28, 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

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 c3c1716 into open-cluster-management-io:main Jan 28, 2025
13 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