[[fine-tuning]]
= Camel K Operator fine tuning

Camel K Operators offers several possibility of customization. The default installation could be good in the most of the cases, but, we have a series of configuration that can be applied when you want to fine tune your Camel K operator and get the very best of it.

Some of the configuration can be defined after the operator is installed using the proper xref:installation/integrationplatform.adoc[IntegrationPlatform specifications]. Other fine tunings require to change the operator Deployment, so they either need to be provided before the installation procedure start, or after, with the subsequent operator restart.

NOTE: changing some of the default configuration may affect the behavior of your Camel K Operator. Make sure to understand how to properly tune each configuration.

Most of these settings will require changing either an environment variable or other configuration of the operator Deployment. You need to verify how to apply those changes according the installation methodology chosen.

== Installation name

You can install one or more Camel K operators (which must share CRDs). In such case you need to specify a unique operator name which will be used by each resource to know who is in charge to reconcile it. This behavior is controlled by the OPERATOR_ID environment variable (default value, _camel-k_).

== Watch namespaces

Camel K operator can work in **global** (descoped) mode by watching all namespaces or **namespaced** (scoped). This behavior is controlled by the WATCH_NAMESPACE environment variable. If set to an empty value, then the operator will watch for resources in all namespaces. If it set to a given namespace, then it will only watch for resources in such a namespace.

== Resource management

We provide certain configuration to better "operationalize" the Camel K Operator. More detailed information on the xref:installation/advanced/resources.adoc[resource management] page.

== Monitoring

Camel K Operator provides certain parameters that would let you enable monitoring capabilities.

There is a default liveness service that is available at the operator Pod _/healtz_ endpoint on port _8081_. You can change the port parameter if you need to expose under a different port making sure to start the operator with the _--health-port_ to the same value. You also need to change the Deployment template spec to reflect the change on the operator container liveness check.

There is a default metrics service as well available at the operator Pod _/metrics_ endpoint on port _8080_. The port can be also changed. In this case you only need to change the Deployment container operator, changing the _--monitoring-port_ value to the port you want the operator to expose.

The service exposed on the _/metrics_ endpoint is compatible with Prometheus. You can learn more about xref:observability/monitoring/operator.adoc[how to monitor Camel K Operator].

== Logging

By default, the operator Pod logging level is set to INFO. You may require to change this value to log also DEBUG. In this case you need to provide an environment variable to the operator Deployment, _LOG_LEVEL_ which can be set to `debug`. You can also lower the number of logging tracing by setting this value to `error` (advisable for production environments).

== Environment Variables

The following environment variables can be configured on the operator Deployment to tune the operator behavior:

[cols="2,1,3"]
|===
|Variable |Default |Description

|`WATCH_NAMESPACE`
|_empty_
|The namespace(s) the operator watches for Integration resources. When not set or empty, the operator watches all namespaces.

|`NAMESPACE`
|_auto-detected_
|The namespace where the operator pod is running.

|`POD_NAME`
|_auto-detected_
|The name of the operator pod.

|`KAMEL_OPERATOR_ID`
|`camel-k`
|The operator ID used to identify which operator instance manages specific resources. Can also be set via `OPERATOR_ID`.

|`KAMEL_BASE_IMAGE`
|`eclipse-temurin:17-jdk@sha256:<digest>`
|The base image used for building Integration images. Can also be set via `RELATED_IMAGE_BASE`.

|`CAMEL_K_SYNTHETIC_INTEGRATIONS`
|`false`
|When set to `true`, enables synthetic Integration support for managing external workloads.

|`CAMEL_DASHBOARD_APP_LABEL`
|`camel.apache.org/app`
|If it exists, the operator add this label beside regular Camel K labels in order to let the Camel Dashboard discover and monitor the application.

|`LOG_LEVEL`
|`info`
|The log level for the operator. Valid values: `debug`, `info`, `warn`, `error`.

|`KAMELET_CATALOG_DIR`
|`/tmp/kamelets/`
|Directory where Kamelet catalog files are extracted during installation.
|===
