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

Bug 2012069: Refactoring Status controller #498

Merged

Conversation

rluders
Copy link
Contributor

@rluders rluders commented Sep 14, 2021

This PR changes the status.go organizing the logic into smaller pieces making it a little bit better.

Categories

  • Bugfix
  • Enhancement
  • Backporting
  • Others (CI, Infrastructure, Documentation)

Sample Archive

None

Documentation

None

Unit Tests

None

Privacy

Yes. There are no sensitive data in the newly collected information.

Changelog

Breaking Changes

No

References

https://issues.redhat.com/browse/CCXDEV-5350
https://bugzilla.redhat.com/show_bug.cgi?id=2012069
https://access.redhat.com/solutions/???

@openshift-ci
Copy link

openshift-ci bot commented Sep 14, 2021

Skipping CI for Draft Pull Request.
If you want CI signal for your change, please convert it to an actual PR.
You can still manually trigger a test run with /test all

@openshift-ci openshift-ci bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Sep 14, 2021
@tremes
Copy link
Contributor

tremes commented Sep 14, 2021

I think I would move related objects settings to separate function

@tremes
Copy link
Contributor

tremes commented Sep 14, 2021

Some inspiration can be found in the cluster-monitoring-operator :-)

@rluders
Copy link
Contributor Author

rluders commented Sep 14, 2021

Some inspiration can be found in the cluster-monitoring-operator :-)

LoL... I was doing something very similar. Thanks for the inspiration.

@rluders rluders requested a review from tremes September 16, 2021 09:29
@rluders rluders marked this pull request as ready for review September 16, 2021 09:31
@rluders rluders marked this pull request as draft September 16, 2021 09:55
@openshift-ci openshift-ci bot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Sep 16, 2021
@rluders rluders marked this pull request as ready for review September 16, 2021 14:08
@openshift-ci openshift-ci bot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Sep 16, 2021
@tremes
Copy link
Contributor

tremes commented Sep 17, 2021

/retest

@@ -131,6 +131,9 @@ func (c *Controller) merge(clusterOperator *configv1.ClusterOperator) *configv1.
clusterOperator = newClusterOperator(c.name, nil)
}

// make sure to start a clean status controller
c.ctrlStatus.reset()
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@tremes So, after a few tests (and fighting with the e2e tests), it seems that this is the best solution. We keep an instance to the status controller into the controller (controller everywhere) and then it encapsulates the logic to handle the statuses. But, it needs to be reset every time that the merge is executed, otherwise, the operator status would be wrong.

Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeh, but in this case it is correct. We are "resetting" 'cause the merge method receives the clusterOperator when it is called.

}
type args struct {
condition configv1.ClusterStatusConditionType
}
Copy link
Contributor

Choose a reason for hiding this comment

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

this type is little bit redundant IMO

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Elaborate.

Copy link
Contributor

Choose a reason for hiding this comment

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

I think it's not necessary to wrap condition configv1.ClusterStatusConditionType to a new type. IOW you can use directly the configv1.ClusterStatusConditionType IMO

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... I prefer to keep the args and fields wrapped. It makes the code more standardized test structures.

Copy link
Contributor

Choose a reason for hiding this comment

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

fields and why pls? I can't see any benefit TBH. It adds only unnecessary parts to the test IMO. Using conditions you can omit the https://github.com/openshift/insights-operator/pull/498/files#diff-6cd7b045851c73c1120b823f3d07a763bfb7e20aa20e241ac5d3e27e862d57eaR119-R121 and just do tt.conditions.findCondition(tt.args.condition) then.

Copy link
Contributor

@natiiix natiiix left a comment

Choose a reason for hiding this comment

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

Aside from the commend from @tremes about "The operator is healthy" being logged right after logging an error, I see nothing wrong. The code is alright and at least somewhat commented. I tested this version of IO locally and it ran just fine. Now giving a final approval yet to give others a chance to further review the PR.

Copy link
Contributor

@natiiix natiiix left a comment

Choose a reason for hiding this comment

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

After the fixes that have been made and a discussion with other team members, I believe this PR is now ready.
/lgtm

@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label Oct 7, 2021
@openshift-ci
Copy link

openshift-ci bot commented Oct 7, 2021

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: natiiix, rluders

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:

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

@openshift-bot
Copy link
Contributor

/retest-required

Please review the full test history for this PR and help us cut down flakes.

6 similar comments
@openshift-bot
Copy link
Contributor

/retest-required

Please review the full test history for this PR and help us cut down flakes.

@openshift-bot
Copy link
Contributor

/retest-required

Please review the full test history for this PR and help us cut down flakes.

@openshift-bot
Copy link
Contributor

/retest-required

Please review the full test history for this PR and help us cut down flakes.

@openshift-bot
Copy link
Contributor

/retest-required

Please review the full test history for this PR and help us cut down flakes.

@openshift-bot
Copy link
Contributor

/retest-required

Please review the full test history for this PR and help us cut down flakes.

@openshift-bot
Copy link
Contributor

/retest-required

Please review the full test history for this PR and help us cut down flakes.

@rluders rluders changed the title Refactoring Status controller Bug 2012069: Refactoring Status controller Oct 8, 2021
@openshift-ci openshift-ci bot added the bugzilla/severity-medium Referenced Bugzilla bug's severity is medium for the branch this PR is targeting. label Oct 8, 2021
@openshift-ci
Copy link

openshift-ci bot commented Oct 8, 2021

@rluders: This pull request references Bugzilla bug 2012069, which is valid. The bug has been moved to the POST state. The bug has been updated to refer to the pull request using the external bug tracker.

3 validation(s) were run on this bug
  • bug is open, matching expected state (open)
  • bug target release (4.10.0) matches configured target release for branch (4.10.0)
  • bug is in the state NEW, which is one of the valid states (NEW, ASSIGNED, ON_DEV, POST, POST)

No GitHub users were found matching the public email listed for the QA contact in Bugzilla (dmisharo@redhat.com), skipping review request.

In response to this:

Bug 2012069: Refactoring Status controller

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/test-infra repository.

@openshift-ci openshift-ci bot added the bugzilla/valid-bug Indicates that a referenced Bugzilla bug is valid for the branch this PR is targeting. label Oct 8, 2021
@openshift-ci
Copy link

openshift-ci bot commented Oct 8, 2021

@rluders: This pull request references Bugzilla bug 2012069, which is valid.

3 validation(s) were run on this bug
  • bug is open, matching expected state (open)
  • bug target release (4.10.0) matches configured target release for branch (4.10.0)
  • bug is in the state POST, which is one of the valid states (NEW, ASSIGNED, ON_DEV, POST, POST)

No GitHub users were found matching the public email listed for the QA contact in Bugzilla (dmisharo@redhat.com), skipping review request.

In response to this:

Bug 2012069: Refactoring Status controller

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/test-infra repository.

@openshift-bot
Copy link
Contributor

/retest-required

Please review the full test history for this PR and help us cut down flakes.

1 similar comment
@openshift-bot
Copy link
Contributor

/retest-required

Please review the full test history for this PR and help us cut down flakes.

@openshift-merge-robot openshift-merge-robot merged commit 94660b7 into openshift:master Oct 8, 2021
@openshift-ci
Copy link

openshift-ci bot commented Oct 8, 2021

@rluders: All pull requests linked via external trackers have merged:

Bugzilla bug 2012069 has been moved to the MODIFIED state.

In response to this:

Bug 2012069: Refactoring Status controller

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/test-infra repository.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. bugzilla/severity-medium Referenced Bugzilla bug's severity is medium for the branch this PR is targeting. bugzilla/valid-bug Indicates that a referenced Bugzilla bug is valid for the branch this PR is targeting. lgtm Indicates that a PR is ready to be merged.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants