From 2f6ab1a6d58918bdf2bbec86798c51a936333498 Mon Sep 17 00:00:00 2001 From: Marc LeBlanc <7050295+marcleblanc2@users.noreply.github.com> Date: Wed, 25 Nov 2026 13:54:51 -0500 Subject: [PATCH 1/2] executors: set EXECUTOR_DEPLOY_TYPE in both executor charts The k8s chart sets helm-k8s and the dind chart sets helm-dind, so pings report which chart deployed the executors. --- charts/sourcegraph-executor/CHANGELOG.md | 2 ++ charts/sourcegraph-executor/dind/templates/_helpers.tpl | 2 ++ charts/sourcegraph-executor/dind/tests/executor_test.yaml | 6 ++++++ .../k8s/templates/executor.ConfigMap.yaml | 1 + charts/sourcegraph-executor/k8s/tests/executor_test.yaml | 4 ++++ 5 files changed, 15 insertions(+) diff --git a/charts/sourcegraph-executor/CHANGELOG.md b/charts/sourcegraph-executor/CHANGELOG.md index 5e2f4fb18..12235ae79 100644 --- a/charts/sourcegraph-executor/CHANGELOG.md +++ b/charts/sourcegraph-executor/CHANGELOG.md @@ -3,6 +3,8 @@ ## Unreleased +* Set `EXECUTOR_DEPLOY_TYPE` to `helm-k8s` in the `sourcegraph-executor-k8s` chart and `helm-dind` in the `sourcegraph-executor-dind` chart, so pings report which chart deployed the executors. + ## 8.0.0 * Added a `network-policy` example to the `sourcegraph-executor-k8s` and `sourcegraph-executor-dind` charts, with `CiliumNetworkPolicy` resources which limit Executor and job pods to the frontend API. diff --git a/charts/sourcegraph-executor/dind/templates/_helpers.tpl b/charts/sourcegraph-executor/dind/templates/_helpers.tpl index 8b87b5d24..5c459e479 100644 --- a/charts/sourcegraph-executor/dind/templates/_helpers.tpl +++ b/charts/sourcegraph-executor/dind/templates/_helpers.tpl @@ -236,6 +236,8 @@ spec: value: "false" - name: EXECUTOR_USE_KUBERNETES value: "false" + - name: EXECUTOR_DEPLOY_TYPE + value: helm-dind - name: EXECUTOR_HEALTH_SERVER_ADDR value: ":8080" - name: EXECUTOR_JOB_NUM_CPUS diff --git a/charts/sourcegraph-executor/dind/tests/executor_test.yaml b/charts/sourcegraph-executor/dind/tests/executor_test.yaml index ebc890027..9aaa6a638 100644 --- a/charts/sourcegraph-executor/dind/tests/executor_test.yaml +++ b/charts/sourcegraph-executor/dind/tests/executor_test.yaml @@ -24,6 +24,12 @@ tests: name: EXECUTOR_QUEUE_NAME value: batches template: executor/executor.Deployment.yaml + - contains: + path: spec.template.spec.containers[0].env + content: + name: EXECUTOR_DEPLOY_TYPE + value: helm-dind + template: executor/executor.Deployment.yaml - it: should render one Deployment per entry in queues template: executor/executor.Deployment.yaml diff --git a/charts/sourcegraph-executor/k8s/templates/executor.ConfigMap.yaml b/charts/sourcegraph-executor/k8s/templates/executor.ConfigMap.yaml index 6e773607b..e21eceefc 100644 --- a/charts/sourcegraph-executor/k8s/templates/executor.ConfigMap.yaml +++ b/charts/sourcegraph-executor/k8s/templates/executor.ConfigMap.yaml @@ -6,6 +6,7 @@ metadata: {{- include "executor.labels" . | nindent 4 }} data: EXECUTOR_USE_FIRECRACKER: "false" + EXECUTOR_DEPLOY_TYPE: "helm-k8s" EXECUTOR_FRONTEND_URL: "{{ .Values.executor.frontendUrl }}" EXECUTOR_MAXIMUM_NUM_JOBS: "{{ .Values.executor.maximumNumJobs }}" EXECUTOR_MAXIMUM_RUNTIME_PER_JOB: "{{ .Values.executor.maximumRuntimePerJob }}" diff --git a/charts/sourcegraph-executor/k8s/tests/executor_test.yaml b/charts/sourcegraph-executor/k8s/tests/executor_test.yaml index 256638deb..7a09d2898 100644 --- a/charts/sourcegraph-executor/k8s/tests/executor_test.yaml +++ b/charts/sourcegraph-executor/k8s/tests/executor_test.yaml @@ -24,6 +24,10 @@ tests: apiVersion: v1 name: executor-test template: executor.ConfigMap.yaml + - equal: + path: data.EXECUTOR_DEPLOY_TYPE + value: helm-k8s + template: executor.ConfigMap.yaml - it: should render default containerSecurityContext with privileged false template: executor.Deployment.yaml From 01623a83195e0893391eab54f2d1cbfa26b1e61a Mon Sep 17 00:00:00 2001 From: Marc LeBlanc <7050295+marcleblanc2@users.noreply.github.com> Date: Wed, 25 Nov 2026 18:10:53 -0500 Subject: [PATCH 2/2] executors: Reject EXECUTOR_DEPLOY_TYPE in dind chart env The chart sets it, so a user env entry would add a duplicate key. Amp-Thread-ID: https://ampcode.com/threads/T-01a214e9-44e3-7480-898c-b3ec8d72df68 Co-authored-by: Amp --- charts/sourcegraph-executor/CHANGELOG.md | 2 +- .../sourcegraph-executor/dind/templates/_helpers.tpl | 3 ++- .../dind/tests/executor_test.yaml | 12 ++++++++++++ 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/charts/sourcegraph-executor/CHANGELOG.md b/charts/sourcegraph-executor/CHANGELOG.md index 12235ae79..ba90f75c2 100644 --- a/charts/sourcegraph-executor/CHANGELOG.md +++ b/charts/sourcegraph-executor/CHANGELOG.md @@ -3,7 +3,7 @@ ## Unreleased -* Set `EXECUTOR_DEPLOY_TYPE` to `helm-k8s` in the `sourcegraph-executor-k8s` chart and `helm-dind` in the `sourcegraph-executor-dind` chart, so pings report which chart deployed the executors. +* Set `EXECUTOR_DEPLOY_TYPE` to `helm-k8s` in the `sourcegraph-executor-k8s` chart and `helm-dind` in the `sourcegraph-executor-dind` chart, so pings report which chart deployed the executors. The `sourcegraph-executor-dind` chart rejects `EXECUTOR_DEPLOY_TYPE` in `executor.env` and `queues[].env`. ## 8.0.0 diff --git a/charts/sourcegraph-executor/dind/templates/_helpers.tpl b/charts/sourcegraph-executor/dind/templates/_helpers.tpl index 5c459e479..ee9aed587 100644 --- a/charts/sourcegraph-executor/dind/templates/_helpers.tpl +++ b/charts/sourcegraph-executor/dind/templates/_helpers.tpl @@ -378,7 +378,8 @@ Usage: include "executor.validateEnv" (list $envDict "label") "EXECUTOR_MAXIMUM_NUM_JOBS" "EXECUTOR_MAXIMUM_RUNTIME_PER_JOB" "EXECUTOR_DOCKER_ADD_HOST_GATEWAY" - "EXECUTOR_KEEP_WORKSPACES" -}} + "EXECUTOR_KEEP_WORKSPACES" + "EXECUTOR_DEPLOY_TYPE" -}} {{- range $managed -}} {{- if hasKey $envDict . -}} {{- fail (printf "%s: env must not contain managed variable %s; use the structured executor fields instead" $label .) -}} diff --git a/charts/sourcegraph-executor/dind/tests/executor_test.yaml b/charts/sourcegraph-executor/dind/tests/executor_test.yaml index 9aaa6a638..2bb8d626e 100644 --- a/charts/sourcegraph-executor/dind/tests/executor_test.yaml +++ b/charts/sourcegraph-executor/dind/tests/executor_test.yaml @@ -31,6 +31,18 @@ tests: value: helm-dind template: executor/executor.Deployment.yaml + - it: should refuse EXECUTOR_DEPLOY_TYPE in env + template: executor/executor.Deployment.yaml + set: + executor: + queueName: batches + env: + EXECUTOR_DEPLOY_TYPE: + value: custom + asserts: + - failedTemplate: + errorPattern: "env must not contain managed variable EXECUTOR_DEPLOY_TYPE" + - it: should render one Deployment per entry in queues template: executor/executor.Deployment.yaml set: