-
Notifications
You must be signed in to change notification settings - Fork 546
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
OperatorGroup expansion/contraction #736
OperatorGroup expansion/contraction #736
Conversation
3bfff0a
to
10dc2c2
Compare
/retest |
1 similar comment
/retest |
/test unit |
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 found some things that may cause problems. I also found some things that we may want to look at in follow up PRs. Here are my thoughts:
|
||
t.Log("Waiting to ensure copied CSV shows up in other namespace") | ||
err = wait.Poll(pollInterval, pollDuration, func() (bool, error) { |
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.
You can use awaitCSV(...)
which will wait until the CSV exists and then apply the given status checker func.
|
||
// verify created CSV is cleaned up after operator group is "contracted" | ||
t.Log("Modifying operator group to no longer watch all namespaces") |
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 wonder if we should just generate a new OperatorGroup
for this test so we avoid modifications to the initial setup.
@@ -3578,7 +3578,7 @@ func TestSyncOperatorGroups(t *testing.T) { | |||
|
|||
operatorGroup, err := op.GetClient().OperatorsV1alpha2().OperatorGroups(tt.initial.operatorGroup.GetNamespace()).Get(tt.initial.operatorGroup.GetName(), metav1.GetOptions{}) | |||
require.NoError(t, err) | |||
assert.Equal(t, tt.expectedStatus, operatorGroup.Status) | |||
assert.EqualValues(t, tt.expectedStatus, operatorGroup.Status) |
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 know this is annoying to fix, but doesn't this mask the difference between "" vs 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.
Doesn't look like it? https://github.com/stretchr/testify/blob/master/assert/assertions.go#L78:6
/retest |
2 similar comments
/retest |
/retest |
/test unit |
|
||
errlist := []error{} | ||
for _, csv := range fetchedCSVs { | ||
if csv.IsCopied() && csv.GetAnnotations()[v1alpha2.OperatorGroupAnnotationKey] == operatorGroupName { |
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 for the sake of completeness we should check the olm.operatorNamespace
annotation as well.
/retest |
883f402
to
be33ddf
Compare
can output an allnamespace operatorgroup
This adds requeuing for both the namespace and operator group sync loops, which fixes syncing issues after initial CSVs have been copied.
After switching to owner labels for cross-namespace ownerrefs, we didn't update this requeueing logic, causing some delays for reconciliation of those objects.
this adds annotations to all csvs in an operator group, and copies them to target namespaces.
makes use of more of the new namespaceset utilities from the resolver also doesn't bother precomputing the namespaces to add/prune. instead it gets all namespaces and adjusts each as needed, visiting each once.
We were treating CSVs that had empty phases as "copyable", but that happens before the checks to see if operatorgroups conflict. This was causing a race where CSVs could be copied to target namespaces incorrectly
are available this avoids some unnecessary resyncing
expansion/contraction
2a6bd65
to
121243a
Compare
@@ -1255,3 +1321,51 @@ func (a *Operator) cleanupCSVDeployments(logger *logrus.Entry, csv *v1alpha1.Clu | |||
} | |||
} | |||
} | |||
|
|||
func (a *Operator) ensureDeploymentAnnotations(logger *logrus.Entry, csv *v1alpha1.ClusterServiceVersion) error { |
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.
Added this while looking into why copying was failing - small optimization that skips the walk through Failed if the annotations change in an operatorgroup.
@@ -2067,6 +2085,51 @@ func TestTransitionCSV(t *testing.T) { | |||
}, | |||
}, | |||
}, | |||
{ | |||
name: "SingleCSVSucceededToSucceeded/OperatorGroupChanged", |
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.
Verifying we don't have to transition to failed to update the operatorgroup
} | ||
} | ||
|
||
// requeue csvs in original namespaces or in new target namespaces (to capture removed/added namespaces) |
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 ended up being the reason contraction wasn't working after the rebase. somewhere in reconciling those commits we lost the code that requeues CSVs from the old set of namespaces, which is important to make sure we pick up CSVs that need to be cleaned up when an operatorgroup is contracted.
Added some abstractions around namespacesets to help make this clearer
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.
Isn't this effectively done around line 110?
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.
Line 110 doesn't capture the "contraction" case, right?
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.
If you remove the the "not copied" predicate in getAllCSVsThatProvide(...)
, then I think it would since that returns the set of CSVs across all namespaces that provide the given APIs. As I recall, the input it's given in syncOperatorGroup
represents the union of APIs in the providedAPIs
annotation and the CSVs in the OperatorGroup
's namespace.
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.
/lgtm
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: ecordell, 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 |
This takes the commits from #675, and rebases them one at a time to get them working with newer changes to OperatorGroups.
I'd like to double check / write a test for any possible edge cases here. The one that comes to mind is: the same CSV supports AllNamespaces and SingleNamespace, and we accidentally overwrite a "real" CSV with a "copied" CSV. It may be better to go ahead with these and follow up with that test case / fix, though, given that this is blocking.