Knative Service Trait

The Knative Service trait allows configuring options when running the Integration as a Knative service, instead of a standard Kubernetes Deployment.

Running an Integration as a Knative Service enables auto-scaling (and scaling-to-zero), but those features are only relevant when the Camel route(s) use(s) an HTTP endpoint consumer.

This trait is available in the following profiles: Knative.

Configuration

Trait properties can be specified when running any integration with the CLI:

$ kamel run --trait knative-service.[key]=[value] --trait knative-service.[key2]=[value2] integration.groovy

The following configuration options are available:

Property Type Description

knative-service.enabled

bool

Can be used to enable or disable a trait. All traits share this common property.

knative-service.annotations

map[string]string

The annotations added to route. This can be used to set knative service specific annotations CLI usage example: -t "knative-service.annotations.'haproxy.router.openshift.io/balance'=true"

knative-service.autoscaling-class

string

Configures the Knative autoscaling class property (e.g. to set hpa.autoscaling.knative.dev or kpa.autoscaling.knative.dev autoscaling).

Refer to the Knative documentation for more information.

knative-service.autoscaling-metric

string

Configures the Knative autoscaling metric property (e.g. to set concurrency based or cpu based autoscaling).

Refer to the Knative documentation for more information.

knative-service.autoscaling-target

int

Sets the allowed concurrency level or CPU percentage (depending on the autoscaling metric) for each Pod.

Refer to the Knative documentation for more information.

knative-service.min-scale

int

The minimum number of Pods that should be running at any time for the integration. It’s zero by default, meaning that the integration is scaled down to zero when not used for a configured amount of time.

Refer to the Knative documentation for more information.

knative-service.max-scale

int

An upper bound for the number of Pods that can be running in parallel for the integration. Knative has its own cap value that depends on the installation.

Refer to the Knative documentation for more information.

knative-service.rollout-duration

string

Enables to gradually shift traffic to the latest Revision and sets the rollout duration. It’s disabled by default and must be expressed as a Golang time.Duration string representation, rounded to a second precision.

knative-service.visibility

string

Setting cluster-local, Knative service becomes a private service. Specifically, this option applies the networking.knative.dev/visibility label to Knative service.

Refer to the Knative documentation for more information.

knative-service.auto

bool

Automatically deploy the integration as Knative service when all conditions hold:

  • Integration is using the Knative profile

  • All routes are either starting from an HTTP based consumer or a passive consumer (e.g. direct is a passive consumer)