Configuring Serverless ​
By default, the Serverless module comes with the default configuration. You can change the configuration using the Serverless CustomResourceDefinition (CRD), which manages Serverless custom resource (CR).
Prerequisites ​
You have the Serverless module added.
You have access to Kyma dashboard. Alternatively, to use CLI instructions, you must install kubectl.
Context ​
The Serverless module has its own operator (Serverless Operator). It watches the Serverless custom resource (CR) and reconfigures (reconciles) the Serverless workloads.
The Serverless CR is an API to configure the Serverless module. You can use it to perform the following actions:
- Configuring the trace endpoint.
- Configuring the eventing endpoint.
- Configuring the Function requeue duration.
- Configuring the healthz liveness timeout.
- Configuring the default runtime Pod preset.
- Configuring the log level.
- Configuring the log format.
- Disabling buildless mode.
The default configuration of the Serverless module is the following:
apiVersion: operator.kyma-project.io/v1alpha1
kind: Serverless
metadata:
name: serverless-sample
spec: {}Configuring the Trace Endpoint ​
By default, the Serverless operator checks if there is a trace endpoint available. If available, the detected trace endpoint is used as the trace collector URL in Functions. If no trace endpoint is detected, Functions are configured with no trace collector endpoint. You can configure a custom trace endpoint so that Function traces are sent to any tracing backend you choose. The currently used trace endpoint is visible in the Serverless CR status.
spec:
tracing:
endpoint: http://jaeger-collector.observability.svc.cluster.local:4318/v1/tracesConfiguring the Eventing Endpoint ​
You can configure a custom Eventing endpoint to publish events sent from your Functions. The currently used trace endpoint is visible in the Serverless CR status. By default http://eventing-publisher-proxy.kyma-system.svc.cluster.local/publish is used.
spec:
eventing:
endpoint: http://eventing-publisher-proxy.kyma-system.svc.cluster.local/publishConfiguring the Function Requeue Duration ​
By default, the Function associated with the default configuration will be requeued every 5 minutes.
spec:
functionRequeueDuration: 5mConfiguring the healthz Liveness Timeout ​
By default, Function is considered unhealthy if the liveness health check endpoint does not respond within 10 seconds.
spec:
healthzLivenessTimeout: "10s"Configuring the Default Runtime Pod Preset ​
You can configure the default runtime Pod preset to be used.
spec:
defaultRuntimePodPreset: "M"For more information on presets, see Available Presets.
Configuring the Log Level ​
You can configure the desired log level to be used.
spec:
logLevel: "debug"Configuring the Log Format ​
You can configure the desired log format to be used.
spec:
logFormat: "yaml"Disabling Buildless Mode ​
Serverless buildless mode is enabled by default. To use the legacy image-building Serverless functionality, disable buildless mode through an annotation.
WARNING
The legacy image-building mode is deprecated and will be removed in a future version of Serverless. This functionality is scheduled for removal and will no longer be available in upcoming releases.
To disable Serverless buildless mode and enable the legacy image build step for Functions, follow these steps:
Prerequisites ​
You have kubectl installed.
Procedure ​
Edit the Serverless CR:
bashkubectl edit -n kyma-system serverlesses.operator.kyma-project.io defaultIn the
metadatasection, addannotations, and add theserverless.kyma-project.io/buildless-mode: "disabled"key-value pair in it. Save the changes.
You have disabled Serverless buildless mode.