-
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
fix(installmodes): update support logic to match expected behavior #733
fix(installmodes): update support logic to match expected behavior #733
Conversation
- Add installmode support e2e test - Remove old version of supports logic
/hold Need to verify |
/retest |
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.
/approve
/lgtm
/hold cancel |
/retest |
/hold |
@@ -346,6 +346,22 @@ func (a *Operator) handleClusterServiceVersionDeletion(obj interface{}) { | |||
defer func(csv v1alpha1.ClusterServiceVersion) { | |||
logger.Debug("removing csv from queue set") | |||
a.csvQueueSet.Remove(csv.GetName(), csv.GetNamespace()) | |||
|
|||
// Requeue all OperatorGroups in the 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.
While I was working on this, I decided to make OperatorGroup requeuing on CSV deletion more robust.
- OperatorGroup sync bails out after successful namespace update detected - Check CSV status before re-transitioning to failed states due to OperatorGroup issues - Check CSV annotations before setting OperatorGroup annotations - Make OperatorGroup requeuing more aggressive on CSV deletion - Requeue OperatorGroup in OperatorGroup sync if CSV update fails and CSV still exists
// No target annotation | ||
if !ok { | ||
logger.Info("no olm.targetNamespaces annotation") | ||
return 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.
Before adding the return, we would always associate a missing olm.targetNamespaces
annotation with NamespaceAll
.
if err != nil { | ||
logger.Error("error adding operatorgroup annotation") | ||
syncError = err | ||
if a.operatorGroupAnnotationsDiffer(&out.ObjectMeta, operatorGroup) { |
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.
Check for differences before updating the annotations.
logger.Warn(syncError.Error()) | ||
out.SetPhaseWithEvent(v1alpha1.CSVPhaseFailed, v1alpha1.CSVReasonTooManyOperatorGroups, syncError.Error(), now, a.recorder) | ||
logger.WithError(syncError).Warn("csv failed to become an operatorgroup member") | ||
if out.Status.Reason != v1alpha1.CSVReasonTooManyOperatorGroups { |
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.
Wrap set phase with status check to prevent unnecessary updates.
@@ -3576,6 +3576,10 @@ func TestSyncOperatorGroups(t *testing.T) { | |||
} | |||
} | |||
|
|||
// Sync again to catch provided API changes | |||
err = op.syncOperatorGroups(tt.initial.operatorGroup) |
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.
Needed because OperatorGroup sync returns after each meaningful update and relies on the update event to trigger another sync.
} | ||
|
||
// CSV requeue is handled by the succeeding sync | ||
return 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.
The status update will trigger another sync - no need to continue.
if csv.IsCopied() { | ||
logger.Debug("csv is copied. not including in operatorgroup's provided api set") | ||
logger.Debug("csv is copied. not updating annotations or including in operatorgroup's provided api set") |
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.
Moved to also ignore annotation checks for copied CSVs.
metav1.SetMetaDataAnnotation(obj, v1alpha2.OperatorGroupNamespaceAnnotationKey, op.GetNamespace()) | ||
metav1.SetMetaDataAnnotation(obj, v1alpha2.OperatorGroupAnnotationKey, op.GetName()) | ||
if addTargets { | ||
|
||
if addTargets && op.Status.Namespaces != 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.
Guard against empty namespace list being evaluated as NamespaceAll
.
/hold cancel |
metav1.SetMetaDataAnnotation(obj, v1alpha2.OperatorGroupTargetsAnnotationKey, strings.Join(op.Status.Namespaces, ",")) | ||
} | ||
} | ||
|
||
func (a *Operator) operatorGroupAnnotationsDiffer(obj *metav1.ObjectMeta, op *v1alpha2.OperatorGroup) bool { |
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.
👍
/test all |
/retest |
/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 |
fix(installmodes): update support logic to match expected behavior
Change InstallMode behavior to match desired:
OwnNamespace
: If supported, the operator can be a member of anOperatorGroup
that selects its own namespaceSingleNamespace
: If supported, the operator can be a member of anOperatorGroup
that selects one namespaceMultiNamespace
: If supported, the operator can be a member of anOperatorGroup
that selects more than one namespaceAllNamespaces
: If supported, the operator can be a member of anOperatorGroup
that selects all namespaces (target namespace set is the empty string "")Addresses ALM-927.