This is an automated email from the ASF dual-hosted git repository.

nferraro pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel-k.git

commit ca0bcad23f0b6f76e3646d6e0e62ebec24348baa
Author: nicolaferraro <[email protected]>
AuthorDate: Fri Apr 9 18:48:20 2021 +0200

    fixed bug that caused creation of double knative revision
---
 pkg/metadata/metadata_http_test.go |  1 +
 pkg/trait/knative_service.go       | 10 ++++++----
 pkg/util/source/inspector.go       |  3 +++
 3 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/pkg/metadata/metadata_http_test.go 
b/pkg/metadata/metadata_http_test.go
index a0ec2bb..3f653ac 100644
--- a/pkg/metadata/metadata_http_test.go
+++ b/pkg/metadata/metadata_http_test.go
@@ -57,6 +57,7 @@ func TestHttpOnlyJavaSource(t *testing.T) {
                        from("direct:bots/cippa").to("log:stash");
                        from("netty-http:uri").to("log:stash");
                        from("seda:path").to("log:stash");
+                       from("kamelet:source").to("log:sink");
                `,
                },
                Language: v1.LanguageJavaSource,
diff --git a/pkg/trait/knative_service.go b/pkg/trait/knative_service.go
index a1e8ac1..9cc77aa 100644
--- a/pkg/trait/knative_service.go
+++ b/pkg/trait/knative_service.go
@@ -102,10 +102,7 @@ func (t *knativeServiceTrait) Configure(e *Environment) 
(bool, error) {
                return false, nil
        }
 
-       if e.IntegrationInPhase(v1.IntegrationPhaseRunning) {
-               condition := 
e.Integration.Status.GetCondition(v1.IntegrationConditionKnativeServiceAvailable)
-               return condition != nil && condition.Status == 
corev1.ConditionTrue, nil
-       } else if !e.InPhase(v1.IntegrationKitPhaseReady, 
v1.IntegrationPhaseDeploying) {
+       if !e.InPhase(v1.IntegrationKitPhaseReady, 
v1.IntegrationPhaseDeploying) && 
!e.IntegrationInPhase(v1.IntegrationPhaseRunning) {
                return false, nil
        }
 
@@ -164,6 +161,11 @@ func (t *knativeServiceTrait) Configure(e *Environment) 
(bool, error) {
                }
        }
 
+       if e.IntegrationInPhase(v1.IntegrationPhaseRunning) {
+               condition := 
e.Integration.Status.GetCondition(v1.IntegrationConditionKnativeServiceAvailable)
+               return condition != nil && condition.Status == 
corev1.ConditionTrue, nil
+       }
+
        return true, nil
 }
 
diff --git a/pkg/util/source/inspector.go b/pkg/util/source/inspector.go
index 746a03a..3933a61 100644
--- a/pkg/util/source/inspector.go
+++ b/pkg/util/source/inspector.go
@@ -324,6 +324,9 @@ func (i *baseInspector) hasOnlyPassiveEndpoints(fromURIs 
[]string) bool {
 
 func (i *baseInspector) containsOnlyURIsIn(fromURI []string, allowed 
map[string]bool) bool {
        for _, uri := range fromURI {
+               if uri == "kamelet:source" {
+                       continue
+               }
                prefix := i.getURIPrefix(uri)
                if enabled, ok := allowed[prefix]; !ok || !enabled {
                        return false

Reply via email to