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

Allow users to toggle off csv copying for AllNamespace mode operators #2466

Merged

Conversation

awgreene
Copy link
Member

No description provided.

@openshift-ci
Copy link

openshift-ci bot commented Nov 19, 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 do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Nov 19, 2021
@openshift-ci openshift-ci bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Nov 19, 2021
Copy link
Contributor

@tylerslaton tylerslaton left a comment

Choose a reason for hiding this comment

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

Looks great! Just a couple of nits.

@timflannagan timflannagan changed the title WIP: Allow users to toggel off csv copying for cluster scoped operators WIP: Allow users to toggle off csv copying for cluster scoped operators Nov 29, 2021
@awgreene
Copy link
Member Author

Relies on operator-framework/api#198

condition.Message = "At least one CSV had an unexpected number of copied CSVs"
condition.Status = metav1.ConditionFalse
defer func() {
a.olmConfigQueue.AddAfter(olmConfig, time.Second*5)
Copy link
Member Author

@awgreene awgreene Nov 30, 2021

Choose a reason for hiding this comment

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

The AddRateLimited option was not correctly incrementing the number of failures and would spam the API server. Planning to look at this tomorrow.

Copy link
Member Author

Choose a reason for hiding this comment

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

Could also be done by triggering a watch on copied csvs.

Copy link
Member

Choose a reason for hiding this comment

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

We need a watch/sync on copied CSVs if, for some reason, a copied csv gets created after the feature has been disabled; an edge case that might happen on upgrade or due to a bad actor (e.g. me).

Copy link
Member Author

@awgreene awgreene Dec 13, 2021

Choose a reason for hiding this comment

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

or due to a bad actor (e.g. me).

I don't know why your stage performance should influence this PR, but I agree that this controller should watch/sync on copied csvs ;)

@openshift-ci openshift-ci bot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Dec 1, 2021
@openshift-ci openshift-ci bot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Dec 1, 2021
conditions:
type: array
items:
description: "Condition contains details for one aspect of the current state of this API Resource. --- This struct is intended for direct use as an array at the field path .status.conditions. For example, type FooStatus struct{ // Represents the observations of a foo's current state. // Known .status.conditions.type are: \"Available\", \"Progressing\", and \"Degraded\" // +patchMergeKey=type // +patchStrategy=merge // +listType=map // +listMapKey=type Conditions []metav1.Condition `json:\"conditions,omitempty\" patchStrategy:\"merge\" patchMergeKey:\"type\" protobuf:\"bytes,1,rep,name=conditions\"` \n // other fields }"
Copy link
Member

Choose a reason for hiding this comment

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

Looks like the boilerplate description made it through code review. Let's override the Foo example when we get the chance.

Copy link
Member Author

Choose a reason for hiding this comment

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

Is there a way to override the description of a structure not owned by your package?

condition.Message = "At least one CSV had an unexpected number of copied CSVs"
condition.Status = metav1.ConditionFalse
defer func() {
a.olmConfigQueue.AddAfter(olmConfig, time.Second*5)
Copy link
Member

Choose a reason for hiding this comment

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

We need a watch/sync on copied CSVs if, for some reason, a copied csv gets created after the feature has been disabled; an edge case that might happen on upgrade or due to a bad actor (e.g. me).

@awgreene awgreene force-pushed the copied-csv-toggle branch 2 times, most recently from 2fa650f to 6192ee0 Compare December 14, 2021 18:17
@awgreene awgreene changed the title Allow users to toggle off csv copying for cluster scoped operators Allow users to toggle off csv copying for AllNamespace mode operators Dec 14, 2021
Copy link
Member

@njhale njhale left a comment

Choose a reason for hiding this comment

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

/lgtm


olmConfig.Spec = operatorsv1.OLMConfigSpec{
Features: &operatorsv1.Features{
DisableCopiedCSVs: getPointer(true),
Copy link
Member

Choose a reason for hiding this comment

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

If the number of occurrences is few, you could also invoke an anonymous function:

DisableCopiedCSVs: func() *bool {
    b := true
    return &b
}(),

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

openshift-ci bot commented Dec 14, 2021

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: awgreene, 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 openshift-ci bot removed the lgtm Indicates that a PR is ready to be merged. label Dec 14, 2021
@awgreene awgreene force-pushed the copied-csv-toggle branch 3 times, most recently from 1cf4355 to f7876cf Compare December 14, 2021 19:29
@tylerslaton
Copy link
Contributor

/lgtm

@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label Dec 14, 2021
@openshift-ci openshift-ci bot removed the lgtm Indicates that a PR is ready to be merged. label Dec 14, 2021
@tylerslaton
Copy link
Contributor

/lgtm

@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label Dec 14, 2021
@openshift-ci openshift-ci bot removed the lgtm Indicates that a PR is ready to be merged. label Dec 14, 2021
This commit introduces a controller for the olmConfig CRD.
The olmConfig CRD will be used to configure olm's behavior
on cluster. As of today, this CRD introduces the ability
for customer to disable copied csvs for operators installed
in allNamespace mode. When copied csv are disabled, an event
will be created in the operators namespace signaling that
it has no copied csvs and that users on the cluster may
have difficulty identifying which operators are available
in a given namespace.

Signed-off-by: Alexander Greene <[email protected]>
@tylerslaton
Copy link
Contributor

/lgtm

@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label Dec 14, 2021
@openshift-merge-robot openshift-merge-robot merged commit 52f368d into operator-framework:master Dec 14, 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.

7 participants