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/09/06 08:45:16 UTC

[camel-k] branch master updated: fix(knative): Favor cluster-local over public URL to address endpoints

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 fda8f34  fix(knative): Favor cluster-local over public URL to address endpoints
fda8f34 is described below

commit fda8f343c2e12ad60900546ad7564c3b54701b4b
Author: Antonin Stefanutti <an...@stefanutti.fr>
AuthorDate: Thu Sep 5 14:37:54 2019 +0200

    fix(knative): Favor cluster-local over public URL to address endpoints
---
 pkg/trait/knative.go | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/pkg/trait/knative.go b/pkg/trait/knative.go
index f1d84db..619cb32 100644
--- a/pkg/trait/knative.go
+++ b/pkg/trait/knative.go
@@ -292,14 +292,14 @@ func (t *knativeTrait) extractNames(names string) []string {
 
 // buildServiceDefinitionFromStatus creates a CamelServiceDefinition from a Knative ServiceStatus
 func buildServiceDefinitionFromStatus(name string, serviceType knativeapi.CamelServiceType, status serving.ServiceStatus) (knativeapi.CamelServiceDefinition, error) {
-	// build it using the Route URL information if available
-	if status.URL != nil && status.URL.Host != "" {
-		return knativeapi.BuildCamelServiceDefinition(name, serviceType, url.URL(*status.URL))
-	}
-	// fallback to using the addressable
+	// use cluster-local URL from the addressable
 	if status.Address != nil {
 		return buildServiceDefinition(name, serviceType, *status.Address)
 	}
+	// fallback to using the public URL information if available
+	if status.URL != nil && status.URL.Host != "" {
+		return knativeapi.BuildCamelServiceDefinition(name, serviceType, url.URL(*status.URL))
+	}
 	return knativeapi.CamelServiceDefinition{}, errors.New("cannot determine service hostname")
 }