From bde55645fd3f4c47ff9370170101c0a0901eea6f Mon Sep 17 00:00:00 2001 From: Marc LeBlanc <7050295+marcleblanc2@users.noreply.github.com> Date: Mon, 23 Nov 2026 19:51:22 -0500 Subject: [PATCH] executors/k8s: Remove the unused /data PVC and the job pod affinity The native Kubernetes executor component mounted a 100Gi ReadWriteOnce PVC at /data and set EXECUTOR_KUBERNETES_PERSISTENCE_VOLUME_NAME, left over from the multi-pod job mode the executor no longer has: each job pod now has its own emptyDir or per-job PVC workspace, and the executor writes nothing to /data. The PVC kept the Deployment from scaling past one replica (a second pod on another node cannot attach it), and EXECUTOR_KUBERNETES_POD_AFFINITY pinned every job pod to a node running an executor pod, which capped how many job pods could run. Remove the PVC, its volume and mount, the dead env var, and the pod affinity, so job pods schedule on any suitable node and the Deployment can be scaled. The Helm chart made the same PVC change in sourcegraph/deploy-sourcegraph-helm#911. Amp-Thread-ID: https://ampcode.com/threads/T-01a20ade-0ba8-7364-b673-ac2197c102c9 Co-authored-by: Amp --- components/executors/k8s/README.md | 3 +-- components/executors/k8s/executor.ConfigMap.yaml | 2 -- components/executors/k8s/executor.Deployment.yaml | 7 ------- .../k8s/executor.PersistentVolumeClaim.yaml | 14 -------------- components/executors/k8s/kustomization.yaml | 1 - 5 files changed, 1 insertion(+), 26 deletions(-) delete mode 100644 components/executors/k8s/executor.PersistentVolumeClaim.yaml diff --git a/components/executors/k8s/README.md b/components/executors/k8s/README.md index bc2611cc..df1858b7 100644 --- a/components/executors/k8s/README.md +++ b/components/executors/k8s/README.md @@ -15,8 +15,7 @@ It is expected that all components contained in this directory and any subdirect The following components will deploy: - [Executor ConfigMap](./executor.ConfigMap.yaml) the configurations for the executors. -- [Executor Deployment](./executor.Deployment.yaml) An executor replica with a Docker sidecar to run isolated batch changes and auto-indexing jobs. -- [Executor Persistent Volume Claim](./executor.PersistentVolumeClaim.yaml) A headless service for executor metrics access. Executors are not externally accessible. +- [Executor Deployment](./executor.Deployment.yaml) The executor, which runs each batch change and auto-indexing job in its own Kubernetes Job pod. Each job pod has its own workspace volume and can run on any node. To run more jobs at once, raise `EXECUTOR_MAXIMUM_NUM_JOBS` or scale the Deployment's replicas. - [Executor Service](./executor.Service.yaml) A headless service for executor metrics access. Executors are not externally accessible. - [RBAC] The required rules for executors to interact with the Kubernetes API. - [Executor Role](./rbac/executor.Role.yaml) Contains the required rules. diff --git a/components/executors/k8s/executor.ConfigMap.yaml b/components/executors/k8s/executor.ConfigMap.yaml index 00cbc970..704829dd 100644 --- a/components/executors/k8s/executor.ConfigMap.yaml +++ b/components/executors/k8s/executor.ConfigMap.yaml @@ -9,5 +9,3 @@ metadata: app.kubernetes.io/component: executor data: EXECUTOR_USE_FIRECRACKER: "false" - EXECUTOR_KUBERNETES_PERSISTENCE_VOLUME_NAME: "sg-executor-pvc" - EXECUTOR_KUBERNETES_POD_AFFINITY: '[{"labelSelector": {"matchExpressions": [{"key": "app", "operator": "In", "values": ["executor"]}]}, "topologyKey": "kubernetes.io/hostname"}]' diff --git a/components/executors/k8s/executor.Deployment.yaml b/components/executors/k8s/executor.Deployment.yaml index 92b45674..faeea993 100644 --- a/components/executors/k8s/executor.Deployment.yaml +++ b/components/executors/k8s/executor.Deployment.yaml @@ -57,10 +57,3 @@ spec: envFrom: - configMapRef: name: executor-config - volumeMounts: - - mountPath: /data - name: sg-executor-volume - volumes: - - name: sg-executor-volume - persistentVolumeClaim: - claimName: sg-executor-pvc diff --git a/components/executors/k8s/executor.PersistentVolumeClaim.yaml b/components/executors/k8s/executor.PersistentVolumeClaim.yaml deleted file mode 100644 index 219017fb..00000000 --- a/components/executors/k8s/executor.PersistentVolumeClaim.yaml +++ /dev/null @@ -1,14 +0,0 @@ -apiVersion: v1 -kind: PersistentVolumeClaim -metadata: - name: sg-executor-pvc - labels: - deploy: sourcegraph - sourcegraph-resource-requires: no-cluster-admin - app.kubernetes.io/component: executor -spec: - accessModes: - - ReadWriteOnce - resources: - requests: - storage: 100Gi diff --git a/components/executors/k8s/kustomization.yaml b/components/executors/k8s/kustomization.yaml index f7ad0773..691cd4ac 100644 --- a/components/executors/k8s/kustomization.yaml +++ b/components/executors/k8s/kustomization.yaml @@ -4,7 +4,6 @@ resources: - rbac - executor.ConfigMap.yaml - executor.Deployment.yaml - - executor.PersistentVolumeClaim.yaml - executor.Service.yaml patches: - path: patches/executor.ConfigMap.yaml