blob: 5e638a2613437f402fb17ff2017d258b5cb23077 [file] [log] [blame]
[[traits]]
= Traits
Traits are high level named features of Camel K that can be enabled/disabled or configured to customize the
behavior of the final integration.
Camel K provide sensible defaults for all such traits, taking into account the details of the target platform where
the integration is going to run into. However, it's possible for a **expert user** to configure them in
order to obtain a different behavior.
== Configuration
Each trait has a unique ID that can be used to configure it using the command line tool.
E.g. in order to disable the creation of a Service for a integration, a user can execute:
```
kamel run --trait service.enabled=false file.groovy
```
The flag `--trait` can be also abbreviated with `-t`.
The `enabled` property is available on all traits and can be used to enable/disable them. All traits have their own
internal logic to determine if they need to be enabled when the user does not activate them explicitly.
All traits share also a `auto` property that can be used to enable/disable auto-configuration of the trait based on the
environment. The auto-configuration mechanism is able to enable/disable the trait when the `enabled` property is not explicitly
set by the user and also change the trait configuration. The `auto` property is enabled by default.
NOTE: Some traits are applicable only to specific platforms (see "profiles" in the table).
A trait may have additional properties that can be configured by the end user.
E.g. the following command configures the container `port` that should be exposed by the service:
```
kamel run --trait service.enabled=true --trait service.port=8081 file.groovy
```
Or the equivalent command (assuming that the service trait is enabled by auto-detection):
```
kamel run -t service.port=8081 file.groovy
```
NOTE: Enabling a trait does not force the trait to be activated, especially if the trait specific preconditions do not hold.
E.g. enabling the `route` trait while the `service` trait is disabled does not produce automatically a route, since a service is needed
for the `route` trait to work.
== Common Traits
The following is a list of common traits that can be configured by the end users:
[options="header",cols="1m,2,3a"]
|=======================
| Trait | Profiles | Description
| dependencies
| Kubernetes, OpenShift
| Automatically adds dependencies required by the Camel routes by inspecting the user code.
+
+
It's enabled by default.
| deployment
| Kubernetes, OpenShift
| Creates a standard Kubernetes deployment for running the integration.
+
+
It's enabled by default on vanilla Kubernetes/Openshift profiles.
| knative
| Knative (Kubernetes, Openshift)
| Creates Knative resources to run the integration instead of the standard Kubernetes resources.
+
+
It's enabled by default when the Knative profile is active.
[cols="m,"]
!===
! knative.sources
! Configures a (comma-separated) list of channels to which the Knative service must be subscribed (to receive cloudevents from a channel).
!===
| istio
| Knative (Kubernetes, Openshift)
| Allows to configure outbound traffic for Istio.
+
+
It's enabled by default when the Knative profile is active.
[cols="m,"]
!===
! istio.allow
! Configures a (comma-separated) list of CIDR subnets that should not be intercepted by the Istio proxy (`10.0.0.0/8,172.16.0.0/12,192.168.0.0/16` by default).
!===
| service
| All (Knative in deployment mode)
| Exposes the integration with a Service resource so that it can be accessed by other applications (or integrations) in the same namespace.
+
+
It's enabled by default if the integration depends on a Camel component that can expose a HTTP endpoint.
[cols="m,"]
!===
! service.port
! To configure a different port exposed by the container (default `8080`).
!===
| route
| OpenShift
| Exposes the service associated with the integration to the outside world with a OpenShift Route.
+
+
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.
+
+
It's enabled by default whenever a Service is added to the integration (through the `service` trait).
[cols="m,"]
!===
! ingress.host
! **Required**. To configure the host exposed by the ingress.
!===
| debug
| All
| Run the integration in debug mode (you can port-forward to port 5005 to connect)
+
+
It's disabled by default.
|=======================
== Platform Traits (Advanced)
There are also platform traits that **normally should not be configured** by the end user. So change them **only if you know what you're doing**.
[options="header",cols="m,,"]
|=======================
| Trait | Profiles | Description
| owner | Kubernetes, OpenShift | Makes sure that every resource created by the traits belongs to the integration custom resource (so they are deleted when the integration is deleted).
|=======================