Configuration

The service allowed two variants of configuration:

  1. use the Configurator service

  2. use the configuration file

The service reads settings from the configuration file by default.

You can specify the –luna-config option for pulling settings from the Configurator service, see the configurator.

Auto reload configuration

The service supports an auto-reload of configurations. You can enable this feature by specifying the config-reload option on the command line. The service periodically checks for new settings. If the current settings and new pulled settings are the same the service will not perform any actions. You can specify the check period via the pulling-time command line argument (10 seconds by default).

If a configuration fetching has failed, the service will work without applying any changes to the existing configurations.

If check connections with the new configuration have failed, the service will retry pulling the new configuration after pulling-time seconds. The service will shut down after 10 failed attempts.

Warning

Service may work incorrectly while the new settings are being applied. It is strongly recommended not to send requests to the service when you change important settings (database credentials, work plugins list, and others).

Configuration requirements

There are several parameters that are responsible for interacting with the kubernetes cluster.

  • The main significant parameter is CLUSTER_LOCATION. There are several allowed values of this parameter:

    • internal: suggests service works in k8s cluster and doesn’t require and other additional settings

    • remote: suggests service works with a remote k8s cluster and properly defined CLUSTER_CREDENTIALS settings (highly not recommended for anything except development)

    • local: suggests service works on the same machine as the k8s cluster (highly not recommended for anything except development)

  • If luna-lambda is configured to use a remote kubernetes cluster it is required to define CLUSTER_CREDENTIALS:

    • suggests access to the k8s cluster using an ssl connection

    • HOST is the kubernetes cluster host

    • TOKEN is the kubernetes cluster token which must be provided by the kubernetes cluster administrator (each token has its own expiration time, do not forget to use actual token)

    • CERTIFICATE_PATH is the path to the SSL certificate which must be provided by the kubernetes cluster administrator

  • Independently of the CLUSTER_LOCATION configuration it is required to define S3 setting using credentials for an s3-like storage with possibility to read/write to specified bucket. It will be used by luna-lambda for storing archives with lambdas.

    Warning

    At present there is no mechanism for s3 bucket garbage collection.

  • There is LAMBDA_REGISTRY parameter. It is required read and write access to this registry. If luna-lambda is running in a kubernetes cluster, it is required to grant access to this registry from the kubernetes cluster.

  • There is LAMBDA_INSECURE_REGISTRIES parameter. If LAMBDA_REGISTRY contains an insecure registry and/or it is required access to any other insecure registries during the lambda creation process, they must be specified in LAMBDA_INSECURE_REGISTRIES.

Configuration file for luna-lambda

# LUNA Lambda configuration file

[LUNA_CONFIGURATOR]
#: [integer] load configs from LUNA Configurator
USE_CONFIGURATOR = 0
#: [string] LUNA Configurator protocol, IP address, and port
LUNA_CONFIGURATOR_ORIGIN = http://127.0.0.1:5070
#: [integer] API version of the LUNA Configurator
LUNA_CONFIGURATOR_API  = 1

[LUNA_LAMBDA_DB]
#: [string] type of database: "postgres"
DB_TYPE = postgres
#: [string] database username
DB_USER = luna
#: [string] database password
DB_PASSWORD = luna
#: [string] database IP address
DB_HOST = 127.0.0.1
#: [integer] database listener port, 5432 - default for "postgres" type
DB_PORT = 5432
#: [string] database name for "postgres" type
DB_NAME = luna_lambda

[LUNA_LAMBDA_DB.DB_SETTINGS]
#: [integer] database connection pool size
CONNECTION_POOL_SIZE = 5

[LUNA_LAMBDA_LOGGER]
#: [string] folder, where logs are saved (relative path begins in directory with application)
FOLDER_WITH_LOGS = ./
#: [string] level of debug print, by priority: "ERROR", "WARNING", "INFO", "DEBUG"
LOG_LEVEL = INFO
#: [string] time format used in log records: "LOCAL" or "UTC"
LOG_TIME = LOCAL
#: [integer] maximum log file size in megabytes before performing rotation (0 - without rotation)
MAX_LOG_FILE_SIZE = 1024
#: send log to stdout
LOG_TO_STDOUT = 1
#: send log to file
LOG_TO_FILE = 0
#: allow multiline stack trace in logs
MULTILINE_STACK_TRACE = 1
#: log format
FORMAT = default

[LUNA_MONITORING]
#: [string] storage type
STORAGE_TYPE = influx
#: [integer] Whether to send data for monitoring
SEND_DATA_FOR_MONITORING = 0
#: [string] InfluxDB 2.x workspace
ORGANIZATION = luna
#: [string] InfluxDB 2.x authentication token
TOKEN = kofqt4Pfqjn6o0RBtMDQqVoJLgHoxxDUmmhiAZ7JS6VmEnrqZXQhxDhad8AX9tmiJH6CjM7Y1U8p5eSEocGzIA==
#: [string] InfluxDB 2.x bucket name
BUCKET = luna_monitoring
#: [string] Monitoring database IP address
HOST = 127.0.0.1
#: [integer] Monitoring database port
PORT = 8086
#: [integer] Whether to use HTTPS to connect to Monitoring database
USE_SSL = 0
#: [integer] frequency of sending monitoring data to the database (in seconds)
FLUSHING_PERIOD = 1

[LAMBDA_S3]
#: S3 endpoint
HOST = http://localhost:7480
#: S3 public access key
AWS_PUBLIC_ACCESS_KEY = ""
#: S3 secret access key
AWS_SECRET_ACCESS_KEY = ""
#: S3 public access key
BUCKET = test-plugins
#: S3 region
REGION = eu-central-1

[CLUSTER_CREDENTIALS]
#: cluster host
HOST = https://127.0.0.1:6443
#: access token
TOKEN = token
#: path to ssl certificate
CERTIFICATE_PATH = ./cert.crt

[LUNA_LICENSES_ADDRESS]
#: LUNA license service, IP address, and port
ORIGIN = http://127.0.0.1:5120
#: API version of the LUNA Faces
API_VERSION = 1

[ADDITIONAL_SERVICES_USAGE]
LUNA_LAMBDA = 1

[LUNA_SERVICE_METRICS]
#: [int] whether to enable /metrics path and statistics collection
ENABLED = 0
# [string] statistics data format (prometheus is the only option yet)
METRICS_FORMAT = prometheus

[LUNA_SERVICE_METRICS.EXTRA_LABELS]

[LUNA_LAMBDA_HTTP_SETTINGS]
#: request timeout
REQUEST_TIMEOUT=60
#: response timeout
RESPONSE_TIMEOUT=600
#: request max size
REQUEST_MAX_SIZE=1073741824
#: keep alive
KEEP_ALIVE_TIMEOUT=200

[REGISTRY_TIMEOUTS]
#: [integer] HTTP connection timeout
CONNECT = 30
#: [integer] HTTP request timeout (total)
REQUEST = 300

[LUNA_LAMBDA_METRICS_SETTINGS]
#: Whether lambda metrics enabled
enabled = 0
#: Metrics type
type = prometheus
#: Metrics source origin
origin = http://127.0.0.1:5090

[LUNA_LAMBDA_INACTIVE_LAMBDA_CLEAR_INTERVAL]
#: [integer] interval for delete inactive lambdas by schedule
interval = 1
#: [string] interval type one of ("weeks", "days", "hours", "minutes")
interval_type = days
#: [integer] Inactive lambdas check interval in seconds for deletion
check_interval = 30
#: [boolean] activate inactive lambdas auto deletion
active = 1

[LUNA_LAMBDA_INACTIVE_JOB_CLEAR_INTERVAL]
#: [integer] interval for delete inactive jobs by schedule
interval = 1
#: [string] interval type one of ("weeks", "days", "hours", "minutes")
interval_type = days
#: [integer] Inactive jobs check interval in seconds for deletion
check_interval = 30
#: [boolean] activate inactive jobs auto deletion
active = 1

[LUNA_BUILDER_ADDRESS]
#: LUNA Builder protocol, IP address, and port
ORIGIN = http://127.0.0.1:5290
#: API version of the LUNA Builder
API_VERSION = 1

[LUNA_BUILDER_TIMEOUTS]
#: CONNECT TIMEOUT
CONNECT = 30
#: REQUEST TIMEOUT (total)
REQUEST =  60

[LAMBDA_DEPLOYMENT_SETTINGS.DEFAULT_NAMESPACE]

[LUNA_LAMBDA_JOBS]
#: [integer] Lambda job queue rotation interval (in seconds)
JOB_ROTATION_INTERVAL = 5
#: [integer] Timeout for service requests in jobs (in seconds)
JOB_SERVICE_REQUESTS_TIMEOUT = 60
#: [integer] Period after job start when it remains uncompleted despite being responsive (in seconds)
JOB_WARMUP_INTERVAL = 10
#: [interger] Jobs refresh period (in seconds)
JOBS_REFRESH_PERIOD = 60
#: [integer] Jobs max operating time (in seconds)
MAX_OPERATING_TIME = 600

[LUNA_LAMBDA_INTERNAL_TIMEOUTS]
#: [integer] Timeout for lambda image creation operations (in seconds)
IMAGE_CREATION_TIMEOUT = 7200
#: [integer] Timeout for lambda image archive download from S3 (in seconds)
IMAGE_ARCHIVE_DOWNLOAD_TIMEOUT = 300
#: [integer] Timeout for lambda deletion operations (in seconds)
LAMBDA_DELETION_TIMEOUT = 300
#: [integer] Lambda last activity update interval (in seconds)
LAST_ACTIVITY_UPDATE_INTERVAL = 30
#: [integer] Startup probe warmup timeout (in seconds)
LAMBDA_WARMUP_TIMEOUT = 600

[LAMBDA_BASE_IMAGE]
#: default base docker image for lambdas and workflows (object with name and tag or empty)
BASE_IMAGE =
#: default FSDK base docker image (object with name and tag or empty)
FSDK_BASE_IMAGE =
#: default base docker image for agent lambdas (object with name and tag or empty)
AGENT_BASE_IMAGE =

[LAMBDA_REGISTRY]

#: address
ADDRESS = lambdas-registry.vlabs


[OTHER]
#: storage time - "LOCAL" or "UTC"
STORAGE_TIME = LOCAL
#: k8s cluster location: remote/local(executed on same machine)/internal(executed in cluster)
CLUSTER_LOCATION = internal
#: list of active plugins
LUNA_LAMBDA_ACTIVE_PLUGINS = []
#: insecure registries
LAMBDA_INSECURE_REGISTRIES = [lambdas-registry.vlabs]
#: [string] address of platform docs site
PLATFORM_DOCS_ADDRESS = http://127.0.0.1:5320

Additional notes

Parameter

Description

IMAGE_CREATION_TIMEOUT

During lambda creation, lambda update, workflow creation, or job creation, if the image build fails to complete in time, the build task is canceled, and the operation fails.

IMAGE_ARCHIVE_DOWNLOAD_TIMEOUT

During lambda update, if the lambda image archive is not found in S3, the request is retried several times until the timeout, allowing for concurrent upload to complete.

LAMBDA_DELETION_TIMEOUT

During lambda update, or lambda config update, if the old lambda is not deleted until timeout, or if the ongoing image build for the old lambda is not stopped until timeout, the update fails.

LAST_ACTIVITY_UPDATE_INTERVAL

If LUNA_LAMBDA_INACTIVE_LAMBDA_CLEAR_INTERVAL.active (for lambdas) or LUNA_LAMBDA_INACTIVE_JOB_CLEAR_INTERVAL.active (for jobs) is 0, the last activity metric is updated at this periodicity. Otherwise, LAST_ACTIVITY_UPDATE_INTERVAL is ignored, and LUNA_LAMBDA_INACTIVE_..._CLEAR_INTERVAL.interval is used instead.

LAMBDA_WARMUP_TIMEOUT

Time budget (in seconds) for the lambda’s checkWarmup function to start returning True. The deployment’s startupProbe is given a failureThreshold sized to this timeout, so the livenessProbe cannot kill the pod while it is still warming up. If checkWarmup has not succeeded by the time the budget is exhausted, the startup probe fails and the pod is restarted.