-
Notifications
You must be signed in to change notification settings - Fork 1.4k
🐛 WIP: Stop cluster/topology reconciliation on Status changes #5956
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
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 |
---|---|---|
|
@@ -30,6 +30,7 @@ import ( | |
"sigs.k8s.io/controller-runtime/pkg/client" | ||
"sigs.k8s.io/controller-runtime/pkg/controller" | ||
"sigs.k8s.io/controller-runtime/pkg/handler" | ||
ctrlpredicates "sigs.k8s.io/controller-runtime/pkg/predicate" | ||
"sigs.k8s.io/controller-runtime/pkg/source" | ||
|
||
clusterv1 "sigs.k8s.io/cluster-api/api/v1beta1" | ||
|
@@ -77,6 +78,8 @@ func (r *Reconciler) SetupWithManager(ctx context.Context, mgr ctrl.Manager, opt | |
For(&clusterv1.Cluster{}, builder.WithPredicates( | ||
// Only reconcile Cluster with topology. | ||
predicates.ClusterHasTopology(ctrl.LoggerFrom(ctx)), | ||
// Only reconcile on Cluster Generation change to avoid reconciling on Status updates. | ||
ctrlpredicates.GenerationChangedPredicate{}, | ||
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. Change looks reasonable to me. As far as I'm aware there is no case where we want to reconcile the topology when the status changes. I think it would be the far more generic solution to the problem, as we then don't have to make sure that every error we propagate into the conditions (which is afaik all of them) is constant with each failed reconcile. |
||
)). | ||
Named("topology/cluster"). | ||
Watches( | ||
|
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: I wonder if we should use
crpredicates
instead. I sawcr
as prefix in other providers as prefix for controller-runtime and I think it's more intuitive and reads better.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.
Whatever suits - I picked ctrl because it's used to import controller runtime itself in other parts of the code, and ctrl client is used in places. We should try to keep the usage consistent if we can.
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.
Yup agree. If nobody else has an opinion on that, let's just leave it as is.
I think currently this would affect: