From 858db21c623f0863359b411b14e03415288c7e49 Mon Sep 17 00:00:00 2001 From: Marc LeBlanc Date: Fri, 5 Dec 2025 19:21:52 -0700 Subject: [PATCH] Add priorityClassName to Helm charts and docs --- TEST.md | 4 +- charts/sourcegraph-executor/dind/README.md | 1 + .../executor/executor.Deployment.yaml | 3 ++ .../private-docker-registry.Deployment.yaml | 3 ++ charts/sourcegraph-executor/dind/values.yaml | 2 + charts/sourcegraph-executor/k8s/README.md | 9 +++-- .../k8s/templates/executor.Deployment.yaml | 3 ++ charts/sourcegraph-executor/k8s/values.yaml | 38 ++++++++++--------- charts/sourcegraph-migrator/README.md | 1 + .../migrator/sourcegraph-migrator.Job.yaml | 3 ++ charts/sourcegraph-migrator/values.yaml | 2 + charts/sourcegraph/README.md | 1 + charts/sourcegraph/templates/_worker.tpl | 3 ++ .../blobstore/blobstore.Deployment.yaml | 3 ++ .../cadvisor/cadvisor.DaemonSet.yaml | 3 ++ .../codeinsights-db.StatefulSet.yaml | 3 ++ .../codeintel-db.StatefulSet.yaml | 3 ++ .../sourcegraph-frontend.Deployment.yaml | 3 ++ .../gitserver/gitserver.StatefulSet.yaml | 4 +- .../grafana/grafana.StatefulSet.yaml | 3 ++ .../indexed-search.StatefulSet.yaml | 6 +-- .../templates/jaeger/jaeger.Deployment.yaml | 3 ++ .../node-exporter.DaemonSet.yaml | 3 ++ .../otel-collector/otel-agent.DaemonSet.yaml | 3 ++ .../otel-collector.Deployment.yaml | 3 ++ .../templates/pgsql/pgsql.StatefulSet.yaml | 3 ++ .../precise-code-intel/worker.Deployment.yaml | 3 ++ .../prometheus/prometheus.Deployment.yaml | 3 ++ .../redis/redis-cache.Deployment.yaml | 4 +- .../redis/redis-store.Deployment.yaml | 4 +- .../searcher/searcher.StatefulSet.yaml | 4 +- .../worker.Deployment.yaml | 3 ++ .../syntect-server.Deployment.yaml | 3 ++ charts/sourcegraph/values.yaml | 2 + 34 files changed, 107 insertions(+), 35 deletions(-) diff --git a/TEST.md b/TEST.md index 7a4f1fa8..af12499b 100644 --- a/TEST.md +++ b/TEST.md @@ -23,7 +23,7 @@ helm plugin install https://github.com/helm-unittest/helm-unittest Once the plugin is installed, you can run the unit tests using the following: ```bash -helm unittest --helm3 ./charts/sourcegraph/. +helm unittest ./charts/sourcegraph/. ``` We currently do not have testing best practices or require unit tests for new changes, so add test cases at your best judgement if possible. @@ -59,7 +59,7 @@ Make sure you test both enabled and disabled toggles. For example, if you added You have two options to target specificy Sourcegraph version. Add the below to your `override.yaml`: ```yaml -sourcegraph: +sourcegraph: image: defaultTag: "6.10.0" useGlobalTagAsDefault: true diff --git a/charts/sourcegraph-executor/dind/README.md b/charts/sourcegraph-executor/dind/README.md index 71555791..b6f5f8a8 100644 --- a/charts/sourcegraph-executor/dind/README.md +++ b/charts/sourcegraph-executor/dind/README.md @@ -79,6 +79,7 @@ In addition to the documented values, the `executor` and `private-docker-registr | sourcegraph.nodeSelector | object | `{}` | NodeSelector, learn more from the [Kubernetes documentation](https://kubernetes.io/docs/concepts/configuration/assign-pod-node/#nodeselector) | | sourcegraph.podAnnotations | object | `{}` | Add extra annotations to attach to all pods | | 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 | diff --git a/charts/sourcegraph-executor/dind/templates/executor/executor.Deployment.yaml b/charts/sourcegraph-executor/dind/templates/executor/executor.Deployment.yaml index 9570283d..557c264c 100644 --- a/charts/sourcegraph-executor/dind/templates/executor/executor.Deployment.yaml +++ b/charts/sourcegraph-executor/dind/templates/executor/executor.Deployment.yaml @@ -131,6 +131,9 @@ spec: {{- toYaml . | nindent 8 }} {{- end }} {{- with .Values.sourcegraph.tolerations }} + {{- if or .Values.executor.priorityClassName .Values.sourcegraph.priorityClassName }} + priorityClassName: {{ coalesce .Values.executor.priorityClassName .Values.sourcegraph.priorityClassName }} + {{- end }} tolerations: {{- toYaml . | nindent 8 }} {{- end }} diff --git a/charts/sourcegraph-executor/dind/templates/private-docker-registry/private-docker-registry.Deployment.yaml b/charts/sourcegraph-executor/dind/templates/private-docker-registry/private-docker-registry.Deployment.yaml index 257dae57..96f308c3 100644 --- a/charts/sourcegraph-executor/dind/templates/private-docker-registry/private-docker-registry.Deployment.yaml +++ b/charts/sourcegraph-executor/dind/templates/private-docker-registry/private-docker-registry.Deployment.yaml @@ -75,6 +75,9 @@ spec: {{- toYaml . | nindent 8 }} {{- end }} {{- with .Values.sourcegraph.tolerations }} + {{- if or .Values.privateDockerRegistry.priorityClassName .Values.sourcegraph.priorityClassName }} + priorityClassName: {{ coalesce .Values.privateDockerRegistry.priorityClassName .Values.sourcegraph.priorityClassName }} + {{- end }} tolerations: {{- toYaml . | nindent 8 }} {{- end }} diff --git a/charts/sourcegraph-executor/dind/values.yaml b/charts/sourcegraph-executor/dind/values.yaml index bd2c345d..eec0a03c 100644 --- a/charts/sourcegraph-executor/dind/values.yaml +++ b/charts/sourcegraph-executor/dind/values.yaml @@ -30,6 +30,8 @@ sourcegraph: podAnnotations: {} # -- Add extra labels to attach to all pods podLabels: {} + # -- Assign a priorityClass to all pods (daemonSets, deployments, and statefulSets) + priorityClassName: "" storageClass: diff --git a/charts/sourcegraph-executor/k8s/README.md b/charts/sourcegraph-executor/k8s/README.md index 4258c745..777c0bc8 100644 --- a/charts/sourcegraph-executor/k8s/README.md +++ b/charts/sourcegraph-executor/k8s/README.md @@ -60,16 +60,16 @@ In addition to the documented values, the `executor` and `private-docker-registr | executor.extraEnv | string | `nil` | Sets extra environment variables on the executor deployment. See `values.yaml` for the format. | | executor.frontendExistingSecret | string | `""` | Name of existing k8s Secret to use for frontend password The name of the secret must match `executor.name`, i.e., the name of the helm release used to deploy the helm chart. The k8s Secret must contain the key `EXECUTOR_FRONTEND_PASSWORD` matching the site config `executors.accessToken` value. `executor.frontendPassword` is ignored if this is enabled. | | executor.frontendPassword | string | `""` | The shared secret configured in the Sourcegraph instance site config under executors.accessToken. Required if `executor.frontendExistingSecret`` is not configured. | -| executor.frontendUrl | string | `""` | The external URL of the Sourcegraph instance. Required. **Recommended:** set to the internal service endpoint (e.g. `http://sourcegraph-frontend.sourcegraph.svc.cluster.local:30080` if Sourcegraph is deployed in the `sourcegraph` namespace). This will avoid unnecessary network charges as traffic will stay within the local network. | +| executor.frontendUrl | string | `""` | The external URL of the Sourcegraph instance. Required. **Recommended:** set to the internal service endpoint (e.g. `http://sourcegraph-frontend.sourcegraph.svc.cluster.local:30080` if Sourcegraph is deployed in the `sourcegraph` namespace). This will avoid unnecessary network charges as traffic will stay within the local network. | | executor.image.defaultTag | string | `"6.0.0@sha256:6dc771a0c281a41ef676213f2f84a63d99045cf2e58d43022554a8022070ed65"` | | | executor.image.name | string | `"executor-kubernetes"` | | | executor.kubeconfigPath | string | `""` | The path to the kubeconfig file. If not specified, the in-cluster config is used. | | executor.kubernetesJob.deadline | string | `"1200"` | The number of seconds after which a Kubernetes job will be terminated. | -| executor.kubernetesJob.fsGroup | string | `"1000"` | The group ID which is set on the job PVC file system. | -| executor.kubernetesJob.node.name | string | `""` | The name of the Kubernetes Node to create job pods on. If not specified, the pods are created on the first available node. | +| executor.kubernetesJob.fsGroup | string | `"1000"` | The group ID which is set on the job PVC file system. | +| executor.kubernetesJob.node.name | string | `""` | The name of the Kubernetes Node to create job pods on. If not specified, the pods are created on the first available node. | | executor.kubernetesJob.node.requiredAffinityMatchExpressions | string | `""` | The JSON encoded required affinity match expressions for Kubernetes Jobs. e.g. '[{\"key\":\"foo\",\"operator\":\"In\",\"values\":[\"bar\"]}]' | | executor.kubernetesJob.node.requiredAffinityMatchFields | string | `""` | The JSON encoded required affinity match fields for Kubernetes Jobs. e.g. '[{\"key\":\"foo\",\"operator\":\"In\",\"values\":[\"bar\"]}]' | -| executor.kubernetesJob.node.selector | string | `""` | A comma separated list of values to use as a node selector for Kubernetes Jobs. e.g. `foo=bar,app=my-app` | +| executor.kubernetesJob.node.selector | string | `""` | A comma separated list of values to use as a node selector for Kubernetes Jobs. e.g. `foo=bar,app=my-app` | | executor.kubernetesJob.node.tolerations | string | `""` | The JSON encoded tolerations for Kubernetes Jobs. e.g. '[{\"key\":\"foo\",\"operator\":\"Equal\",\"value\":\"bar\",\"effect\":\"NoSchedule\"}]' | | executor.kubernetesJob.pod.affinity | string | `""` | The JSON encoded pod affinity for Kubernetes Jobs. e.g. '[{\"labelSelector\": {\"matchExpressions\": [{\"key\": \"foo\",\"operator\": \"In\",\"values\": [\"bar\"]}]},\"topologyKey\": \"kubernetes.io/hostname\"}]' | | executor.kubernetesJob.pod.antiAffinity | string | `""` | The JSON encoded pod anti-affinity for Kubernetes Jobs. e.g. '[{\"labelSelector\": {\"matchExpressions\": [{\"key\": \"foo\",\"operator\": \"In\",\"values\": [\"bar\"]}]},\"topologyKey\": \"kubernetes.io/hostname\"}]' | @@ -108,6 +108,7 @@ In addition to the documented values, the `executor` and `private-docker-registr | sourcegraph.nodeSelector | object | `{}` | NodeSelector, learn more from the [Kubernetes documentation](https://kubernetes.io/docs/concepts/configuration/assign-pod-node/#nodeselector) | | sourcegraph.podAnnotations | object | `{}` | Add extra annotations to attach to all pods | | 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 | diff --git a/charts/sourcegraph-executor/k8s/templates/executor.Deployment.yaml b/charts/sourcegraph-executor/k8s/templates/executor.Deployment.yaml index dd33bdf9..e04e0213 100644 --- a/charts/sourcegraph-executor/k8s/templates/executor.Deployment.yaml +++ b/charts/sourcegraph-executor/k8s/templates/executor.Deployment.yaml @@ -100,6 +100,9 @@ spec: {{- toYaml . | nindent 8 }} {{- end }} {{- with .Values.executor.tolerations }} + {{- if or .Values.executor.priorityClassName .Values.sourcegraph.priorityClassName }} + priorityClassName: {{ coalesce .Values.executor.priorityClassName .Values.sourcegraph.priorityClassName }} + {{- end }} tolerations: {{- toYaml . | nindent 8 }} {{- end }} diff --git a/charts/sourcegraph-executor/k8s/values.yaml b/charts/sourcegraph-executor/k8s/values.yaml index 11af2cb4..730df98e 100644 --- a/charts/sourcegraph-executor/k8s/values.yaml +++ b/charts/sourcegraph-executor/k8s/values.yaml @@ -32,6 +32,8 @@ sourcegraph: podAnnotations: { } # -- Add extra labels to attach to all pods podLabels: { } + # -- Assign a priorityClass to all pods (daemonSets, deployments, and statefulSets) + priorityClassName: "" storageClass: @@ -68,7 +70,7 @@ executor: requests: cpu: 500m memory: 200Mi - # -- The external URL of the Sourcegraph instance. Required. **Recommended:** set to the internal service endpoint (e.g. `http://sourcegraph-frontend.sourcegraph.svc.cluster.local:30080` if Sourcegraph is deployed in the `sourcegraph` namespace). + # -- The external URL of the Sourcegraph instance. Required. **Recommended:** set to the internal service endpoint (e.g. `http://sourcegraph-frontend.sourcegraph.svc.cluster.local:30080` if Sourcegraph is deployed in the `sourcegraph` namespace). # This will avoid unnecessary network charges as traffic will stay within the local network. frontendUrl: "" # -- Name of existing k8s Secret to use for frontend password @@ -86,13 +88,13 @@ executor: maximumNumJobs: 10 # - The maximum wall time that can be spent on a single job. maximumRuntimePerJob: "30m" - + log: # -- Possible values are `dbug`, `info`, `warn`, `eror`, `crit`. level: "warn" 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. @@ -102,24 +104,24 @@ executor: # -- The containerSecurityContext for the executor image securityContext: # @default -- nil; accepts [0, 2147483647] - runAsUser: + runAsUser: # @default -- nil; accepts [0, 2147483647] - runAsGroup: + runAsGroup: # @default -- nil; accepts [0, 2147483647] fsGroup: # @default -- false; accepts [true, false] privileged: false - + kubernetesJob: # -- The number of seconds after which a Kubernetes job will be terminated. deadline: "1200" # -- (int) The user ID to run Kubernetes jobs as. # @default -- `nil`; accepts [0, 2147483647] - runAsUser: + runAsUser: # -- (int) The group ID to run Kubernetes jobs as. # @default -- `nil`; accepts [0, 2147483647] - runAsGroup: - # -- The group ID which is set on the job PVC file system. + runAsGroup: + # -- The group ID which is set on the job PVC file system. fsGroup: "1000" resources: requests: @@ -132,11 +134,11 @@ executor: cpu: "" # -- The maximum memory for a job. memory: "12Gi" - + node: - # -- The name of the Kubernetes Node to create job pods on. If not specified, the pods are created on the first available node. + # -- The name of the Kubernetes Node to create job pods on. If not specified, the pods are created on the first available node. name: "" - # -- A comma separated list of values to use as a node selector for Kubernetes Jobs. e.g. `foo=bar,app=my-app` + # -- A comma separated list of values to use as a node selector for Kubernetes Jobs. e.g. `foo=bar,app=my-app` selector: "" # -- The JSON encoded tolerations for Kubernetes Jobs. e.g. '[{\"key\":\"foo\",\"operator\":\"Equal\",\"value\":\"bar\",\"effect\":\"NoSchedule\"}]' tolerations: "" @@ -150,28 +152,28 @@ executor: affinity: "" # -- The JSON encoded pod anti-affinity for Kubernetes Jobs. e.g. '[{\"labelSelector\": {\"matchExpressions\": [{\"key\": \"foo\",\"operator\": \"In\",\"values\": [\"bar\"]}]},\"topologyKey\": \"kubernetes.io/hostname\"}]' antiAffinity: "" - + debug: # -- If true, Kubernetes jobs will not be deleted after they complete. Not recommended for production use as it can hit cluster limits. keepJobs: "false" keepWorkspaces: "false" - + # -- Affinity, # learn more from the [Kubernetes documentation](https://kubernetes.io/docs/concepts/scheduling-eviction/assign-pod-node/#affinity-and-anti-affinity) affinity: { } - + # -- NodeSelector, # learn more from the [Kubernetes documentation](https://kubernetes.io/docs/concepts/configuration/assign-pod-node/#nodeselector) nodeSelector: { } - + # -- Tolerations, # learn more from the [Kubernetes documentation](https://kubernetes.io/docs/concepts/scheduling-eviction/taint-and-toleration/) tolerations: [ ] - + # -- Sets extra environment variables on the executor deployment. See `values.yaml` for the format. extraEnv: # - name: MY_ENV # value: my_value - + # -- For local deployments the host is 'host.docker.internal' and this needs to be true dockerAddHostGateway: "false" diff --git a/charts/sourcegraph-migrator/README.md b/charts/sourcegraph-migrator/README.md index cad56823..d7ef768d 100644 --- a/charts/sourcegraph-migrator/README.md +++ b/charts/sourcegraph-migrator/README.md @@ -96,6 +96,7 @@ In addition to the documented values, the `migrator` service also supports the f | sourcegraph.nodeSelector | object | `{}` | NodeSelector, learn more from the [Kubernetes documentation](https://kubernetes.io/docs/concepts/configuration/assign-pod-node/#nodeselector) | | sourcegraph.podAnnotations | object | `{}` | Add extra annotations to attach to all pods | | 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/) | ## Troubleshooting diff --git a/charts/sourcegraph-migrator/templates/migrator/sourcegraph-migrator.Job.yaml b/charts/sourcegraph-migrator/templates/migrator/sourcegraph-migrator.Job.yaml index 9c06be82..35110123 100644 --- a/charts/sourcegraph-migrator/templates/migrator/sourcegraph-migrator.Job.yaml +++ b/charts/sourcegraph-migrator/templates/migrator/sourcegraph-migrator.Job.yaml @@ -69,6 +69,9 @@ spec: {{- toYaml . | nindent 8 }} {{- end }} {{- with .Values.sourcegraph.tolerations }} + {{- if or .Values.migrator.priorityClassName .Values.sourcegraph.priorityClassName }} + priorityClassName: {{ coalesce .Values.migrator.priorityClassName .Values.sourcegraph.priorityClassName }} + {{- end }} tolerations: {{- toYaml . | nindent 8 }} {{- end }} diff --git a/charts/sourcegraph-migrator/values.yaml b/charts/sourcegraph-migrator/values.yaml index 20f30df7..bb144176 100644 --- a/charts/sourcegraph-migrator/values.yaml +++ b/charts/sourcegraph-migrator/values.yaml @@ -30,6 +30,8 @@ sourcegraph: podAnnotations: {} # -- Add extra labels to attach to all pods podLabels: {} + # -- Assign a priorityClass to all pods (daemonSets, deployments, and statefulSets) + priorityClassName: "" # Generic application configuration options, used by most applications below diff --git a/charts/sourcegraph/README.md b/charts/sourcegraph/README.md index b30d4d0d..986d573d 100644 --- a/charts/sourcegraph/README.md +++ b/charts/sourcegraph/README.md @@ -315,6 +315,7 @@ In addition to the documented values, all services also support the following va | sourcegraph.nodeSelector | object | `{}` | Global NodeSelector, learn more from the [Kubernetes documentation](https://kubernetes.io/docs/concepts/configuration/assign-pod-node/#nodeselector) | | sourcegraph.podAnnotations | object | `{}` | Add extra annotations to attach to all pods | | 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.revisionHistoryLimit | int | `10` | Global deployment clean up policy, learn more from the [Kubernetes documentation](https://kubernetes.io/docs/concepts/workloads/controllers/deployment/#clean-up-policy) | | sourcegraph.serviceLabels | object | `{}` | Add extra labels to all services | | sourcegraph.tolerations | list | `[]` | Global Tolerations, learn more from the [Kubernetes documentation](https://kubernetes.io/docs/concepts/scheduling-eviction/taint-and-toleration/) | diff --git a/charts/sourcegraph/templates/_worker.tpl b/charts/sourcegraph/templates/_worker.tpl index 73c4b64a..632d0e3b 100644 --- a/charts/sourcegraph/templates/_worker.tpl +++ b/charts/sourcegraph/templates/_worker.tpl @@ -131,6 +131,9 @@ spec: {{- if $top.Values.worker.extraContainers }} {{- toYaml $top.Values.worker.extraContainers | nindent 6 }} {{- end }} + {{- if or $top.Values.worker.priorityClassName $top.Values.sourcegraph.priorityClassName }} + priorityClassName: {{ coalesce $top.Values.worker.priorityClassName $top.Values.sourcegraph.priorityClassName }} + {{- end }} securityContext: {{- toYaml $top.Values.worker.podSecurityContext | nindent 8 }} {{- include "sourcegraph.nodeSelector" (list $top "worker" ) | trim | nindent 6 }} diff --git a/charts/sourcegraph/templates/blobstore/blobstore.Deployment.yaml b/charts/sourcegraph/templates/blobstore/blobstore.Deployment.yaml index 08c87d9d..a5ed02ea 100644 --- a/charts/sourcegraph/templates/blobstore/blobstore.Deployment.yaml +++ b/charts/sourcegraph/templates/blobstore/blobstore.Deployment.yaml @@ -88,6 +88,9 @@ spec: {{- if .Values.blobstore.extraContainers }} {{- toYaml .Values.blobstore.extraContainers | nindent 6 }} {{- end }} + {{- if or .Values.blobstore.priorityClassName .Values.sourcegraph.priorityClassName }} + priorityClassName: {{ coalesce .Values.blobstore.priorityClassName .Values.sourcegraph.priorityClassName }} + {{- end }} securityContext: {{- toYaml .Values.blobstore.podSecurityContext | nindent 8 }} {{- include "sourcegraph.nodeSelector" (list . "blobstore" ) | trim | nindent 6 }} diff --git a/charts/sourcegraph/templates/cadvisor/cadvisor.DaemonSet.yaml b/charts/sourcegraph/templates/cadvisor/cadvisor.DaemonSet.yaml index 40508fc6..2ce45386 100644 --- a/charts/sourcegraph/templates/cadvisor/cadvisor.DaemonSet.yaml +++ b/charts/sourcegraph/templates/cadvisor/cadvisor.DaemonSet.yaml @@ -95,6 +95,9 @@ spec: containerPort: 48080 protocol: TCP automountServiceAccountToken: false + {{- if or .Values.cadvisor.priorityClassName .Values.sourcegraph.priorityClassName }} + priorityClassName: {{ coalesce .Values.cadvisor.priorityClassName .Values.sourcegraph.priorityClassName }} + {{- end }} terminationGracePeriodSeconds: 30 {{- if .Values.cadvisor.extraContainers }} {{- toYaml .Values.cadvisor.extraContainers | nindent 6 }} diff --git a/charts/sourcegraph/templates/codeinsights-db/codeinsights-db.StatefulSet.yaml b/charts/sourcegraph/templates/codeinsights-db/codeinsights-db.StatefulSet.yaml index d56a02a8..b6a6d4b6 100644 --- a/charts/sourcegraph/templates/codeinsights-db/codeinsights-db.StatefulSet.yaml +++ b/charts/sourcegraph/templates/codeinsights-db/codeinsights-db.StatefulSet.yaml @@ -120,6 +120,9 @@ spec: {{- if .Values.codeInsightsDB.extraContainers }} {{- toYaml .Values.codeInsightsDB.extraContainers | nindent 6 }} {{- end }} + {{- if or .Values.codeInsightsDB.priorityClassName .Values.sourcegraph.priorityClassName }} + priorityClassName: {{ coalesce .Values.codeInsightsDB.priorityClassName .Values.sourcegraph.priorityClassName }} + {{- end }} securityContext: {{- toYaml .Values.codeInsightsDB.podSecurityContext | nindent 8 }} {{- include "sourcegraph.nodeSelector" (list . "codeInsightsDB" ) | trim | nindent 6 }} diff --git a/charts/sourcegraph/templates/codeintel-db/codeintel-db.StatefulSet.yaml b/charts/sourcegraph/templates/codeintel-db/codeintel-db.StatefulSet.yaml index accb0b3f..3b4f6728 100644 --- a/charts/sourcegraph/templates/codeintel-db/codeintel-db.StatefulSet.yaml +++ b/charts/sourcegraph/templates/codeintel-db/codeintel-db.StatefulSet.yaml @@ -131,6 +131,9 @@ spec: securityContext: {{- toYaml .Values.postgresExporter.containerSecurityContext | nindent 10 }} terminationMessagePolicy: FallbackToLogsOnError + {{- if or .Values.codeIntelDB.priorityClassName .Values.sourcegraph.priorityClassName }} + priorityClassName: {{ coalesce .Values.codeIntelDB.priorityClassName .Values.sourcegraph.priorityClassName }} + {{- end }} terminationGracePeriodSeconds: 120 securityContext: {{- toYaml .Values.codeIntelDB.podSecurityContext | nindent 8 }} diff --git a/charts/sourcegraph/templates/frontend/sourcegraph-frontend.Deployment.yaml b/charts/sourcegraph/templates/frontend/sourcegraph-frontend.Deployment.yaml index dd8f31a7..4ec55b00 100644 --- a/charts/sourcegraph/templates/frontend/sourcegraph-frontend.Deployment.yaml +++ b/charts/sourcegraph/templates/frontend/sourcegraph-frontend.Deployment.yaml @@ -140,6 +140,9 @@ spec: {{- if .Values.frontend.extraContainers }} {{- toYaml .Values.frontend.extraContainers | nindent 6 }} {{- end }} + {{- if or .Values.frontend.priorityClassName .Values.sourcegraph.priorityClassName }} + priorityClassName: {{ coalesce .Values.frontend.priorityClassName .Values.sourcegraph.priorityClassName }} + {{- end }} securityContext: {{- toYaml .Values.frontend.podSecurityContext | nindent 8 }} {{- include "sourcegraph.nodeSelector" (list . "frontend" ) | trim | nindent 6 }} diff --git a/charts/sourcegraph/templates/gitserver/gitserver.StatefulSet.yaml b/charts/sourcegraph/templates/gitserver/gitserver.StatefulSet.yaml index 9620df24..5d69c278 100644 --- a/charts/sourcegraph/templates/gitserver/gitserver.StatefulSet.yaml +++ b/charts/sourcegraph/templates/gitserver/gitserver.StatefulSet.yaml @@ -118,8 +118,8 @@ spec: {{- if .Values.gitserver.extraVolumes }} {{- toYaml .Values.gitserver.extraVolumes | nindent 6 }} {{- end }} - {{- if .Values.gitserver.priorityClassName }} - priorityClassName: {{ .Values.gitserver.priorityClassName }} + {{- if or .Values.gitserver.priorityClassName .Values.sourcegraph.priorityClassName }} + priorityClassName: {{ coalesce .Values.gitserver.priorityClassName .Values.sourcegraph.priorityClassName }} {{- end }} updateStrategy: type: RollingUpdate diff --git a/charts/sourcegraph/templates/grafana/grafana.StatefulSet.yaml b/charts/sourcegraph/templates/grafana/grafana.StatefulSet.yaml index da569d02..41ef6334 100644 --- a/charts/sourcegraph/templates/grafana/grafana.StatefulSet.yaml +++ b/charts/sourcegraph/templates/grafana/grafana.StatefulSet.yaml @@ -84,6 +84,9 @@ spec: {{- if .Values.grafana.extraContainers }} {{- toYaml .Values.grafana.extraContainers | nindent 6 }} {{- end }} + {{- if or .Values.grafana.priorityClassName .Values.sourcegraph.priorityClassName }} + priorityClassName: {{ coalesce .Values.grafana.priorityClassName .Values.sourcegraph.priorityClassName }} + {{- end }} securityContext: {{- toYaml .Values.grafana.podSecurityContext | nindent 8 }} {{- include "sourcegraph.nodeSelector" (list . "grafana" ) | trim | nindent 6 }} diff --git a/charts/sourcegraph/templates/indexed-search/indexed-search.StatefulSet.yaml b/charts/sourcegraph/templates/indexed-search/indexed-search.StatefulSet.yaml index cd2df9c9..a3a346f2 100644 --- a/charts/sourcegraph/templates/indexed-search/indexed-search.StatefulSet.yaml +++ b/charts/sourcegraph/templates/indexed-search/indexed-search.StatefulSet.yaml @@ -115,6 +115,9 @@ spec: {{- if .Values.indexedSearch.extraContainers }} {{- toYaml .Values.indexedSearch.extraContainers | nindent 6 }} {{- end }} + {{- if or .Values.indexedSearch.priorityClassName .Values.sourcegraph.priorityClassName }} + priorityClassName: {{ coalesce .Values.indexedSearch.priorityClassName .Values.sourcegraph.priorityClassName }} + {{- end }} securityContext: {{- toYaml .Values.indexedSearch.podSecurityContext | nindent 8 }} {{- include "sourcegraph.nodeSelector" (list . "indexedSearch" ) | trim | nindent 6 }} @@ -130,9 +133,6 @@ spec: {{- if .Values.indexedSearch.extraVolumes }} {{- toYaml .Values.indexedSearch.extraVolumes | nindent 6 }} {{- end }} - {{- if .Values.indexedSearch.priorityClassName }} - priorityClassName: {{ .Values.indexedSearch.priorityClassName }} - {{- end }} updateStrategy: type: RollingUpdate volumeClaimTemplates: diff --git a/charts/sourcegraph/templates/jaeger/jaeger.Deployment.yaml b/charts/sourcegraph/templates/jaeger/jaeger.Deployment.yaml index 39a766da..a2856660 100644 --- a/charts/sourcegraph/templates/jaeger/jaeger.Deployment.yaml +++ b/charts/sourcegraph/templates/jaeger/jaeger.Deployment.yaml @@ -97,6 +97,9 @@ spec: {{- if .Values.jaeger.extraContainers }} {{- toYaml .Values.jaeger.extraContainers | nindent 6 }} {{- end }} + {{- if or .Values.jaeger.priorityClassName .Values.sourcegraph.priorityClassName }} + priorityClassName: {{ coalesce .Values.jaeger.priorityClassName .Values.sourcegraph.priorityClassName }} + {{- end }} securityContext: {{- toYaml .Values.jaeger.podSecurityContext | nindent 8 }} {{- include "sourcegraph.nodeSelector" (list . "jaeger" ) | trim | nindent 6 }} diff --git a/charts/sourcegraph/templates/node-exporter/node-exporter.DaemonSet.yaml b/charts/sourcegraph/templates/node-exporter/node-exporter.DaemonSet.yaml index 078f1bdf..8b8bb7b7 100644 --- a/charts/sourcegraph/templates/node-exporter/node-exporter.DaemonSet.yaml +++ b/charts/sourcegraph/templates/node-exporter/node-exporter.DaemonSet.yaml @@ -112,6 +112,9 @@ spec: timeoutSeconds: 1 terminationMessagePolicy: FallbackToLogsOnError automountServiceAccountToken: false + {{- if or .Values.nodeExporter.priorityClassName .Values.sourcegraph.priorityClassName }} + priorityClassName: {{ coalesce .Values.nodeExporter.priorityClassName .Values.sourcegraph.priorityClassName }} + {{- end }} terminationGracePeriodSeconds: 30 {{- if .Values.nodeExporter.extraContainers }} {{- toYaml .Values.nodeExporter.extraContainers | nindent 6 }} diff --git a/charts/sourcegraph/templates/otel-collector/otel-agent.DaemonSet.yaml b/charts/sourcegraph/templates/otel-collector/otel-agent.DaemonSet.yaml index 3efd5b1c..658a56ed 100644 --- a/charts/sourcegraph/templates/otel-collector/otel-agent.DaemonSet.yaml +++ b/charts/sourcegraph/templates/otel-collector/otel-agent.DaemonSet.yaml @@ -81,6 +81,9 @@ spec: volumeMounts: - name: config mountPath: /etc/otel-agent + {{- if or .Values.openTelemetry.agent.priorityClassName .Values.sourcegraph.priorityClassName }} + priorityClassName: {{ coalesce .Values.openTelemetry.agent.priorityClassName .Values.sourcegraph.priorityClassName }} + {{- end }} terminationGracePeriodSeconds: 120 {{- include "sourcegraph.nodeSelector" (list . "openTelemetry" ) | trim | nindent 6 }} {{- include "sourcegraph.affinity" (list . "openTelemetry" ) | trim | nindent 6 }} diff --git a/charts/sourcegraph/templates/otel-collector/otel-collector.Deployment.yaml b/charts/sourcegraph/templates/otel-collector/otel-collector.Deployment.yaml index 47896c1b..8aac53a3 100644 --- a/charts/sourcegraph/templates/otel-collector/otel-collector.Deployment.yaml +++ b/charts/sourcegraph/templates/otel-collector/otel-collector.Deployment.yaml @@ -102,6 +102,9 @@ spec: - name: otel-collector-tls mountPath: /tls {{- end }} + {{- if or .Values.openTelemetry.gateway.priorityClassName .Values.sourcegraph.priorityClassName }} + priorityClassName: {{ coalesce .Values.openTelemetry.gateway.priorityClassName .Values.sourcegraph.priorityClassName }} + {{- end }} terminationGracePeriodSeconds: 120 {{- include "sourcegraph.nodeSelector" (list . "openTelemetry" ) | trim | nindent 6 }} {{- include "sourcegraph.affinity" (list . "openTelemetry" ) | trim | nindent 6 }} diff --git a/charts/sourcegraph/templates/pgsql/pgsql.StatefulSet.yaml b/charts/sourcegraph/templates/pgsql/pgsql.StatefulSet.yaml index 2e6727af..8c3765b1 100644 --- a/charts/sourcegraph/templates/pgsql/pgsql.StatefulSet.yaml +++ b/charts/sourcegraph/templates/pgsql/pgsql.StatefulSet.yaml @@ -133,6 +133,9 @@ spec: securityContext: {{- toYaml .Values.postgresExporter.containerSecurityContext | nindent 10 }} terminationMessagePolicy: FallbackToLogsOnError + {{- if or .Values.pgsql.priorityClassName .Values.sourcegraph.priorityClassName }} + priorityClassName: {{ coalesce .Values.pgsql.priorityClassName .Values.sourcegraph.priorityClassName }} + {{- end }} terminationGracePeriodSeconds: 120 securityContext: {{- toYaml .Values.pgsql.podSecurityContext | nindent 8 }} diff --git a/charts/sourcegraph/templates/precise-code-intel/worker.Deployment.yaml b/charts/sourcegraph/templates/precise-code-intel/worker.Deployment.yaml index 18cba342..8e15e7d0 100644 --- a/charts/sourcegraph/templates/precise-code-intel/worker.Deployment.yaml +++ b/charts/sourcegraph/templates/precise-code-intel/worker.Deployment.yaml @@ -104,6 +104,9 @@ spec: {{- if .Values.preciseCodeIntel.extraContainers }} {{- toYaml .Values.preciseCodeIntel.extraContainers | nindent 6 }} {{- end }} + {{- if or .Values.preciseCodeIntel.priorityClassName .Values.sourcegraph.priorityClassName }} + priorityClassName: {{ coalesce .Values.preciseCodeIntel.priorityClassName .Values.sourcegraph.priorityClassName }} + {{- end }} securityContext: {{- toYaml .Values.preciseCodeIntel.podSecurityContext | nindent 8 }} {{- include "sourcegraph.nodeSelector" (list . "preciseCodeIntel" ) | trim | nindent 6 }} diff --git a/charts/sourcegraph/templates/prometheus/prometheus.Deployment.yaml b/charts/sourcegraph/templates/prometheus/prometheus.Deployment.yaml index c35fa2d2..8392afde 100644 --- a/charts/sourcegraph/templates/prometheus/prometheus.Deployment.yaml +++ b/charts/sourcegraph/templates/prometheus/prometheus.Deployment.yaml @@ -85,6 +85,9 @@ spec: {{- if .Values.prometheus.extraContainers }} {{- toYaml .Values.prometheus.extraContainers | nindent 6 }} {{- end }} + {{- if or .Values.prometheus.priorityClassName .Values.sourcegraph.priorityClassName }} + priorityClassName: {{ coalesce .Values.prometheus.priorityClassName .Values.sourcegraph.priorityClassName }} + {{- end }} securityContext: {{- toYaml .Values.prometheus.podSecurityContext | nindent 8 }} {{- include "sourcegraph.nodeSelector" (list . "prometheus" ) | trim | nindent 6 }} diff --git a/charts/sourcegraph/templates/redis/redis-cache.Deployment.yaml b/charts/sourcegraph/templates/redis/redis-cache.Deployment.yaml index fc00f487..d9ce1d76 100644 --- a/charts/sourcegraph/templates/redis/redis-cache.Deployment.yaml +++ b/charts/sourcegraph/templates/redis/redis-cache.Deployment.yaml @@ -131,8 +131,8 @@ spec: {{- toYaml . | nindent 8 }} {{- end }} {{- include "sourcegraph.renderServiceAccountName" (list . "redisCache") | trim | nindent 6 }} - {{- if .Values.redisCache.priorityClassName }} - priorityClassName: {{ .Values.redisCache.priorityClassName }} + {{- if or .Values.redisCache.priorityClassName .Values.sourcegraph.priorityClassName }} + priorityClassName: {{ coalesce .Values.redisCache.priorityClassName .Values.sourcegraph.priorityClassName }} {{- end }} volumes: - name: redis-data diff --git a/charts/sourcegraph/templates/redis/redis-store.Deployment.yaml b/charts/sourcegraph/templates/redis/redis-store.Deployment.yaml index d1697741..afc9c267 100644 --- a/charts/sourcegraph/templates/redis/redis-store.Deployment.yaml +++ b/charts/sourcegraph/templates/redis/redis-store.Deployment.yaml @@ -130,8 +130,8 @@ spec: {{- toYaml . | nindent 8 }} {{- end }} {{- include "sourcegraph.renderServiceAccountName" (list . "redisStore") | trim | nindent 6 }} - {{- if .Values.redisStore.priorityClassName }} - priorityClassName: {{ .Values.redisStore.priorityClassName }} + {{- if or .Values.redisStore.priorityClassName .Values.sourcegraph.priorityClassName }} + priorityClassName: {{ coalesce .Values.redisStore.priorityClassName .Values.sourcegraph.priorityClassName }} {{- end }} volumes: - name: redis-data diff --git a/charts/sourcegraph/templates/searcher/searcher.StatefulSet.yaml b/charts/sourcegraph/templates/searcher/searcher.StatefulSet.yaml index 6770c804..df2442f8 100644 --- a/charts/sourcegraph/templates/searcher/searcher.StatefulSet.yaml +++ b/charts/sourcegraph/templates/searcher/searcher.StatefulSet.yaml @@ -131,8 +131,8 @@ spec: {{- if .Values.searcher.extraVolumes }} {{- toYaml .Values.searcher.extraVolumes | nindent 6 }} {{- end }} - {{- if .Values.searcher.priorityClassName }} - priorityClassName: {{ .Values.searcher.priorityClassName }} + {{- if or .Values.searcher.priorityClassName .Values.sourcegraph.priorityClassName }} + priorityClassName: {{ coalesce .Values.searcher.priorityClassName .Values.sourcegraph.priorityClassName }} {{- end }} volumeClaimTemplates: - metadata: diff --git a/charts/sourcegraph/templates/syntactic-code-intel/worker.Deployment.yaml b/charts/sourcegraph/templates/syntactic-code-intel/worker.Deployment.yaml index a32afdaf..b01dd60e 100644 --- a/charts/sourcegraph/templates/syntactic-code-intel/worker.Deployment.yaml +++ b/charts/sourcegraph/templates/syntactic-code-intel/worker.Deployment.yaml @@ -107,6 +107,9 @@ spec: {{- if .Values.syntacticCodeIntel.extraContainers }} {{- toYaml .Values.syntacticCodeIntel.extraContainers | nindent 6 }} {{- end }} + {{- if or .Values.syntacticCodeIntel.priorityClassName .Values.sourcegraph.priorityClassName }} + priorityClassName: {{ coalesce .Values.syntacticCodeIntel.priorityClassName .Values.sourcegraph.priorityClassName }} + {{- end }} securityContext: {{- toYaml .Values.syntacticCodeIntel.podSecurityContext | nindent 8 }} {{- include "sourcegraph.nodeSelector" (list . "syntacticCodeIntel" ) | trim | nindent 6 }} diff --git a/charts/sourcegraph/templates/syntect-server/syntect-server.Deployment.yaml b/charts/sourcegraph/templates/syntect-server/syntect-server.Deployment.yaml index 7d6e0712..258aea6d 100644 --- a/charts/sourcegraph/templates/syntect-server/syntect-server.Deployment.yaml +++ b/charts/sourcegraph/templates/syntect-server/syntect-server.Deployment.yaml @@ -87,6 +87,9 @@ spec: {{- if .Values.syntectServer.extraContainers }} {{- toYaml .Values.syntectServer.extraContainers | nindent 6 }} {{- end }} + {{- if or .Values.syntectServer.priorityClassName .Values.sourcegraph.priorityClassName }} + priorityClassName: {{ coalesce .Values.syntectServer.priorityClassName .Values.sourcegraph.priorityClassName }} + {{- end }} securityContext: {{- toYaml .Values.syntectServer.podSecurityContext | nindent 8 }} {{- include "sourcegraph.nodeSelector" (list . "syntectServer" ) | trim | nindent 6 }} diff --git a/charts/sourcegraph/values.yaml b/charts/sourcegraph/values.yaml index f11ca539..78ed3246 100644 --- a/charts/sourcegraph/values.yaml +++ b/charts/sourcegraph/values.yaml @@ -33,6 +33,8 @@ sourcegraph: podAnnotations: {} # -- Add extra labels to attach to all pods podLabels: {} + # -- Assign a priorityClass to all pods (daemonSets, deployments, and statefulSets) + priorityClassName: "" # -- Global deployment clean up policy, # learn more from the [Kubernetes documentation](https://kubernetes.io/docs/concepts/workloads/controllers/deployment/#clean-up-policy) revisionHistoryLimit: 10