Skip to content

Block OpenShift upgrades while incompatible operators are installed #2081

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

Conversation

njhale
Copy link
Member

@njhale njhale commented Apr 6, 2021

Description of the change:

Set OLM's ClusterOperator resource to Upgradeable=false when any OLM managed operator on the cluster has a maxOpenShiftVersion property less than the next minor OCP release.

Implements OLM-2074.

I decided to implement this as a new controller so we could more easily interleave new and preexisting ClusterOperator behavior.

@openshift-ci-robot
Copy link
Collaborator

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-robot openshift-ci-robot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Apr 6, 2021
@openshift-ci-robot
Copy link
Collaborator

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: njhale

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-robot openshift-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Apr 6, 2021
@njhale njhale changed the title wip: openshift compat Block OpenShift upgrades while incompatible operators are installed Apr 6, 2021
@njhale njhale force-pushed the openshift/block-upgrades branch 12 times, most recently from e663cae to bc7b3f0 Compare April 12, 2021 06:46
@njhale njhale marked this pull request as ready for review April 12, 2021 06:46
@openshift-ci-robot openshift-ci-robot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Apr 12, 2021
@njhale njhale force-pushed the openshift/block-upgrades branch 9 times, most recently from 7fe816e to 99531be Compare April 13, 2021 13:42
@njhale njhale force-pushed the openshift/block-upgrades branch from 99531be to 2106b69 Compare April 13, 2021 13:52
*ReconcilerConfig

delayRequeue reconcile.Result
mutate MutateFunc
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
mutate MutateFunc
mutate Mutator

Copy link
Member Author

Choose a reason for hiding this comment

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

done

type skews []skew

func (s skews) String() string {
// TODO: Use a string builder.
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
Member Author

Choose a reason for hiding this comment

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

that works too.

Copy link
Member Author

Choose a reason for hiding this comment

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

done

return nil, err
}

// Take the highest semver if there's more than one max version specified
Copy link
Contributor

Choose a reason for hiding this comment

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

Would it be a safer choice to go with the lowest version?

Copy link
Member Author

Choose a reason for hiding this comment

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

I was going at this from the perspective that folks would always make a conscious decision to add the property, but over several releases may forget to remove older ones.

return nil, err
}

// TODO: Is there a better way to filter (server-side maybe)?
Copy link
Contributor

Choose a reason for hiding this comment

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

There should be an olm.copiedFrom label on copied CSVs. I've had this thought too, and I'm not sure why there are no examples of a CSV label selector referencing it.

Copy link
Member Author

Choose a reason for hiding this comment

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

I added a label selector.

LastTransitionTime: r.Now(),
}

if r.syncTracker.SuccessfulSyncs() > 0 && reflect.DeepEqual(co.Status.Versions, r.TargetVersions) {
Copy link
Contributor

Choose a reason for hiding this comment

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

This seems fine, but do we need to lean on reflection? Since OperandVersion is struct{Name,Version string} it would be a tiny loop.

Copy link
Member Author

Choose a reason for hiding this comment

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

we can do an ElementsMatch type thing easily enough.

Copy link
Member Author

Choose a reason for hiding this comment

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

I went ahead and made this change.

@openshift-ci openshift-ci bot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Apr 15, 2021
njhale added 6 commits April 15, 2021 14:49
- Refactor OpenShift ClusterOperator monitoring for olm-operator
  into an independent controller
- Set the OLM operator's ClusterOperator to upgradeable=false whenever
  incompatible operators, installed by OLM, exist on cluster;
  effectively blocking OpenShift upgrades

Signed-off-by: Nick Hale <[email protected]>
Bump controller-runtime dependency to include a fix for the Channel Source which was preventing events from being enqueued.
(see kubernetes-sigs/controller-runtime#1343)

Signed-off-by: Nick Hale <[email protected]>
@njhale njhale force-pushed the openshift/block-upgrades branch from bea36e4 to 8d0e190 Compare April 15, 2021 19:26
@njhale njhale force-pushed the openshift/block-upgrades branch from 8d0e190 to ecac3be Compare April 15, 2021 19:28
@openshift-ci openshift-ci bot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Apr 15, 2021
Copy link
Member

@exdx exdx left a comment

Choose a reason for hiding this comment

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

one nit
/lgtm
/hold

@openshift-ci-robot openshift-ci-robot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Apr 15, 2021
@openshift-ci-robot openshift-ci-robot added the lgtm Indicates that a PR is ready to be merged. label Apr 15, 2021
@exdx
Copy link
Member

exdx commented Apr 15, 2021

/hold cancel

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.

5 participants