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
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions pkg/controller/status/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.


// calculate the current controller state
allReady, lastTransition := c.currentControllerStatus()

Expand Down
4 changes: 4 additions & 0 deletions pkg/controller/status/status.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,3 +52,7 @@ func (c *controllerStatus) hasStatus(id string) bool {
_, ok := c.statusMap[id]
return ok
}

func (c *controllerStatus) reset() {
c.statusMap = make(map[string]statusMessage)
}