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

[community-4.8] WINC-571: [wmco] Prevent OLM upgrades when operator is busy #760

Conversation

saifshaikh48
Copy link
Contributor

Manual backport of #618 due to vendoring conflict.

@jrvaldes
Copy link
Contributor

/lgtm

@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label Oct 18, 2021
This commit introduces a new time limit to wait for changes upon to resources
to take effect. This applies to resource creation, deletion & updates/patches.
Patching the operator's Upgradeable condition can take longer to so a longer
retry timeout is chosen rather than erroring out too quickly.

(cherry picked from commit 1dc44ab)
This commit introduces constants that denote the name of each controller.
These names are used in log messages, events, and other outputs.

(cherry picked from commit 2c1f115)
This commit introduces the reporting of operator conditions back to OLM.
Specifically, the `Upgradeable` condition is set to `False` when WMCO is
processing any child components (Windows nodes, private key secret, CSRs),
blocking OLM from replacing the operator CSV during this time.
The `Upgradeable` condition is set back to `True` when no processing is
currently ongoing, meaning that all controllers:
- reconciled without error
- did not request a requeue

If there is at least one busy controller, operator cannot be upgraded
(Upgradeable condition set to False), preventing unsafe updates.
A mutex lock is maintained to secure access to the busy controllers set
and the patching of the OperatorCondition resource.
This ensures smooth transitions from one EUS version of OpenShift to another.

A warning event is sent off when there is a failure getting or patching the
OperatorCodnition resource. The event serves to alert users, as such
failures can block WMCO controllers from executing reconcile steps (as
recommended by OLM). A recorder was added to the secret reconciler struct to
bring it in line with the other reconcilers.

(cherry picked from commit 3fa7419)
This commit tests the operator's ability to communicate to OLM that it
is currently not interruptable for upgrade. Checks are added to ensure
the oeprator's Upgradeable condition is False when it is processing any
sub-components, and reset to True when it is not reconciling/safe for upgrade.

(cherry picked from commit f57effd)
Ran:
- `go get "github.com/operator-framework/api/pkg/operators/v2"`
- `go mod vendor && go mod tidy`
@saifshaikh48 saifshaikh48 force-pushed the prevent-concurrent-upgrade-c4.8 branch from 65159ab to f28efe3 Compare October 18, 2021 17:08
@openshift-ci openshift-ci bot removed the lgtm Indicates that a PR is ready to be merged. label Oct 18, 2021
@saifshaikh48
Copy link
Contributor Author

/lgtm

@openshift-ci
Copy link
Contributor

openshift-ci bot commented Oct 18, 2021

@saifshaikh48: you cannot LGTM your own PR.

In response to this:

/lgtm

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.

Copy link
Contributor

@aravindhp aravindhp 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 Indicates that a PR is ready to be merged. label Oct 18, 2021
@openshift-ci
Copy link
Contributor

openshift-ci bot commented Oct 18, 2021

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: aravindhp, saifshaikh48

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-ci openshift-ci bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Oct 18, 2021
@openshift-merge-robot openshift-merge-robot merged commit 121be96 into openshift:community-4.8 Oct 18, 2021
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. lgtm Indicates that a PR is ready to be merged.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants