You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by lb...@apache.org on 2018/11/05 19:46:34 UTC

[camel-k] 05/06: Add host property to the route trait

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

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

commit c028e802db4ccddefede46afa25b21aed91f63cb
Author: nferraro <ni...@gmail.com>
AuthorDate: Mon Nov 5 15:39:19 2018 +0100

    Add host property to the route trait
---
 deploy/operator-role-openshift.yaml | 8 ++++++++
 deploy/resources.go                 | 8 ++++++++
 docs/traits.adoc                    | 8 ++++++++
 pkg/trait/route.go                  | 4 +++-
 4 files changed, 27 insertions(+), 1 deletion(-)

diff --git a/deploy/operator-role-openshift.yaml b/deploy/operator-role-openshift.yaml
index 788a7cc..41a5f72 100644
--- a/deploy/operator-role-openshift.yaml
+++ b/deploy/operator-role-openshift.yaml
@@ -119,3 +119,11 @@ rules:
   - patch
   - update
   - watch
+- apiGroups:
+  - ""
+  - route.openshift.io
+  resources:
+  - routes/custom-host
+  verbs:
+  - create
+
diff --git a/deploy/resources.go b/deploy/resources.go
index 4fcbce0..b3e753e 100644
--- a/deploy/resources.go
+++ b/deploy/resources.go
@@ -2511,6 +2511,14 @@ rules:
   - patch
   - update
   - watch
+- apiGroups:
+  - ""
+  - route.openshift.io
+  resources:
+  - routes/custom-host
+  verbs:
+  - create
+
 
 `
 	Resources["operator-service-account.yaml"] =
diff --git a/docs/traits.adoc b/docs/traits.adoc
index c25e533..ff2ec93 100644
--- a/docs/traits.adoc
+++ b/docs/traits.adoc
@@ -77,6 +77,14 @@ The following is a list of common traits that can be configured by the end users
   +
   It's enabled by default whenever a Service is added to the integration (through the `service` trait).
 
+[cols="m,"]
+!===
+
+! route.host
+! To configure the host exposed by the route.
+
+!===
+
 | ingress
 | Kubernetes
 | Exposes the service associated with the integration to the outside world with a Kubernetes Ingress.
diff --git a/pkg/trait/route.go b/pkg/trait/route.go
index b3efa1a..02299b1 100644
--- a/pkg/trait/route.go
+++ b/pkg/trait/route.go
@@ -28,6 +28,7 @@ import (
 
 type routeTrait struct {
 	BaseTrait `property:",squash"`
+	Host      string `property:"host"`
 }
 
 func newRouteTrait() *routeTrait {
@@ -65,7 +66,7 @@ func (*routeTrait) getTargetService(e *environment, resources *kubernetes.Collec
 	return
 }
 
-func (*routeTrait) getRouteFor(e *environment, service *corev1.Service) *routev1.Route {
+func (e *routeTrait) getRouteFor(env *environment, service *corev1.Service) *routev1.Route {
 	route := routev1.Route{
 		TypeMeta: metav1.TypeMeta{
 			Kind:       "Route",
@@ -83,6 +84,7 @@ func (*routeTrait) getRouteFor(e *environment, service *corev1.Service) *routev1
 				Kind: "Service",
 				Name: service.Name,
 			},
+			Host: e.Host,
 		},
 	}
 	return &route