From 9c470d011f0d85e2b91deba7b8948d7acb6086c1 Mon Sep 17 00:00:00 2001 From: Michael Lin Date: Mon, 20 Jul 2026 16:51:43 -0700 Subject: [PATCH] executor: remove unused /data PVC and dead replicas value from k8s chart Remove the executor controller's `/data` PersistentVolumeClaim from the Kubernetes-native executor chart, together with its container volumeMount, pod-spec volume, the orphaned `storageClass`/`executor.storageSize` values, and the vestigial `EXECUTOR_KUBERNETES_PERSISTENCE_VOLUME_NAME` env var. Since single-job-pod became the only k8s execution mode, job pods use their own ephemeral emptyDir volume and the controller writes nothing to `/data`. Also remove the non-functional `executor.replicas` value: the controller is a singleton that pins Job pods to its own node, so `replicas > 1` never worked (extra replicas contend for the same ReadWriteOnce PVC). Co-Authored-By: Claude Opus 4.8 (1M context) --- charts/sourcegraph-executor/k8s/README.md | 8 ------- .../k8s/templates/executor.ConfigMap.yaml | 1 - .../k8s/templates/executor.Deployment.yaml | 12 ++++------ .../executor.PersistentVolumeClaim.yaml | 13 ----------- .../k8s/tests/executor_test.yaml | 8 +------ charts/sourcegraph-executor/k8s/values.yaml | 23 ------------------- charts/sourcegraph/CHANGELOG.md | 2 ++ 7 files changed, 7 insertions(+), 60 deletions(-) delete mode 100644 charts/sourcegraph-executor/k8s/templates/executor.PersistentVolumeClaim.yaml diff --git a/charts/sourcegraph-executor/k8s/README.md b/charts/sourcegraph-executor/k8s/README.md index 072307922..1b5905a94 100644 --- a/charts/sourcegraph-executor/k8s/README.md +++ b/charts/sourcegraph-executor/k8s/README.md @@ -94,7 +94,6 @@ In addition to the documented values, the `executor` and `private-docker-registr | executor.podSecurityContext | object | `{}` | Security context for the pod, learn more from the [Kubernetes documentation](https://kubernetes.io/docs/tasks/configure-pod-container/security-context/#set-the-security-context-for-a-pod) | | executor.queueName | string | `""` | The name of the queue to pull jobs from to. Possible values: batches and codeintel. **Either this or queueNames is required.** | | executor.queueNames | list | `[]` | The names of multiple queues to pull jobs from to. Possible values: batches and codeintel. **Either this or queueName is required.** | -| executor.replicas | int | `1` | | | executor.resources.limits.cpu | string | `"1"` | | | executor.resources.limits.memory | string | `"4Gi"` | | | executor.resources.requests.cpu | string | `"500m"` | | @@ -104,7 +103,6 @@ In addition to the documented values, the `executor` and `private-docker-registr | executor.securityContext.privileged | bool | `false` | DEPRECATED: Use `executor.containerSecurityContext` or `executor.podSecurityContext` instead. | | executor.securityContext.runAsGroup | string | `nil` | DEPRECATED: Use `executor.containerSecurityContext` or `executor.podSecurityContext` instead. | | executor.securityContext.runAsUser | string | `nil` | DEPRECATED: Use `executor.containerSecurityContext` or `executor.podSecurityContext` instead. | -| executor.storageSize | string | `"10Gi"` | The storage size of the PVC attached to the executor deployment. | | executor.tolerations | list | `[]` | Tolerations, learn more from the [Kubernetes documentation](https://kubernetes.io/docs/concepts/scheduling-eviction/taint-and-toleration/) | | sourcegraph.affinity | object | `{}` | Affinity, learn more from the [Kubernetes documentation](https://kubernetes.io/docs/concepts/scheduling-eviction/assign-pod-node/#affinity-and-anti-affinity) | | sourcegraph.image.defaultTag | string | `"{{ .Chart.AppVersion }}"` | Global docker image tag | @@ -120,9 +118,3 @@ In addition to the documented values, the `executor` and `private-docker-registr | sourcegraph.podLabels | object | `{}` | Add extra labels to attach to all pods | | sourcegraph.priorityClassName | string | `""` | Assign a priorityClass to all pods (daemonSets, deployments, and statefulSets) | | sourcegraph.tolerations | list | `[]` | Tolerations, learn more from the [Kubernetes documentation](https://kubernetes.io/docs/concepts/scheduling-eviction/taint-and-toleration/) | -| storageClass.allowedTopologies | object | `{}` | Persistent volumes topology configuration, learn more from the [Kubernetes documentation](https://kubernetes.io/docs/concepts/storage/storage-classes/#allowed-topologies) | -| storageClass.create | bool | `false` | Enable creation of storageClass. Defaults to Google Cloud Platform. Disable if you have your own existing storage class | -| storageClass.name | string | `"sourcegraph"` | Name of the storageClass. Use to customize to the existing storage class name | -| storageClass.parameters | object | `{}` | Extra parameters of storageClass, consult your cloud provider persistent storage documentation | -| storageClass.provisioner | string | `"kubernetes.io/gce-pd"` | Name of the storageClass provisioner, learn more from the [Kubernetes documentation](https://kubernetes.io/docs/concepts/storage/storage-classes/#provisioner) and consult your cloud provider persistent storage documentation | -| storageClass.type | string | `"pd-ssd"` | Value of `type` key in storageClass `parameters`, consult your cloud provider persistent storage documentation | diff --git a/charts/sourcegraph-executor/k8s/templates/executor.ConfigMap.yaml b/charts/sourcegraph-executor/k8s/templates/executor.ConfigMap.yaml index 3c233f387..6e773607b 100644 --- a/charts/sourcegraph-executor/k8s/templates/executor.ConfigMap.yaml +++ b/charts/sourcegraph-executor/k8s/templates/executor.ConfigMap.yaml @@ -18,7 +18,6 @@ data: EXECUTOR_KUBERNETES_NAMESPACE: "{{ .Values.executor.namespace }}" EXECUTOR_KUBERNETES_CONFIG_PATH: "{{ .Values.executor.kubeconfigPath }}" - EXECUTOR_KUBERNETES_PERSISTENCE_VOLUME_NAME: "sg-{{include "executor.name" . }}" EXECUTOR_KUBERNETES_NODE_NAME: "{{ .Values.executor.kubernetesJob.node.name }}" EXECUTOR_KUBERNETES_NODE_SELECTOR: "{{ .Values.executor.kubernetesJob.node.selector }}" diff --git a/charts/sourcegraph-executor/k8s/templates/executor.Deployment.yaml b/charts/sourcegraph-executor/k8s/templates/executor.Deployment.yaml index 185dbbe52..1cb35d2c4 100644 --- a/charts/sourcegraph-executor/k8s/templates/executor.Deployment.yaml +++ b/charts/sourcegraph-executor/k8s/templates/executor.Deployment.yaml @@ -16,7 +16,10 @@ spec: {{- include "sourcegraph.selectorLabels" . | nindent 6 }} app: {{ include "executor.name" . }} minReadySeconds: 10 - replicas: {{ .Values.executor.replicas }} + # The executor controller is a singleton: it pins Job pods to its own node + # via EXECUTOR_KUBERNETES_NODE_NAME, so running more than one replica does not + # work (replicas contend for the same ReadWriteOnce PVC). Do not make this configurable. + replicas: 1 revisionHistoryLimit: 10 strategy: rollingUpdate: @@ -97,9 +100,6 @@ spec: - -f - /usr/local/bin/executor periodSeconds: 5 - volumeMounts: - - mountPath: /data - name: "sg-{{include "executor.name" . }}" terminationMessagePolicy: FallbackToLogsOnError {{- with .Values.executor.nodeSelector }} nodeSelector: @@ -118,7 +118,3 @@ spec: imagePullSecrets: {{- toYaml . | nindent 8 }} {{- end }} - volumes: - - name: "sg-{{include "executor.name" . }}" - persistentVolumeClaim: - claimName: "sg-{{include "executor.name" . }}" diff --git a/charts/sourcegraph-executor/k8s/templates/executor.PersistentVolumeClaim.yaml b/charts/sourcegraph-executor/k8s/templates/executor.PersistentVolumeClaim.yaml deleted file mode 100644 index 65a8a5308..000000000 --- a/charts/sourcegraph-executor/k8s/templates/executor.PersistentVolumeClaim.yaml +++ /dev/null @@ -1,13 +0,0 @@ -apiVersion: v1 -kind: PersistentVolumeClaim -metadata: - name: "sg-{{include "executor.name" . }}" - labels: -{{ include "executor.labels" . | indent 4 }} -spec: - storageClassName: {{ .Values.storageClass.name }} - accessModes: - - ReadWriteOnce - resources: - requests: - storage: {{ .Values.executor.storageSize }} diff --git a/charts/sourcegraph-executor/k8s/tests/executor_test.yaml b/charts/sourcegraph-executor/k8s/tests/executor_test.yaml index 84c0aceb0..256638deb 100644 --- a/charts/sourcegraph-executor/k8s/tests/executor_test.yaml +++ b/charts/sourcegraph-executor/k8s/tests/executor_test.yaml @@ -3,9 +3,8 @@ templates: - executor.Deployment.yaml - executor.Service.yaml - executor.ConfigMap.yaml - - executor.PersistentVolumeClaim.yaml tests: - - it: should render the Deployment, Service, ConfigMap, PVC if executor is enabled + - it: should render the Deployment, Service, ConfigMap if executor is enabled set: executor: queueName: "test" @@ -25,11 +24,6 @@ tests: apiVersion: v1 name: executor-test template: executor.ConfigMap.yaml - - containsDocument: - kind: PersistentVolumeClaim - apiVersion: v1 - name: sg-executor-test - template: executor.PersistentVolumeClaim.yaml - it: should render default containerSecurityContext with privileged false template: executor.Deployment.yaml diff --git a/charts/sourcegraph-executor/k8s/values.yaml b/charts/sourcegraph-executor/k8s/values.yaml index 6fe5df706..45673ee78 100644 --- a/charts/sourcegraph-executor/k8s/values.yaml +++ b/charts/sourcegraph-executor/k8s/values.yaml @@ -36,30 +36,9 @@ sourcegraph: priorityClassName: "" -storageClass: - # -- Enable creation of storageClass. Defaults to Google Cloud Platform. Disable if you have your own existing storage class - create: false - # -- Name of the storageClass. - # Use to customize to the existing storage class name - name: sourcegraph - # -- Name of the storageClass provisioner, - # learn more from the [Kubernetes documentation](https://kubernetes.io/docs/concepts/storage/storage-classes/#provisioner) - # and consult your cloud provider persistent storage documentation - provisioner: kubernetes.io/gce-pd - # -- Value of `type` key in storageClass `parameters`, - # consult your cloud provider persistent storage documentation - type: pd-ssd - # -- Extra parameters of storageClass, - # consult your cloud provider persistent storage documentation - parameters: { } - # -- Persistent volumes topology configuration, - # learn more from the [Kubernetes documentation](https://kubernetes.io/docs/concepts/storage/storage-classes/#allowed-topologies) - allowedTopologies: { } - executor: # -- Whether to configure the necessary RBAC resources. Required only once for all executor deployments. configureRbac: true - replicas: 1 image: defaultTag: 6.0.0@sha256:6dc771a0c281a41ef676213f2f84a63d99045cf2e58d43022554a8022070ed65 name: "executor-kubernetes" @@ -95,8 +74,6 @@ executor: format: "condensed" trace: "false" - # -- The storage size of the PVC attached to the executor deployment. - storageSize: 10Gi # -- The namespace in which jobs are generated by the executor. namespace: "default" # -- The path to the kubeconfig file. If not specified, the in-cluster config is used. diff --git a/charts/sourcegraph/CHANGELOG.md b/charts/sourcegraph/CHANGELOG.md index d67e9f8cc..27c2bf158 100644 --- a/charts/sourcegraph/CHANGELOG.md +++ b/charts/sourcegraph/CHANGELOG.md @@ -8,6 +8,8 @@ Use `**BREAKING**:` to denote a breaking change ## Unreleased +- Removed the unused executor controller `/data` PersistentVolumeClaim from the Kubernetes-native executor chart (`sourcegraph-executor/k8s`), along with the now-orphaned `storageClass` and `executor.storageSize` values and the vestigial `EXECUTOR_KUBERNETES_PERSISTENCE_VOLUME_NAME` env var. Since single-job-pod became the only k8s execution mode, job pods use their own ephemeral `emptyDir` volume and the controller writes nothing to `/data`. +- Removed the non-functional `executor.replicas` value from the Kubernetes-native executor chart; the controller is a singleton (it pins Job pods to its own node), so `replicas > 1` never worked. - Added support for overriding `replicaCount` per dedicated `worker` replica via `worker.replicas[].replicaCount`, falling back to `worker.replicaCount` when unset - Added support for overriding the image repository on a per-service basis via `.image.repository`, falling back to the global `sourcegraph.image.repository` when unset - Added livenessProbe to zoekt-webserver in indexed-search to detect and restart hung pods