You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by as...@apache.org on 2019/10/10 12:44:07 UTC
[camel-k] branch master updated: perf: Enqueue ReplicaSet updates
only when replicas changed
This is an automated email from the ASF dual-hosted git repository.
astefanutti pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel-k.git
The following commit(s) were added to refs/heads/master by this push:
new 45b6052 perf: Enqueue ReplicaSet updates only when replicas changed
45b6052 is described below
commit 45b605227f606570b222717d660a9f36bdfb4355
Author: Antonin Stefanutti <an...@stefanutti.fr>
AuthorDate: Thu Oct 10 10:20:10 2019 +0200
perf: Enqueue ReplicaSet updates only when replicas changed
---
pkg/controller/integration/integration_controller.go | 13 ++++++++++++-
1 file changed, 12 insertions(+), 1 deletion(-)
diff --git a/pkg/controller/integration/integration_controller.go b/pkg/controller/integration/integration_controller.go
index 33ecdb2..d56f455 100644
--- a/pkg/controller/integration/integration_controller.go
+++ b/pkg/controller/integration/integration_controller.go
@@ -164,7 +164,10 @@ func add(mgr manager.Manager, r reconcile.Reconciler) error {
return err
}
- // Watch for ReplicaSet to reconcile replicas to the integration status
+ // Watch for ReplicaSet to reconcile replicas to the integration status. We cannot use
+ // the EnqueueRequestForOwner handler as the owner depends on the deployment strategy,
+ // either regular deployment or Knative service. In any case, the integration is not the
+ // direct owner of the ReplicaSet.
err = c.Watch(&source.Kind{Type: &appsv1.ReplicaSet{}}, &handler.EnqueueRequestsFromMapFunc{
ToRequests: handler.ToRequestsFunc(func(a handler.MapObject) []reconcile.Request {
rs := a.Object.(*appsv1.ReplicaSet)
@@ -183,6 +186,14 @@ func add(mgr manager.Manager, r reconcile.Reconciler) error {
return requests
}),
+ }, predicate.Funcs{
+ UpdateFunc: func(e event.UpdateEvent) bool {
+ oldReplicaSet := e.ObjectOld.(*appsv1.ReplicaSet)
+ newReplicaSet := e.ObjectNew.(*appsv1.ReplicaSet)
+ // Ignore updates to the ReplicaSet other than the replicas ones,
+ // that are used to reconcile the integration replicas.
+ return oldReplicaSet.Status.Replicas != newReplicaSet.Status.Replicas
+ },
})
if err != nil {
return err