From ca0bcad23f0b6f76e3646d6e0e62ebec24348baa Mon Sep 17 00:00:00 2001 From: nicolaferraro Date: Fri, 9 Apr 2021 18:48:20 +0200 Subject: [PATCH] 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 a0ec2bbc7f..3f653acdfd 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 a1e8ac19aa..9cc77aaf65 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 746a03af14..3933a6182a 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