-
Notifications
You must be signed in to change notification settings - Fork 545
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
Introduce protectedCopiedCSVNamespaces flag #2811
Introduce protectedCopiedCSVNamespaces flag #2811
Conversation
Skipping CI for Draft Pull Request. |
4468c64
to
e1dcc94
Compare
/hold Should probably add a test, but I'm not sure how to do that yet given the runtime flag. |
dd29f31
to
67ab31a
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think I'm generally onboard with these changes, although I would prefer an API-based approach (e.g. OLMConfig?) but it's unclear whether that's overkill right now.
Do we need to accompany these changes with a test in some capacity? Do we need any upstream documentation changes here too?
67ab31a
to
2da2b81
Compare
I agree that it would have been nice to introduce this via the OLMConfig resource, but:
I've updated existing tests to account for this feature, but it's only tested if the operator is ran with the protectedCopiedCSVNamespaces flag. |
3020bd9
to
7dc8dca
Compare
/retest |
@awgreene That seems like a legitimate e2e failure? |
@@ -1361,15 +1372,14 @@ func getCopiedCSVsCondition(isDisabled, csvIsRequeued bool) metav1.Condition { | |||
return condition | |||
} | |||
|
|||
condition.Reason = "CopiedCSVsDisabled" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this need to live as a constant? Where are the reasons typically defined, o-f/api?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's probably a good idea, any objections to doing this in a followup PR if I create an issue to track it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just saw this: that's fine with me, but I'd like to see us tackle this sooner than later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This implementation looks good to me so I'm sending over a preemptive lgtm
with the assumption that the E2E tests will get fixed up + Tim's comments.
/lgtm
7dc8dca
to
af91f27
Compare
/hold |
a38ff54
to
9566f98
Compare
@timflannagan this was a legitimate error where namespaces in a terminated state were included in the expected copied CSV count, fixed. |
cd37d67
to
cf0e432
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Couple of non-blocking comments that could be addressed later if it becomes essential.
/lgtm
if numCSVs := len(copiedCSVs.Items); numCSVs != len(protectedCopiedCSVNamespaces) { | ||
return fmt.Errorf("Found %d copied CSVs, should be %d", numCSVs, len(protectedCopiedCSVNamespaces)) | ||
} | ||
|
||
for k := range protectedCopiedCSVNamespaces { | ||
found := false | ||
for _, csv := range copiedCSVs.Items { | ||
if csv.GetNamespace() == k { | ||
found = true | ||
break | ||
} | ||
} | ||
if !found { | ||
return fmt.Errorf("could not find copied CSV in protected namespace %s", k) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not blocking: I think we can refactor this to lean into gomega pattern matchers more, but these changes are just extending the pre-existing logic.
@@ -159,8 +178,8 @@ var _ = Describe("Disabling copied CSVs", func() { | |||
} | |||
|
|||
expectedCondition := metav1.Condition{ | |||
Reason: "NoCopiedCSVsFound", | |||
Message: "Copied CSVs are disabled and none were found for operators installed in AllNamespace mode", | |||
Reason: "CopiedCSVsDisabled", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep, this is why I'd like to see a follow-up that moves this reason to a constant variable that can be shared around.
|
||
func getProtectedCopiedCSVNamespaces(protectedCopiedCSVNamespaces map[string]struct{}) error { | ||
var olmDeployment appsv1.Deployment | ||
if err := ctx.Ctx().Client().Get(context.TODO(), apitypes.NamespacedName{Name: "olm-operator", Namespace: operatorNamespace}, &olmDeployment); err != nil { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit/not blocking: avoid hardcoding the context and namespaced name fields and pass those as parameters to this function instead?
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: awgreene, timflannagan, tylerslaton 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 |
I had a couple of comments, but nothing that was truly blocking. Feel free to remove the hold. |
Problem: Users rely on Copied CSVs in order to understand which operators are available in a given namespace. When installing All Namespace operators, a Copied CSV is created in every namespace which can place a huge performance strain on clusters with many namespaces. OLM introduced the ability to disable Copied CSVs for All Namespace mode operators in an effort to resolve the performance issues on large clusters, unfortunately removing the ability for users to identify which operators are available in a given namespace. Solution: The protectedCopiedCSVNamespaces runtime flag can be used to prevent Copied CSVs from being deleted even when Copied CSVs are disabled. An admin can then provide users with the proper RBAC to view which operators are running in All Namespace mode. Signed-off-by: Alexander Greene <greene.al1991@gmail.com>
cf0e432
to
03f8118
Compare
Nicely done. Feel free to remove the hold. /lgtm |
/unhold |
/retest-required Please review the full test history for this PR and help us cut down flakes. |
Description of the change:
Introduce a runtime flag that prevents OLM from deleting Copied CSVs in a given set of namespaces.
Motivation for the change:
Problem: Users rely on Copied CSVs in order to understand which
operators are available in a given namespace. When installing All
Namespace operators, a Copied CSV is created in every namespace which
can place a huge performance strain on clusters with many namespaces.
OLM introduced the ability to disable Copied CSVs for All Namespace mode
operators in an effort to resolve the performance issues on large clusters,
unfortunately removing the ability for users to identify which operators are
available in a given namespace.
Solution: The protectedCopiedCSVNamespaces runtime flag can be used to
prevent Copied CSVs from being deleted even when Copied CSVs are
disabled. An admin can then provide users with the proper RBAC to view
which operators are running in All Namespace mode.
Architectural changes:
Testing remarks:
Reviewer Checklist
/doc
[FLAKE]
are truly flaky and have an issue