-
Notifications
You must be signed in to change notification settings - Fork 58
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
controllers: Ensure console plugin creation after CSV verification #511
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -32,6 +32,7 @@ import ( | |
"sigs.k8s.io/controller-runtime/pkg/event" | ||
"sigs.k8s.io/controller-runtime/pkg/handler" | ||
"sigs.k8s.io/controller-runtime/pkg/log" | ||
"sigs.k8s.io/controller-runtime/pkg/manager" | ||
"sigs.k8s.io/controller-runtime/pkg/predicate" | ||
"sigs.k8s.io/controller-runtime/pkg/reconcile" | ||
|
||
|
@@ -290,6 +291,14 @@ func (r *SubscriptionReconciler) SetupWithManager(mgr ctrl.Manager) error { | |
}, | ||
) | ||
|
||
err := mgr.Add(manager.RunnableFunc(func(ctx context.Context) error { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. may I know what's the expectation w/ runnablefunc? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This will invoke the function as soon as the manager starts. It means it will create this sub even before reconciles are started. |
||
odfDepsSub := GetStorageClusterSubscriptions()[0] | ||
return EnsureDesiredSubscription(r.Client, odfDepsSub) | ||
})) | ||
if err != nil { | ||
return err | ||
} | ||
|
||
return ctrl.NewControllerManagedBy(mgr). | ||
For(&operatorv1alpha1.Subscription{}, | ||
builder.WithPredicates(generationChangedPredicate, subscriptionPredicate)). | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. pls recheck if exporting all methods is not necessary. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done |
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 a general comment/doubt (no need to change the current implementation):
this controller will only run when either OCP is upgraded (i.e., For(&configv1.ClusterVersion{})) or when controller will restart after ODF is upgraded (in which case new CSVs will be existing soon)... we don't really need
!util.AreMultipleOdfOperatorCsvsPresent(csvList)
check, right ?? or am I missing any case ??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 check is to make sure that we don't block the reconcile in case of upgrades. For example assume customers has messed up the catalog for some reason in that case only odf will be upgraded and other operators wont be upgraded. So we should not block the console updation in that 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.
make sense.
If ODF is upgraded and others won't, then we are still blocked right ?? because
!util.AreMultipleOdfOperatorCsvsPresent(csvList)
will betrue
in that case.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.
Yes, that's right, It will skip if and only if the odf-operator upgrade is in progress.
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.
actually that was my initial doubt, why would this controller run at all when ODF upgrade is in progress: #511 (comment)
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.
Once the manager is started, The controllers will also get triggered.
I have added this check to keep the behavior as before and that is once the odf-operator is upgraded, I also upgrade the console plugin.