Skip to content

Commit

Permalink
fixed bug that caused creation of double knative revision
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolaferraro committed Apr 12, 2021
1 parent b3c5909 commit ca0bcad
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
1 change: 1 addition & 0 deletions pkg/metadata/metadata_http_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
10 changes: 6 additions & 4 deletions pkg/trait/knative_service.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down Expand Up @@ -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
}

Expand Down
3 changes: 3 additions & 0 deletions pkg/util/source/inspector.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit ca0bcad

Please sign in to comment.