diff --git a/charts/sourcegraph-executor/CHANGELOG.md b/charts/sourcegraph-executor/CHANGELOG.md index 5e2f4fb18..ba90f75c2 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. The `sourcegraph-executor-dind` chart rejects `EXECUTOR_DEPLOY_TYPE` in `executor.env` and `queues[].env`. + ## 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..ee9aed587 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 @@ -376,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 ebc890027..2bb8d626e 100644 --- a/charts/sourcegraph-executor/dind/tests/executor_test.yaml +++ b/charts/sourcegraph-executor/dind/tests/executor_test.yaml @@ -24,6 +24,24 @@ 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 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 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