astefanutti commented on a change in pull request #631: Use non-caching client
in builds scheduling critical section
URL: https://github.com/apache/camel-k/pull/631#discussion_r277129051
##########
File path: pkg/controller/build/build_controller.go
##########
@@ -30,16 +31,33 @@ func Add(mgr manager.Manager) error {
if err != nil {
return err
}
- return add(mgr, newReconciler(mgr, c))
+ reconciler, err := newReconciler(mgr, c)
+ if err != nil {
+ return err
+ }
+ return add(mgr, reconciler)
}
// newReconciler returns a new reconcile.Reconciler
-func newReconciler(mgr manager.Manager, c client.Client) reconcile.Reconciler {
+func newReconciler(mgr manager.Manager, c client.Client)
(reconcile.Reconciler, error) {
+ // Non-caching client to be used whenever caching may cause race
conditions,
+ // like in the builds scheduling critical section.
+ // To be replaced with Manager.GetAPIReader() as soon as it's
available, see:
+ // https://github.com/kubernetes-sigs/controller-runtime/pull/327
Review comment:
That's a good idea. I've just re-pushed it with a `TODO`.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services