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

commit a35f5d1d877cb9a69c4ed50193914acf357d99bd
Author: Antonin Stefanutti <[email protected]>
AuthorDate: Tue Jun 2 15:23:58 2020 +0200

    chore: Group integration readiness condition with replicas reconciliation 
logic
---
 pkg/controller/integration/monitor.go | 4 ++++
 pkg/trait/deployer.go                 | 6 ------
 pkg/trait/deployer_test.go            | 2 +-
 3 files changed, 5 insertions(+), 7 deletions(-)

diff --git a/pkg/controller/integration/monitor.go 
b/pkg/controller/integration/monitor.go
index 344c694..4cea23e 100644
--- a/pkg/controller/integration/monitor.go
+++ b/pkg/controller/integration/monitor.go
@@ -27,6 +27,7 @@ import (
        "github.com/apache/camel-k/pkg/trait"
        "github.com/apache/camel-k/pkg/util/defaults"
        "github.com/apache/camel-k/pkg/util/digest"
+       "github.com/apache/camel-k/pkg/util/kubernetes"
 )
 
 // NewMonitorAction creates a new monitoring action for an integration
@@ -91,6 +92,9 @@ func (action *monitorAction) Handle(ctx context.Context, 
integration *v1.Integra
                }
        }
 
+       // Mirror ready condition from the sub resource (e.g.ReplicaSet, 
Deployment, CronJob, ...) to the integration
+       kubernetes.MirrorReadyCondition(ctx, action.client, integration)
+
        return integration, nil
 }
 
diff --git a/pkg/trait/deployer.go b/pkg/trait/deployer.go
index da55a7e..8368110 100644
--- a/pkg/trait/deployer.go
+++ b/pkg/trait/deployer.go
@@ -110,12 +110,6 @@ func (t *deployerTrait) Apply(e *Environment) error {
                        }
                        return nil
                })
-
-               // Mirror ready condition from the sub resource to the 
integration
-               e.PostActions = append(e.PostActions, func(e *Environment) 
error {
-                       kubernetes.MirrorReadyCondition(t.Ctx, t.Client, 
e.Integration)
-                       return nil
-               })
        }
 
        return nil
diff --git a/pkg/trait/deployer_test.go b/pkg/trait/deployer_test.go
index 7160f55..d5ffb97 100644
--- a/pkg/trait/deployer_test.go
+++ b/pkg/trait/deployer_test.go
@@ -52,7 +52,7 @@ func TestApplyDeployerTraitDoesSucceed(t *testing.T) {
        err := deployerTrait.Apply(environment)
 
        assert.Nil(t, err)
-       assert.Len(t, environment.PostActions, 2)
+       assert.Len(t, environment.PostActions, 1)
 }
 
 func TestApplyDeployerTraitInInitializationPhaseDoesSucceed(t *testing.T) {

Reply via email to