Executor configuration

The following is a list of all of the configuration options for the executor service. The process for configuring your executor instance will vary depending on the executor deployment method selected, but are generally defined as environment variables either in the executor Docker container or directly on the host machine, depending on whether the service is running in Docker or as a native Linux binary.

General configuration

Configuration KeyDescriptionExample value
EXECUTOR_FRONTEND_URLThe external URL of the Sourcegraph instance. requiredhttp://sourcegraph.example.com
EXECUTOR_FRONTEND_PASSWORDThe shared secret configured in the Sourcegraph instance site config under executors.accessToken. requiredour-shared-secret
EXECUTOR_QUEUE_NAMEThe name of a single queue to pull jobs from. Possible values: batches and codeintel. required: either this or EXECUTOR_QUEUE_NAMESbatches
EXECUTOR_QUEUE_NAMESThe names of multiple queues to pull jobs from, comma-separated. Possible values: batches and codeintel. required: either this or EXECUTOR_QUEUE_NAMEbatches,codeintel
EXECUTOR_USE_FIRECRACKERWhether to isolate jobs in virtual machines. Requires ignite and firecracker. Linux hosts only. Kubernetes is not supported. (default value: "true" when OS is Linux and not on Kubernetes)true
EXECUTOR_MAXIMUM_NUM_JOBSNumber of virtual machines or containers that can be running at once. (default value: "1")1
EXECUTOR_MAXIMUM_RUNTIME_PER_JOBThe maximum wall time that can be spent on a single job. (default value: "30m")30m
EXECUTOR_JOB_MEMORYHow much memory to allocate to each virtual machine or container. A value of zero sets no resource bound (in Docker, but not VMs). (default value: "12G")12G
EXECUTOR_JOB_NUM_CPUSHow many CPUs to allocate to each virtual machine or container. A value of zero sets no resource bound (in Docker, but not VMs). (default value: "4")4
EXECUTOR_DOCKER_REGISTRY_MIRROR_URLThe address of a docker registry mirror to use in firecracker VMs.http://10.0.0.2:5000
EXECUTOR_FIRECRACKER_DISK_SPACEHow much disk space to allocate to each virtual machine. (default value: "20G")20G
EXECUTOR_FIRECRACKER_BANDWIDTH_EGRESSHow much bandwidth to allow for egress packets to the VM in bytes/s. (default value: "524288000")524288000
EXECUTOR_FIRECRACKER_BANDWIDTH_INGRESSHow much bandwidth to allow for ingress packets to the VM in bytes/s. (default value: "524288000")524288000
EXECUTOR_KEEP_WORKSPACESWhether to skip deletion of workspaces after a job completes (or fails). Note that when Firecracker is enabled that the workspace is initially copied into the VM, so modifications will not be observed. (default value: "false")true
EXECUTOR_MAX_ACTIVE_TIMEThe maximum time that can be spent by the worker dequeueing records to be handled. (default value: "0")100m
EXECUTOR_NUM_TOTAL_JOBSThe maximum number of jobs that will be dequeued by the worker. (default value: "0")100
EXECUTOR_DOCKER_HOST_MOUNT_PATHThe target workspace as it resides on the Docker host (used to enable Docker-in-Docker)./workspaces
EXECUTOR_QUEUE_POLL_INTERVALInterval between dequeue requests. (default value: "1s")1s
EXECUTOR_CLEANUP_TASK_INTERVALThe frequency with which to run periodic cleanup tasks. (default value: "1m")1m
EXECUTOR_VM_PREFIXA name prefix for virtual machines controlled by this instance. (default value: "executor")executor
EXECUTOR_VM_STARTUP_SCRIPT_PATHA path to a file on the host that is loaded into a fresh virtual machine and executed on startup./vm-startup.sh
NODE_EXPORTER_URLThe URL of the node_exporter instance, without the /metrics path.http://127.0.0.1:9000
EXECUTOR_FIRECRACKER_IMAGEThe base image to use for virtual machines.sourcegraph/executor-vm:insiders
EXECUTOR_FIRECRACKER_KERNEL_IMAGEThe base image containing the kernel binary to use for virtual machines.sourcegraph/ignite-kernel:5.10.135-amd64
EXECUTOR_FIRECRACKER_SANDBOX_IMAGEThe OCI image for the ignite VM sandbox.sourcegraph/ignite:v0.10.5
DOCKER_REGISTRY_NODE_EXPORTER_URLThe URL of the Docker Registry instance's node_exporter, without the /metrics path.http://localhost:9000
SRC_LOG_LEVELupper log level to restrict log output to (dbug, info, warn, error, crit) (default value: "warn")warn

Kubernetes Specific Configuration

The following environment variables are specific to the native Kubernetes Executor deployment method. These environment variables can be set on the Executor Deployment and will configure the Jobs that it spawns. Executor environment variables can also be defined on a Kubernetes ConfigMap or Secret that is mounted to the executor deployment.

NameDefault ValueDescription
EXECUTOR_KUBERNETES_CONFIG_PATHN/AThe path to the Kubernetes configuration file. If not specified, the in cluster config is used.
EXECUTOR_KUBERNETES_NODE_NAMEN/AThe name of the Kubernetes Node to create Jobs in. If not specified, the Pods are created in the first available node.
EXECUTOR_KUBERNETES_NODE_SELECTORN/AA comma separated list of values to use as a node selector for Kubernetes Jobs. e.g. foo=bar,app=my-app
EXECUTOR_KUBERNETES_NODE_REQUIRED_AFFINITY_MATCH_EXPRESSIONN/AThe JSON encoded required affinity match expressions for Kubernetes Jobs. e.g. [{"key": "foo", "operator": "In", "values": ["bar"]}]
EXECUTOR_KUBERNETES_NODE_REQUIRED_AFFINITY_MATCH_FIELDSN/AThe JSON encoded required affinity match fields for Kubernetes Jobs. e.g. [{"key": "foo", "operator": "In", "values": ["bar"]}]
EXECUTOR_KUBERNETES_POD_AFFINITYN/AThe JSON encoded pod affinity for Kubernetes Jobs. e.g. [{"labelSelector": {"matchExpressions": [{"key": "foo", "operator": "In", "values": ["bar"]}]}, "topologyKey": "kubernetes.io/hostname"}]
EXECUTOR_KUBERNETES_POD_ANTI_AFFINITYN/AThe JSON encoded pod anti-affinity for Kubernetes Jobs. e.g. [{"labelSelector": {"matchExpressions": [{"key": "foo", "operator": "In", "values": ["bar"]}]}, "topologyKey": "kubernetes.io/hostname"}]
EXECUTOR_KUBERNETES_NODE_TOLERATIONSN/AThe JSON encoded tolerations for Kubernetes Jobs. e.g. [{"key": "foo", "operator": "Equal", "value": "bar", "effect": "NoSchedule"}]
EXECUTOR_KUBERNETES_NAMESPACEdefaultThe Kubernetes namespace in which the executor service will spawn executor jobs (K8s Jobs) in.
EXECUTOR_KUBERNETES_PERSISTENCE_VOLUME_NAMEsg-executor-pvcThe name of the Executor Persistence Volume. Must match the PersistentVolumeClaim configured for the instance.
EXECUTOR_KUBERNETES_RESOURCE_LIMIT_CPUN/AThe maximum CPU resource for Kubernetes Jobs.
EXECUTOR_KUBERNETES_RESOURCE_LIMIT_MEMORY12GiThe maximum memory resource for Kubernetes Jobs.
EXECUTOR_KUBERNETES_RESOURCE_REQUEST_CPUN/AThe minimum CPU resource for Kubernetes Jobs.
EXECUTOR_KUBERNETES_RESOURCE_REQUEST_MEMORY12GiThe minimum memory resource for Kubernetes Jobs.
KUBERNETES_JOB_DEADLINE1200The number of seconds after which a Kubernetes job will be terminated.
KUBERNETES_RUN_AS_USERN/AThe user ID to run Kubernetes jobs as.
KUBERNETES_RUN_AS_GROUPN/AThe group ID to run Kubernetes jobs as.
KUBERNETES_FS_GROUP1000The group ID to run all containers in the Kubernetes jobs as.
KUBERNETES_KEEP_JOBSfalseIf true, Kubernetes jobs will not be deleted after they complete. Useful for debugging.
KUBERNETES_JOB_ANNOTATIONSN/AThe JSON encoded annotations to add to the Kubernetes Jobs. e.g. {"foo": "bar", "faz": "baz"}
KUBERNETES_JOB_POD_ANNOTATIONSN/AThe JSON encoded annotations to add to the Kubernetes Job Pods. e.g. {"foo": "bar", "faz": "baz"}
KUBERNETES_IMAGE_PULL_SECRETSN/AThe names of Kubernetes image pull secrets to use for pulling images. e.g. my-secret,my-other-secret
Note: EXECUTOR_KUBERNETES_NAMESPACE should be set to either "default" or the specific namespace where your Executor is deployed.