From 858db21c623f0863359b411b14e03415288c7e49 Mon Sep 17 00:00:00 2001 From: Marc LeBlanc Date: Fri, 5 Dec 2025 19:21:52 -0700 Subject: [PATCH 1/5] 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 From c7f78ab7c08783c4d1aa6b7cca66c3bbc1d4ad47 Mon Sep 17 00:00:00 2001 From: Marc LeBlanc Date: Sun, 14 Dec 2025 22:54:22 -0700 Subject: [PATCH 2/5] Move priorityClassName to a helper function --- .../templates/_helpers/_priorityClassName.tpl | 20 +++++++++++++++++++ charts/sourcegraph/templates/_worker.tpl | 4 +--- .../blobstore/blobstore.Deployment.yaml | 4 +--- .../cadvisor/cadvisor.DaemonSet.yaml | 4 +--- .../codeinsights-db.StatefulSet.yaml | 4 +--- .../codeintel-db.StatefulSet.yaml | 4 +--- .../sourcegraph-frontend.Deployment.yaml | 6 ++---- .../gitserver/gitserver.StatefulSet.yaml | 4 +--- .../grafana/grafana.StatefulSet.yaml | 4 +--- .../indexed-search.StatefulSet.yaml | 4 +--- .../templates/jaeger/jaeger.Deployment.yaml | 4 +--- .../node-exporter.DaemonSet.yaml | 4 +--- .../otel-collector/otel-agent.DaemonSet.yaml | 4 +--- .../otel-collector.Deployment.yaml | 4 +--- .../templates/pgsql/pgsql.StatefulSet.yaml | 4 +--- .../precise-code-intel/worker.Deployment.yaml | 4 +--- .../prometheus/prometheus.Deployment.yaml | 4 +--- .../redis/redis-cache.Deployment.yaml | 4 +--- .../redis/redis-store.Deployment.yaml | 4 +--- .../searcher/searcher.StatefulSet.yaml | 4 +--- .../worker.Deployment.yaml | 4 +--- .../syntect-server.Deployment.yaml | 4 +--- 22 files changed, 42 insertions(+), 64 deletions(-) create mode 100644 charts/sourcegraph/templates/_helpers/_priorityClassName.tpl diff --git a/charts/sourcegraph/templates/_helpers/_priorityClassName.tpl b/charts/sourcegraph/templates/_helpers/_priorityClassName.tpl new file mode 100644 index 00000000..599e6d3b --- /dev/null +++ b/charts/sourcegraph/templates/_helpers/_priorityClassName.tpl @@ -0,0 +1,20 @@ +{{/* + +Allow customers to assign a priorityClassName to all resources which create pods (ex. DaemonSets, Deployments, StatefulSets) + +Customers can configure an instance-wide default priorty class name at .Values.sourcegraph.priorityClassName, +and can override it for individual services, if needed, at .Values..priorityClassName + +*/}} + +{{- define "sourcegraph.priorityClassName" -}} +{{- $top := index . 0 }} +{{- $service := index . 1 }} +{{- $globalPriorityClassName := (index $top.Values "sourcegraph" "priorityClassName") }} +{{- $servicePriorityClassName := (index $top.Values $service "priorityClassName") }} +{{- if $servicePriorityClassName }} +priorityClassName: {{- $servicePriorityClassName | toYaml | trim }} +{{- else if $globalPriorityClassName }} +priorityClassName: {{- $globalPriorityClassName | toYaml | trim }} +{{- end }} +{{- end }} diff --git a/charts/sourcegraph/templates/_worker.tpl b/charts/sourcegraph/templates/_worker.tpl index 632d0e3b..0e59c911 100644 --- a/charts/sourcegraph/templates/_worker.tpl +++ b/charts/sourcegraph/templates/_worker.tpl @@ -131,9 +131,7 @@ 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 }} + {{- include "sourcegraph.priorityClassName" (list . "worker" ) | trim | nindent 6 }} 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 a5ed02ea..8a206b8c 100644 --- a/charts/sourcegraph/templates/blobstore/blobstore.Deployment.yaml +++ b/charts/sourcegraph/templates/blobstore/blobstore.Deployment.yaml @@ -88,13 +88,11 @@ 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 }} {{- include "sourcegraph.affinity" (list . "blobstore" ) | trim | nindent 6 }} + {{- include "sourcegraph.priorityClassName" (list . "blobstore" ) | trim | nindent 6 }} {{- include "sourcegraph.tolerations" (list . "blobstore" ) | trim | nindent 6 }} {{- with .Values.sourcegraph.imagePullSecrets }} imagePullSecrets: diff --git a/charts/sourcegraph/templates/cadvisor/cadvisor.DaemonSet.yaml b/charts/sourcegraph/templates/cadvisor/cadvisor.DaemonSet.yaml index d0f26ee8..af36d3be 100644 --- a/charts/sourcegraph/templates/cadvisor/cadvisor.DaemonSet.yaml +++ b/charts/sourcegraph/templates/cadvisor/cadvisor.DaemonSet.yaml @@ -98,14 +98,12 @@ spec: {{- toYaml .Values.cadvisor.extraContainers | nindent 6 }} {{- end }} automountServiceAccountToken: false - {{- if or .Values.cadvisor.priorityClassName .Values.sourcegraph.priorityClassName }} - priorityClassName: {{ coalesce .Values.cadvisor.priorityClassName .Values.sourcegraph.priorityClassName }} - {{- end }} terminationGracePeriodSeconds: 30 securityContext: {{- toYaml .Values.cadvisor.podSecurityContext | nindent 8 }} {{- include "sourcegraph.nodeSelector" (list . "cadvisor" ) | trim | nindent 6 }} {{- include "sourcegraph.affinity" (list . "cadvisor" ) | trim | nindent 6 }} + {{- include "sourcegraph.priorityClassName" (list . "cadvisor" ) | trim | nindent 6 }} {{- include "sourcegraph.tolerations" (list . "cadvisor" ) | trim | nindent 6 }} {{- with .Values.sourcegraph.imagePullSecrets }} imagePullSecrets: diff --git a/charts/sourcegraph/templates/codeinsights-db/codeinsights-db.StatefulSet.yaml b/charts/sourcegraph/templates/codeinsights-db/codeinsights-db.StatefulSet.yaml index b6a6d4b6..190425dd 100644 --- a/charts/sourcegraph/templates/codeinsights-db/codeinsights-db.StatefulSet.yaml +++ b/charts/sourcegraph/templates/codeinsights-db/codeinsights-db.StatefulSet.yaml @@ -120,13 +120,11 @@ 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 }} {{- include "sourcegraph.affinity" (list . "codeInsightsDB" ) | trim | nindent 6 }} + {{- include "sourcegraph.priorityClassName" (list . "codeInsightsDB" ) | trim | nindent 6 }} {{- include "sourcegraph.tolerations" (list . "codeInsightsDB" ) | trim | nindent 6 }} {{- with .Values.sourcegraph.imagePullSecrets }} imagePullSecrets: diff --git a/charts/sourcegraph/templates/codeintel-db/codeintel-db.StatefulSet.yaml b/charts/sourcegraph/templates/codeintel-db/codeintel-db.StatefulSet.yaml index 058802a2..aba684ba 100644 --- a/charts/sourcegraph/templates/codeintel-db/codeintel-db.StatefulSet.yaml +++ b/charts/sourcegraph/templates/codeintel-db/codeintel-db.StatefulSet.yaml @@ -131,14 +131,12 @@ spec: {{- if .Values.codeIntelDB.extraContainers }} {{- toYaml .Values.codeIntelDB.extraContainers | nindent 6 }} {{- end }} - {{- 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 }} {{- include "sourcegraph.nodeSelector" (list . "codeIntelDB" ) | trim | nindent 6 }} {{- include "sourcegraph.affinity" (list . "codeIntelDB" ) | trim | nindent 6 }} + {{- include "sourcegraph.priorityClassName" (list . "codeIntelDB" ) | trim | nindent 6 }} {{- include "sourcegraph.tolerations" (list . "codeIntelDB" ) | trim | nindent 6 }} {{- with .Values.sourcegraph.imagePullSecrets }} imagePullSecrets: diff --git a/charts/sourcegraph/templates/frontend/sourcegraph-frontend.Deployment.yaml b/charts/sourcegraph/templates/frontend/sourcegraph-frontend.Deployment.yaml index 053f48d9..060ec1e7 100644 --- a/charts/sourcegraph/templates/frontend/sourcegraph-frontend.Deployment.yaml +++ b/charts/sourcegraph/templates/frontend/sourcegraph-frontend.Deployment.yaml @@ -65,7 +65,7 @@ spec: {{- range $name, $item := .Values.migrator.env }} - name: {{ $name }} {{- $item | toYaml | nindent 10 }} - {{- end }} + {{- end }} {{- if not .Values.sourcegraph.localDevMode}} resources: {{- toYaml .Values.migrator.resources | nindent 10 }} @@ -140,13 +140,11 @@ 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 }} {{- include "sourcegraph.affinity" (list . "frontend" ) | trim | nindent 6 }} + {{- include "sourcegraph.priorityClassName" (list . "frontend" ) | trim | nindent 6 }} {{- include "sourcegraph.tolerations" (list . "frontend" ) | trim | nindent 6 }} {{- with .Values.sourcegraph.imagePullSecrets }} imagePullSecrets: diff --git a/charts/sourcegraph/templates/gitserver/gitserver.StatefulSet.yaml b/charts/sourcegraph/templates/gitserver/gitserver.StatefulSet.yaml index 5d69c278..c4308a1b 100644 --- a/charts/sourcegraph/templates/gitserver/gitserver.StatefulSet.yaml +++ b/charts/sourcegraph/templates/gitserver/gitserver.StatefulSet.yaml @@ -99,6 +99,7 @@ spec: {{- toYaml .Values.gitserver.podSecurityContext | nindent 8 }} {{- include "sourcegraph.nodeSelector" (list . "gitserver" ) | trim | nindent 6 }} {{- include "sourcegraph.affinity" (list . "gitserver" ) | trim | nindent 6 }} + {{- include "sourcegraph.priorityClassName" (list . "gitserver" ) | trim | nindent 6 }} {{- include "sourcegraph.tolerations" (list . "gitserver" ) | trim | nindent 6 }} {{- with .Values.sourcegraph.imagePullSecrets }} imagePullSecrets: @@ -118,9 +119,6 @@ spec: {{- if .Values.gitserver.extraVolumes }} {{- toYaml .Values.gitserver.extraVolumes | nindent 6 }} {{- end }} - {{- if or .Values.gitserver.priorityClassName .Values.sourcegraph.priorityClassName }} - priorityClassName: {{ coalesce .Values.gitserver.priorityClassName .Values.sourcegraph.priorityClassName }} - {{- end }} updateStrategy: type: RollingUpdate volumeClaimTemplates: diff --git a/charts/sourcegraph/templates/grafana/grafana.StatefulSet.yaml b/charts/sourcegraph/templates/grafana/grafana.StatefulSet.yaml index 41ef6334..839fa5fb 100644 --- a/charts/sourcegraph/templates/grafana/grafana.StatefulSet.yaml +++ b/charts/sourcegraph/templates/grafana/grafana.StatefulSet.yaml @@ -84,13 +84,11 @@ 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 }} {{- include "sourcegraph.affinity" (list . "grafana" ) | trim | nindent 6 }} + {{- include "sourcegraph.priorityClassName" (list . "grafana" ) | trim | nindent 6 }} {{- include "sourcegraph.tolerations" (list . "grafana" ) | trim | nindent 6 }} {{- with .Values.sourcegraph.imagePullSecrets }} imagePullSecrets: diff --git a/charts/sourcegraph/templates/indexed-search/indexed-search.StatefulSet.yaml b/charts/sourcegraph/templates/indexed-search/indexed-search.StatefulSet.yaml index a3a346f2..13cca8c1 100644 --- a/charts/sourcegraph/templates/indexed-search/indexed-search.StatefulSet.yaml +++ b/charts/sourcegraph/templates/indexed-search/indexed-search.StatefulSet.yaml @@ -115,13 +115,11 @@ 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 }} {{- include "sourcegraph.affinity" (list . "indexedSearch" ) | trim | nindent 6 }} + {{- include "sourcegraph.priorityClassName" (list . "indexedSearch" ) | trim | nindent 6 }} {{- include "sourcegraph.tolerations" (list . "indexedSearch" ) | trim | nindent 6 }} {{- with .Values.sourcegraph.imagePullSecrets }} imagePullSecrets: diff --git a/charts/sourcegraph/templates/jaeger/jaeger.Deployment.yaml b/charts/sourcegraph/templates/jaeger/jaeger.Deployment.yaml index 7399644e..869d9160 100644 --- a/charts/sourcegraph/templates/jaeger/jaeger.Deployment.yaml +++ b/charts/sourcegraph/templates/jaeger/jaeger.Deployment.yaml @@ -97,13 +97,11 @@ 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 }} {{- include "sourcegraph.affinity" (list . "jaeger" ) | trim | nindent 6 }} + {{- include "sourcegraph.priorityClassName" (list . "jaeger" ) | trim | nindent 6 }} {{- include "sourcegraph.tolerations" (list . "jaeger" ) | trim | nindent 6 }} {{- with .Values.sourcegraph.imagePullSecrets }} imagePullSecrets: diff --git a/charts/sourcegraph/templates/node-exporter/node-exporter.DaemonSet.yaml b/charts/sourcegraph/templates/node-exporter/node-exporter.DaemonSet.yaml index 7563e534..db95884a 100644 --- a/charts/sourcegraph/templates/node-exporter/node-exporter.DaemonSet.yaml +++ b/charts/sourcegraph/templates/node-exporter/node-exporter.DaemonSet.yaml @@ -115,14 +115,12 @@ spec: {{- toYaml .Values.nodeExporter.extraContainers | nindent 6 }} {{- end }} automountServiceAccountToken: false - {{- if or .Values.nodeExporter.priorityClassName .Values.sourcegraph.priorityClassName }} - priorityClassName: {{ coalesce .Values.nodeExporter.priorityClassName .Values.sourcegraph.priorityClassName }} - {{- end }} terminationGracePeriodSeconds: 30 securityContext: {{- toYaml .Values.nodeExporter.podSecurityContext | nindent 8 }} {{- include "sourcegraph.nodeSelector" (list . "nodeExporter" ) | trim | nindent 6 }} {{- include "sourcegraph.affinity" (list . "nodeExporter" ) | trim | nindent 6 }} + {{- include "sourcegraph.priorityClassName" (list . "nodeExporter" ) | trim | nindent 6 }} {{- include "sourcegraph.tolerations" (list . "nodeExporter" ) | trim | nindent 6 }} {{- with .Values.sourcegraph.imagePullSecrets }} imagePullSecrets: diff --git a/charts/sourcegraph/templates/otel-collector/otel-agent.DaemonSet.yaml b/charts/sourcegraph/templates/otel-collector/otel-agent.DaemonSet.yaml index 658a56ed..646a4414 100644 --- a/charts/sourcegraph/templates/otel-collector/otel-agent.DaemonSet.yaml +++ b/charts/sourcegraph/templates/otel-collector/otel-agent.DaemonSet.yaml @@ -81,12 +81,10 @@ 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 }} + {{- include "sourcegraph.priorityClassName" (list . "openTelemetry" ) | trim | nindent 6 }} {{- include "sourcegraph.tolerations" (list . "openTelemetry" ) | trim | nindent 6 }} {{- with .Values.sourcegraph.imagePullSecrets }} imagePullSecrets: diff --git a/charts/sourcegraph/templates/otel-collector/otel-collector.Deployment.yaml b/charts/sourcegraph/templates/otel-collector/otel-collector.Deployment.yaml index 8aac53a3..8590e294 100644 --- a/charts/sourcegraph/templates/otel-collector/otel-collector.Deployment.yaml +++ b/charts/sourcegraph/templates/otel-collector/otel-collector.Deployment.yaml @@ -102,12 +102,10 @@ 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 }} + {{- include "sourcegraph.priorityClassName" (list . "openTelemetry" ) | trim | nindent 6 }} {{- include "sourcegraph.tolerations" (list . "openTelemetry" ) | trim | nindent 6 }} {{- with .Values.sourcegraph.imagePullSecrets }} imagePullSecrets: diff --git a/charts/sourcegraph/templates/pgsql/pgsql.StatefulSet.yaml b/charts/sourcegraph/templates/pgsql/pgsql.StatefulSet.yaml index a2d4fc4e..b73648c9 100644 --- a/charts/sourcegraph/templates/pgsql/pgsql.StatefulSet.yaml +++ b/charts/sourcegraph/templates/pgsql/pgsql.StatefulSet.yaml @@ -133,14 +133,12 @@ spec: {{- if .Values.pgsql.extraContainers }} {{- toYaml .Values.pgsql.extraContainers | nindent 6 }} {{- end }} - {{- 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 }} {{- include "sourcegraph.nodeSelector" (list . "pgsql" ) | trim | nindent 6 }} {{- include "sourcegraph.affinity" (list . "pgsql" ) | trim | nindent 6 }} + {{- include "sourcegraph.priorityClassName" (list . "pgsql" ) | trim | nindent 6 }} {{- include "sourcegraph.tolerations" (list . "pgsql" ) | trim | nindent 6 }} {{- with .Values.sourcegraph.imagePullSecrets }} imagePullSecrets: diff --git a/charts/sourcegraph/templates/precise-code-intel/worker.Deployment.yaml b/charts/sourcegraph/templates/precise-code-intel/worker.Deployment.yaml index 16591932..76b58cc1 100644 --- a/charts/sourcegraph/templates/precise-code-intel/worker.Deployment.yaml +++ b/charts/sourcegraph/templates/precise-code-intel/worker.Deployment.yaml @@ -104,13 +104,11 @@ 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 }} {{- include "sourcegraph.affinity" (list . "preciseCodeIntel" ) | trim | nindent 6 }} + {{- include "sourcegraph.priorityClassName" (list . "preciseCodeIntel" ) | trim | nindent 6 }} {{- include "sourcegraph.tolerations" (list . "preciseCodeIntel" ) | trim | nindent 6 }} {{- with .Values.sourcegraph.imagePullSecrets }} imagePullSecrets: diff --git a/charts/sourcegraph/templates/prometheus/prometheus.Deployment.yaml b/charts/sourcegraph/templates/prometheus/prometheus.Deployment.yaml index 9d901a2f..bf3d29ac 100644 --- a/charts/sourcegraph/templates/prometheus/prometheus.Deployment.yaml +++ b/charts/sourcegraph/templates/prometheus/prometheus.Deployment.yaml @@ -84,14 +84,12 @@ 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 }} terminationGracePeriodSeconds: 120 securityContext: {{- toYaml .Values.prometheus.podSecurityContext | nindent 8 }} {{- include "sourcegraph.nodeSelector" (list . "prometheus" ) | trim | nindent 6 }} {{- include "sourcegraph.affinity" (list . "prometheus" ) | trim | nindent 6 }} + {{- include "sourcegraph.priorityClassName" (list . "prometheus" ) | trim | nindent 6 }} {{- include "sourcegraph.tolerations" (list . "prometheus" ) | trim | nindent 6 }} {{- with .Values.sourcegraph.imagePullSecrets }} imagePullSecrets: diff --git a/charts/sourcegraph/templates/redis/redis-cache.Deployment.yaml b/charts/sourcegraph/templates/redis/redis-cache.Deployment.yaml index d9ce1d76..cccb3e76 100644 --- a/charts/sourcegraph/templates/redis/redis-cache.Deployment.yaml +++ b/charts/sourcegraph/templates/redis/redis-cache.Deployment.yaml @@ -125,15 +125,13 @@ spec: {{- toYaml .Values.redisCache.podSecurityContext | nindent 8 }} {{- include "sourcegraph.nodeSelector" (list . "redisCache" ) | trim | nindent 6 }} {{- include "sourcegraph.affinity" (list . "redisCache" ) | trim | nindent 6 }} + {{- include "sourcegraph.priorityClassName" (list . "redisCache" ) | trim | nindent 6 }} {{- include "sourcegraph.tolerations" (list . "redisCache" ) | trim | nindent 6 }} {{- with .Values.sourcegraph.imagePullSecrets }} imagePullSecrets: {{- toYaml . | nindent 8 }} {{- end }} {{- include "sourcegraph.renderServiceAccountName" (list . "redisCache") | trim | nindent 6 }} - {{- if or .Values.redisCache.priorityClassName .Values.sourcegraph.priorityClassName }} - priorityClassName: {{ coalesce .Values.redisCache.priorityClassName .Values.sourcegraph.priorityClassName }} - {{- end }} volumes: - name: redis-data persistentVolumeClaim: diff --git a/charts/sourcegraph/templates/redis/redis-store.Deployment.yaml b/charts/sourcegraph/templates/redis/redis-store.Deployment.yaml index afc9c267..eb7b6c81 100644 --- a/charts/sourcegraph/templates/redis/redis-store.Deployment.yaml +++ b/charts/sourcegraph/templates/redis/redis-store.Deployment.yaml @@ -124,15 +124,13 @@ spec: {{- toYaml .Values.redisStore.podSecurityContext | nindent 8 }} {{- include "sourcegraph.nodeSelector" (list . "redisStore" ) | trim | nindent 6 }} {{- include "sourcegraph.affinity" (list . "redisStore" ) | trim | nindent 6 }} + {{- include "sourcegraph.priorityClassName" (list . "redisStore" ) | trim | nindent 6 }} {{- include "sourcegraph.tolerations" (list . "redisStore" ) | trim | nindent 6 }} {{- with .Values.sourcegraph.imagePullSecrets }} imagePullSecrets: {{- toYaml . | nindent 8 }} {{- end }} {{- include "sourcegraph.renderServiceAccountName" (list . "redisStore") | trim | nindent 6 }} - {{- if or .Values.redisStore.priorityClassName .Values.sourcegraph.priorityClassName }} - priorityClassName: {{ coalesce .Values.redisStore.priorityClassName .Values.sourcegraph.priorityClassName }} - {{- end }} volumes: - name: redis-data persistentVolumeClaim: diff --git a/charts/sourcegraph/templates/searcher/searcher.StatefulSet.yaml b/charts/sourcegraph/templates/searcher/searcher.StatefulSet.yaml index 5d8445e6..335aa58a 100644 --- a/charts/sourcegraph/templates/searcher/searcher.StatefulSet.yaml +++ b/charts/sourcegraph/templates/searcher/searcher.StatefulSet.yaml @@ -117,6 +117,7 @@ spec: {{- toYaml .Values.searcher.podSecurityContext | nindent 8 }} {{- include "sourcegraph.nodeSelector" (list . "searcher" ) | trim | nindent 6 }} {{- include "sourcegraph.affinity" (list . "searcher" ) | trim | nindent 6 }} + {{- include "sourcegraph.priorityClassName" (list . "searcher" ) | trim | nindent 6 }} {{- include "sourcegraph.tolerations" (list . "searcher" ) | trim | nindent 6 }} {{- with .Values.sourcegraph.imagePullSecrets }} imagePullSecrets: @@ -131,9 +132,6 @@ spec: {{- if .Values.searcher.extraVolumes }} {{- toYaml .Values.searcher.extraVolumes | nindent 6 }} {{- end }} - {{- if or .Values.searcher.priorityClassName .Values.sourcegraph.priorityClassName }} - priorityClassName: {{ coalesce .Values.searcher.priorityClassName .Values.sourcegraph.priorityClassName }} - {{- end }} volumeClaimTemplates: - metadata: name: cache diff --git a/charts/sourcegraph/templates/syntactic-code-intel/worker.Deployment.yaml b/charts/sourcegraph/templates/syntactic-code-intel/worker.Deployment.yaml index e2cc43bc..468df71e 100644 --- a/charts/sourcegraph/templates/syntactic-code-intel/worker.Deployment.yaml +++ b/charts/sourcegraph/templates/syntactic-code-intel/worker.Deployment.yaml @@ -107,13 +107,11 @@ 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 }} {{- include "sourcegraph.affinity" (list . "syntacticCodeIntel" ) | trim | nindent 6 }} + {{- include "sourcegraph.priorityClassName" (list . "syntacticCodeIntel" ) | trim | nindent 6 }} {{- include "sourcegraph.tolerations" (list . "syntacticCodeIntel" ) | trim | nindent 6 }} {{- with .Values.sourcegraph.imagePullSecrets }} imagePullSecrets: diff --git a/charts/sourcegraph/templates/syntect-server/syntect-server.Deployment.yaml b/charts/sourcegraph/templates/syntect-server/syntect-server.Deployment.yaml index 258aea6d..8dec280f 100644 --- a/charts/sourcegraph/templates/syntect-server/syntect-server.Deployment.yaml +++ b/charts/sourcegraph/templates/syntect-server/syntect-server.Deployment.yaml @@ -87,13 +87,11 @@ 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 }} {{- include "sourcegraph.affinity" (list . "syntectServer" ) | trim | nindent 6 }} + {{- include "sourcegraph.priorityClassName" (list . "syntectServer" ) | trim | nindent 6 }} {{- include "sourcegraph.tolerations" (list . "syntectServer" ) | trim | nindent 6 }} {{- with .Values.sourcegraph.imagePullSecrets }} imagePullSecrets: From 5dfb20547a33b2cda499f94444d023c11beb9dd9 Mon Sep 17 00:00:00 2001 From: Marc LeBlanc Date: Mon, 15 Dec 2025 00:16:58 -0700 Subject: [PATCH 3/5] Fix Helm template whitespaces with and without value defined --- charts/sourcegraph/templates/_helpers/_priorityClassName.tpl | 4 ++-- charts/sourcegraph/templates/_worker.tpl | 2 +- .../sourcegraph/templates/blobstore/blobstore.Deployment.yaml | 2 +- charts/sourcegraph/templates/cadvisor/cadvisor.DaemonSet.yaml | 2 +- .../codeinsights-db/codeinsights-db.StatefulSet.yaml | 2 +- .../templates/codeintel-db/codeintel-db.StatefulSet.yaml | 2 +- .../templates/frontend/sourcegraph-frontend.Deployment.yaml | 2 +- .../templates/gitserver/gitserver.StatefulSet.yaml | 2 +- charts/sourcegraph/templates/grafana/grafana.StatefulSet.yaml | 2 +- .../templates/indexed-search/indexed-search.StatefulSet.yaml | 2 +- charts/sourcegraph/templates/jaeger/jaeger.Deployment.yaml | 2 +- .../templates/node-exporter/node-exporter.DaemonSet.yaml | 2 +- .../templates/otel-collector/otel-agent.DaemonSet.yaml | 2 +- .../templates/otel-collector/otel-collector.Deployment.yaml | 2 +- charts/sourcegraph/templates/pgsql/pgsql.StatefulSet.yaml | 2 +- .../templates/precise-code-intel/worker.Deployment.yaml | 2 +- .../templates/prometheus/prometheus.Deployment.yaml | 2 +- .../sourcegraph/templates/redis/redis-cache.Deployment.yaml | 2 +- .../sourcegraph/templates/redis/redis-store.Deployment.yaml | 2 +- .../sourcegraph/templates/searcher/searcher.StatefulSet.yaml | 2 +- .../templates/syntactic-code-intel/worker.Deployment.yaml | 2 +- .../templates/syntect-server/syntect-server.Deployment.yaml | 2 +- 22 files changed, 23 insertions(+), 23 deletions(-) diff --git a/charts/sourcegraph/templates/_helpers/_priorityClassName.tpl b/charts/sourcegraph/templates/_helpers/_priorityClassName.tpl index 599e6d3b..edff6746 100644 --- a/charts/sourcegraph/templates/_helpers/_priorityClassName.tpl +++ b/charts/sourcegraph/templates/_helpers/_priorityClassName.tpl @@ -13,8 +13,8 @@ and can override it for individual services, if needed, at .Values..pri {{- $globalPriorityClassName := (index $top.Values "sourcegraph" "priorityClassName") }} {{- $servicePriorityClassName := (index $top.Values $service "priorityClassName") }} {{- if $servicePriorityClassName }} -priorityClassName: {{- $servicePriorityClassName | toYaml | trim }} +priorityClassName: {{ $servicePriorityClassName | toYaml | trim }} {{- else if $globalPriorityClassName }} -priorityClassName: {{- $globalPriorityClassName | toYaml | trim }} +priorityClassName: {{ $globalPriorityClassName | toYaml | trim }} {{- end }} {{- end }} diff --git a/charts/sourcegraph/templates/_worker.tpl b/charts/sourcegraph/templates/_worker.tpl index 0e59c911..899bf03b 100644 --- a/charts/sourcegraph/templates/_worker.tpl +++ b/charts/sourcegraph/templates/_worker.tpl @@ -131,11 +131,11 @@ spec: {{- if $top.Values.worker.extraContainers }} {{- toYaml $top.Values.worker.extraContainers | nindent 6 }} {{- end }} - {{- include "sourcegraph.priorityClassName" (list . "worker" ) | trim | nindent 6 }} securityContext: {{- toYaml $top.Values.worker.podSecurityContext | nindent 8 }} {{- include "sourcegraph.nodeSelector" (list $top "worker" ) | trim | nindent 6 }} {{- include "sourcegraph.affinity" (list $top "worker" ) | trim | nindent 6 }} + {{- with include "sourcegraph.priorityClassName" (list $top "worker") | trim }}{{ . | nindent 6 }}{{- end }} {{- include "sourcegraph.tolerations" (list $top "worker" ) | trim | nindent 6 }} {{- with $top.Values.sourcegraph.imagePullSecrets }} imagePullSecrets: diff --git a/charts/sourcegraph/templates/blobstore/blobstore.Deployment.yaml b/charts/sourcegraph/templates/blobstore/blobstore.Deployment.yaml index 8a206b8c..8f02c7d4 100644 --- a/charts/sourcegraph/templates/blobstore/blobstore.Deployment.yaml +++ b/charts/sourcegraph/templates/blobstore/blobstore.Deployment.yaml @@ -92,7 +92,7 @@ spec: {{- toYaml .Values.blobstore.podSecurityContext | nindent 8 }} {{- include "sourcegraph.nodeSelector" (list . "blobstore" ) | trim | nindent 6 }} {{- include "sourcegraph.affinity" (list . "blobstore" ) | trim | nindent 6 }} - {{- include "sourcegraph.priorityClassName" (list . "blobstore" ) | trim | nindent 6 }} + {{- with include "sourcegraph.priorityClassName" (list . "blobstore") | trim }}{{ . | nindent 6 }}{{- end }} {{- include "sourcegraph.tolerations" (list . "blobstore" ) | trim | nindent 6 }} {{- with .Values.sourcegraph.imagePullSecrets }} imagePullSecrets: diff --git a/charts/sourcegraph/templates/cadvisor/cadvisor.DaemonSet.yaml b/charts/sourcegraph/templates/cadvisor/cadvisor.DaemonSet.yaml index af36d3be..e9814a4e 100644 --- a/charts/sourcegraph/templates/cadvisor/cadvisor.DaemonSet.yaml +++ b/charts/sourcegraph/templates/cadvisor/cadvisor.DaemonSet.yaml @@ -103,7 +103,7 @@ spec: {{- toYaml .Values.cadvisor.podSecurityContext | nindent 8 }} {{- include "sourcegraph.nodeSelector" (list . "cadvisor" ) | trim | nindent 6 }} {{- include "sourcegraph.affinity" (list . "cadvisor" ) | trim | nindent 6 }} - {{- include "sourcegraph.priorityClassName" (list . "cadvisor" ) | trim | nindent 6 }} + {{- with include "sourcegraph.priorityClassName" (list . "cadvisor" ) | trim }}{{ . | nindent 6 }}{{- end }} {{- include "sourcegraph.tolerations" (list . "cadvisor" ) | trim | nindent 6 }} {{- with .Values.sourcegraph.imagePullSecrets }} imagePullSecrets: diff --git a/charts/sourcegraph/templates/codeinsights-db/codeinsights-db.StatefulSet.yaml b/charts/sourcegraph/templates/codeinsights-db/codeinsights-db.StatefulSet.yaml index 190425dd..99c78fd3 100644 --- a/charts/sourcegraph/templates/codeinsights-db/codeinsights-db.StatefulSet.yaml +++ b/charts/sourcegraph/templates/codeinsights-db/codeinsights-db.StatefulSet.yaml @@ -124,7 +124,7 @@ spec: {{- toYaml .Values.codeInsightsDB.podSecurityContext | nindent 8 }} {{- include "sourcegraph.nodeSelector" (list . "codeInsightsDB" ) | trim | nindent 6 }} {{- include "sourcegraph.affinity" (list . "codeInsightsDB" ) | trim | nindent 6 }} - {{- include "sourcegraph.priorityClassName" (list . "codeInsightsDB" ) | trim | nindent 6 }} + {{- with include "sourcegraph.priorityClassName" (list . "codeInsightsDB" ) | trim }}{{ . | nindent 6 }}{{- end }} {{- include "sourcegraph.tolerations" (list . "codeInsightsDB" ) | trim | nindent 6 }} {{- with .Values.sourcegraph.imagePullSecrets }} imagePullSecrets: diff --git a/charts/sourcegraph/templates/codeintel-db/codeintel-db.StatefulSet.yaml b/charts/sourcegraph/templates/codeintel-db/codeintel-db.StatefulSet.yaml index aba684ba..d95649a3 100644 --- a/charts/sourcegraph/templates/codeintel-db/codeintel-db.StatefulSet.yaml +++ b/charts/sourcegraph/templates/codeintel-db/codeintel-db.StatefulSet.yaml @@ -136,7 +136,7 @@ spec: {{- toYaml .Values.codeIntelDB.podSecurityContext | nindent 8 }} {{- include "sourcegraph.nodeSelector" (list . "codeIntelDB" ) | trim | nindent 6 }} {{- include "sourcegraph.affinity" (list . "codeIntelDB" ) | trim | nindent 6 }} - {{- include "sourcegraph.priorityClassName" (list . "codeIntelDB" ) | trim | nindent 6 }} + {{- with include "sourcegraph.priorityClassName" (list . "codeIntelDB" ) | trim }}{{ . | nindent 6 }}{{- end }} {{- include "sourcegraph.tolerations" (list . "codeIntelDB" ) | trim | nindent 6 }} {{- with .Values.sourcegraph.imagePullSecrets }} imagePullSecrets: diff --git a/charts/sourcegraph/templates/frontend/sourcegraph-frontend.Deployment.yaml b/charts/sourcegraph/templates/frontend/sourcegraph-frontend.Deployment.yaml index 060ec1e7..1696644e 100644 --- a/charts/sourcegraph/templates/frontend/sourcegraph-frontend.Deployment.yaml +++ b/charts/sourcegraph/templates/frontend/sourcegraph-frontend.Deployment.yaml @@ -144,7 +144,7 @@ spec: {{- toYaml .Values.frontend.podSecurityContext | nindent 8 }} {{- include "sourcegraph.nodeSelector" (list . "frontend" ) | trim | nindent 6 }} {{- include "sourcegraph.affinity" (list . "frontend" ) | trim | nindent 6 }} - {{- include "sourcegraph.priorityClassName" (list . "frontend" ) | trim | nindent 6 }} + {{- with include "sourcegraph.priorityClassName" (list . "frontend" ) | trim }}{{ . | nindent 6 }}{{- end }} {{- include "sourcegraph.tolerations" (list . "frontend" ) | trim | nindent 6 }} {{- with .Values.sourcegraph.imagePullSecrets }} imagePullSecrets: diff --git a/charts/sourcegraph/templates/gitserver/gitserver.StatefulSet.yaml b/charts/sourcegraph/templates/gitserver/gitserver.StatefulSet.yaml index c4308a1b..833b9799 100644 --- a/charts/sourcegraph/templates/gitserver/gitserver.StatefulSet.yaml +++ b/charts/sourcegraph/templates/gitserver/gitserver.StatefulSet.yaml @@ -99,7 +99,7 @@ spec: {{- toYaml .Values.gitserver.podSecurityContext | nindent 8 }} {{- include "sourcegraph.nodeSelector" (list . "gitserver" ) | trim | nindent 6 }} {{- include "sourcegraph.affinity" (list . "gitserver" ) | trim | nindent 6 }} - {{- include "sourcegraph.priorityClassName" (list . "gitserver" ) | trim | nindent 6 }} + {{- with include "sourcegraph.priorityClassName" (list . "gitserver" ) | trim }}{{ . | nindent 6 }}{{- end }} {{- include "sourcegraph.tolerations" (list . "gitserver" ) | trim | nindent 6 }} {{- with .Values.sourcegraph.imagePullSecrets }} imagePullSecrets: diff --git a/charts/sourcegraph/templates/grafana/grafana.StatefulSet.yaml b/charts/sourcegraph/templates/grafana/grafana.StatefulSet.yaml index 839fa5fb..66e56943 100644 --- a/charts/sourcegraph/templates/grafana/grafana.StatefulSet.yaml +++ b/charts/sourcegraph/templates/grafana/grafana.StatefulSet.yaml @@ -88,7 +88,7 @@ spec: {{- toYaml .Values.grafana.podSecurityContext | nindent 8 }} {{- include "sourcegraph.nodeSelector" (list . "grafana" ) | trim | nindent 6 }} {{- include "sourcegraph.affinity" (list . "grafana" ) | trim | nindent 6 }} - {{- include "sourcegraph.priorityClassName" (list . "grafana" ) | trim | nindent 6 }} + {{- with include "sourcegraph.priorityClassName" (list . "grafana" ) | trim }}{{ . | nindent 6 }}{{- end }} {{- include "sourcegraph.tolerations" (list . "grafana" ) | trim | nindent 6 }} {{- with .Values.sourcegraph.imagePullSecrets }} imagePullSecrets: diff --git a/charts/sourcegraph/templates/indexed-search/indexed-search.StatefulSet.yaml b/charts/sourcegraph/templates/indexed-search/indexed-search.StatefulSet.yaml index 13cca8c1..b96e1ea8 100644 --- a/charts/sourcegraph/templates/indexed-search/indexed-search.StatefulSet.yaml +++ b/charts/sourcegraph/templates/indexed-search/indexed-search.StatefulSet.yaml @@ -119,7 +119,7 @@ spec: {{- toYaml .Values.indexedSearch.podSecurityContext | nindent 8 }} {{- include "sourcegraph.nodeSelector" (list . "indexedSearch" ) | trim | nindent 6 }} {{- include "sourcegraph.affinity" (list . "indexedSearch" ) | trim | nindent 6 }} - {{- include "sourcegraph.priorityClassName" (list . "indexedSearch" ) | trim | nindent 6 }} + {{- with include "sourcegraph.priorityClassName" (list . "indexedSearch" ) | trim }}{{ . | nindent 6 }}{{- end }} {{- include "sourcegraph.tolerations" (list . "indexedSearch" ) | trim | nindent 6 }} {{- with .Values.sourcegraph.imagePullSecrets }} imagePullSecrets: diff --git a/charts/sourcegraph/templates/jaeger/jaeger.Deployment.yaml b/charts/sourcegraph/templates/jaeger/jaeger.Deployment.yaml index 869d9160..34eb8381 100644 --- a/charts/sourcegraph/templates/jaeger/jaeger.Deployment.yaml +++ b/charts/sourcegraph/templates/jaeger/jaeger.Deployment.yaml @@ -101,7 +101,7 @@ spec: {{- toYaml .Values.jaeger.podSecurityContext | nindent 8 }} {{- include "sourcegraph.nodeSelector" (list . "jaeger" ) | trim | nindent 6 }} {{- include "sourcegraph.affinity" (list . "jaeger" ) | trim | nindent 6 }} - {{- include "sourcegraph.priorityClassName" (list . "jaeger" ) | trim | nindent 6 }} + {{- with include "sourcegraph.priorityClassName" (list . "jaeger" ) | trim }}{{ . | nindent 6 }}{{- end }} {{- include "sourcegraph.tolerations" (list . "jaeger" ) | trim | nindent 6 }} {{- with .Values.sourcegraph.imagePullSecrets }} imagePullSecrets: diff --git a/charts/sourcegraph/templates/node-exporter/node-exporter.DaemonSet.yaml b/charts/sourcegraph/templates/node-exporter/node-exporter.DaemonSet.yaml index db95884a..db0bc0c3 100644 --- a/charts/sourcegraph/templates/node-exporter/node-exporter.DaemonSet.yaml +++ b/charts/sourcegraph/templates/node-exporter/node-exporter.DaemonSet.yaml @@ -120,7 +120,7 @@ spec: {{- toYaml .Values.nodeExporter.podSecurityContext | nindent 8 }} {{- include "sourcegraph.nodeSelector" (list . "nodeExporter" ) | trim | nindent 6 }} {{- include "sourcegraph.affinity" (list . "nodeExporter" ) | trim | nindent 6 }} - {{- include "sourcegraph.priorityClassName" (list . "nodeExporter" ) | trim | nindent 6 }} + {{- with include "sourcegraph.priorityClassName" (list . "nodeExporter" ) | trim }}{{ . | nindent 6 }}{{- end }} {{- include "sourcegraph.tolerations" (list . "nodeExporter" ) | trim | nindent 6 }} {{- with .Values.sourcegraph.imagePullSecrets }} imagePullSecrets: diff --git a/charts/sourcegraph/templates/otel-collector/otel-agent.DaemonSet.yaml b/charts/sourcegraph/templates/otel-collector/otel-agent.DaemonSet.yaml index 646a4414..b2771396 100644 --- a/charts/sourcegraph/templates/otel-collector/otel-agent.DaemonSet.yaml +++ b/charts/sourcegraph/templates/otel-collector/otel-agent.DaemonSet.yaml @@ -84,7 +84,7 @@ spec: terminationGracePeriodSeconds: 120 {{- include "sourcegraph.nodeSelector" (list . "openTelemetry" ) | trim | nindent 6 }} {{- include "sourcegraph.affinity" (list . "openTelemetry" ) | trim | nindent 6 }} - {{- include "sourcegraph.priorityClassName" (list . "openTelemetry" ) | trim | nindent 6 }} + {{- with include "sourcegraph.priorityClassName" (list . "openTelemetry" ) | trim }}{{ . | nindent 6 }}{{- end }} {{- include "sourcegraph.tolerations" (list . "openTelemetry" ) | trim | nindent 6 }} {{- with .Values.sourcegraph.imagePullSecrets }} imagePullSecrets: diff --git a/charts/sourcegraph/templates/otel-collector/otel-collector.Deployment.yaml b/charts/sourcegraph/templates/otel-collector/otel-collector.Deployment.yaml index 8590e294..d1d428a4 100644 --- a/charts/sourcegraph/templates/otel-collector/otel-collector.Deployment.yaml +++ b/charts/sourcegraph/templates/otel-collector/otel-collector.Deployment.yaml @@ -105,7 +105,7 @@ spec: terminationGracePeriodSeconds: 120 {{- include "sourcegraph.nodeSelector" (list . "openTelemetry" ) | trim | nindent 6 }} {{- include "sourcegraph.affinity" (list . "openTelemetry" ) | trim | nindent 6 }} - {{- include "sourcegraph.priorityClassName" (list . "openTelemetry" ) | trim | nindent 6 }} + {{- with include "sourcegraph.priorityClassName" (list . "openTelemetry" ) | trim }}{{ . | nindent 6 }}{{- end }} {{- include "sourcegraph.tolerations" (list . "openTelemetry" ) | trim | nindent 6 }} {{- with .Values.sourcegraph.imagePullSecrets }} imagePullSecrets: diff --git a/charts/sourcegraph/templates/pgsql/pgsql.StatefulSet.yaml b/charts/sourcegraph/templates/pgsql/pgsql.StatefulSet.yaml index b73648c9..26047eaf 100644 --- a/charts/sourcegraph/templates/pgsql/pgsql.StatefulSet.yaml +++ b/charts/sourcegraph/templates/pgsql/pgsql.StatefulSet.yaml @@ -138,7 +138,7 @@ spec: {{- toYaml .Values.pgsql.podSecurityContext | nindent 8 }} {{- include "sourcegraph.nodeSelector" (list . "pgsql" ) | trim | nindent 6 }} {{- include "sourcegraph.affinity" (list . "pgsql" ) | trim | nindent 6 }} - {{- include "sourcegraph.priorityClassName" (list . "pgsql" ) | trim | nindent 6 }} + {{- with include "sourcegraph.priorityClassName" (list . "pgsql" ) | trim }}{{ . | nindent 6 }}{{- end }} {{- include "sourcegraph.tolerations" (list . "pgsql" ) | trim | nindent 6 }} {{- with .Values.sourcegraph.imagePullSecrets }} imagePullSecrets: diff --git a/charts/sourcegraph/templates/precise-code-intel/worker.Deployment.yaml b/charts/sourcegraph/templates/precise-code-intel/worker.Deployment.yaml index 76b58cc1..bb15fbf7 100644 --- a/charts/sourcegraph/templates/precise-code-intel/worker.Deployment.yaml +++ b/charts/sourcegraph/templates/precise-code-intel/worker.Deployment.yaml @@ -108,7 +108,7 @@ spec: {{- toYaml .Values.preciseCodeIntel.podSecurityContext | nindent 8 }} {{- include "sourcegraph.nodeSelector" (list . "preciseCodeIntel" ) | trim | nindent 6 }} {{- include "sourcegraph.affinity" (list . "preciseCodeIntel" ) | trim | nindent 6 }} - {{- include "sourcegraph.priorityClassName" (list . "preciseCodeIntel" ) | trim | nindent 6 }} + {{- with include "sourcegraph.priorityClassName" (list . "preciseCodeIntel" ) | trim }}{{ . | nindent 6 }}{{- end }} {{- include "sourcegraph.tolerations" (list . "preciseCodeIntel" ) | trim | nindent 6 }} {{- with .Values.sourcegraph.imagePullSecrets }} imagePullSecrets: diff --git a/charts/sourcegraph/templates/prometheus/prometheus.Deployment.yaml b/charts/sourcegraph/templates/prometheus/prometheus.Deployment.yaml index bf3d29ac..cee8cc9e 100644 --- a/charts/sourcegraph/templates/prometheus/prometheus.Deployment.yaml +++ b/charts/sourcegraph/templates/prometheus/prometheus.Deployment.yaml @@ -89,7 +89,7 @@ spec: {{- toYaml .Values.prometheus.podSecurityContext | nindent 8 }} {{- include "sourcegraph.nodeSelector" (list . "prometheus" ) | trim | nindent 6 }} {{- include "sourcegraph.affinity" (list . "prometheus" ) | trim | nindent 6 }} - {{- include "sourcegraph.priorityClassName" (list . "prometheus" ) | trim | nindent 6 }} + {{- with include "sourcegraph.priorityClassName" (list . "prometheus" ) | trim }}{{ . | nindent 6 }}{{- end }} {{- include "sourcegraph.tolerations" (list . "prometheus" ) | trim | nindent 6 }} {{- with .Values.sourcegraph.imagePullSecrets }} imagePullSecrets: diff --git a/charts/sourcegraph/templates/redis/redis-cache.Deployment.yaml b/charts/sourcegraph/templates/redis/redis-cache.Deployment.yaml index cccb3e76..41eb3042 100644 --- a/charts/sourcegraph/templates/redis/redis-cache.Deployment.yaml +++ b/charts/sourcegraph/templates/redis/redis-cache.Deployment.yaml @@ -125,7 +125,7 @@ spec: {{- toYaml .Values.redisCache.podSecurityContext | nindent 8 }} {{- include "sourcegraph.nodeSelector" (list . "redisCache" ) | trim | nindent 6 }} {{- include "sourcegraph.affinity" (list . "redisCache" ) | trim | nindent 6 }} - {{- include "sourcegraph.priorityClassName" (list . "redisCache" ) | trim | nindent 6 }} + {{- with include "sourcegraph.priorityClassName" (list . "redisCache" ) | trim }}{{ . | nindent 6 }}{{- end }} {{- include "sourcegraph.tolerations" (list . "redisCache" ) | trim | nindent 6 }} {{- with .Values.sourcegraph.imagePullSecrets }} imagePullSecrets: diff --git a/charts/sourcegraph/templates/redis/redis-store.Deployment.yaml b/charts/sourcegraph/templates/redis/redis-store.Deployment.yaml index eb7b6c81..64c2710c 100644 --- a/charts/sourcegraph/templates/redis/redis-store.Deployment.yaml +++ b/charts/sourcegraph/templates/redis/redis-store.Deployment.yaml @@ -124,7 +124,7 @@ spec: {{- toYaml .Values.redisStore.podSecurityContext | nindent 8 }} {{- include "sourcegraph.nodeSelector" (list . "redisStore" ) | trim | nindent 6 }} {{- include "sourcegraph.affinity" (list . "redisStore" ) | trim | nindent 6 }} - {{- include "sourcegraph.priorityClassName" (list . "redisStore" ) | trim | nindent 6 }} + {{- with include "sourcegraph.priorityClassName" (list . "redisStore" ) | trim }}{{ . | nindent 6 }}{{- end }} {{- include "sourcegraph.tolerations" (list . "redisStore" ) | trim | nindent 6 }} {{- with .Values.sourcegraph.imagePullSecrets }} imagePullSecrets: diff --git a/charts/sourcegraph/templates/searcher/searcher.StatefulSet.yaml b/charts/sourcegraph/templates/searcher/searcher.StatefulSet.yaml index 335aa58a..7c73b48b 100644 --- a/charts/sourcegraph/templates/searcher/searcher.StatefulSet.yaml +++ b/charts/sourcegraph/templates/searcher/searcher.StatefulSet.yaml @@ -117,7 +117,7 @@ spec: {{- toYaml .Values.searcher.podSecurityContext | nindent 8 }} {{- include "sourcegraph.nodeSelector" (list . "searcher" ) | trim | nindent 6 }} {{- include "sourcegraph.affinity" (list . "searcher" ) | trim | nindent 6 }} - {{- include "sourcegraph.priorityClassName" (list . "searcher" ) | trim | nindent 6 }} + {{- with include "sourcegraph.priorityClassName" (list . "searcher" ) | trim }}{{ . | nindent 6 }}{{- end }} {{- include "sourcegraph.tolerations" (list . "searcher" ) | trim | nindent 6 }} {{- with .Values.sourcegraph.imagePullSecrets }} imagePullSecrets: diff --git a/charts/sourcegraph/templates/syntactic-code-intel/worker.Deployment.yaml b/charts/sourcegraph/templates/syntactic-code-intel/worker.Deployment.yaml index 468df71e..d7a63f37 100644 --- a/charts/sourcegraph/templates/syntactic-code-intel/worker.Deployment.yaml +++ b/charts/sourcegraph/templates/syntactic-code-intel/worker.Deployment.yaml @@ -111,7 +111,7 @@ spec: {{- toYaml .Values.syntacticCodeIntel.podSecurityContext | nindent 8 }} {{- include "sourcegraph.nodeSelector" (list . "syntacticCodeIntel" ) | trim | nindent 6 }} {{- include "sourcegraph.affinity" (list . "syntacticCodeIntel" ) | trim | nindent 6 }} - {{- include "sourcegraph.priorityClassName" (list . "syntacticCodeIntel" ) | trim | nindent 6 }} + {{- with include "sourcegraph.priorityClassName" (list . "syntacticCodeIntel" ) | trim }}{{ . | nindent 6 }}{{- end }} {{- include "sourcegraph.tolerations" (list . "syntacticCodeIntel" ) | trim | nindent 6 }} {{- with .Values.sourcegraph.imagePullSecrets }} imagePullSecrets: diff --git a/charts/sourcegraph/templates/syntect-server/syntect-server.Deployment.yaml b/charts/sourcegraph/templates/syntect-server/syntect-server.Deployment.yaml index 8dec280f..9a66ae5f 100644 --- a/charts/sourcegraph/templates/syntect-server/syntect-server.Deployment.yaml +++ b/charts/sourcegraph/templates/syntect-server/syntect-server.Deployment.yaml @@ -91,7 +91,7 @@ spec: {{- toYaml .Values.syntectServer.podSecurityContext | nindent 8 }} {{- include "sourcegraph.nodeSelector" (list . "syntectServer" ) | trim | nindent 6 }} {{- include "sourcegraph.affinity" (list . "syntectServer" ) | trim | nindent 6 }} - {{- include "sourcegraph.priorityClassName" (list . "syntectServer" ) | trim | nindent 6 }} + {{- with include "sourcegraph.priorityClassName" (list . "syntectServer" ) | trim }}{{ . | nindent 6 }}{{- end }} {{- include "sourcegraph.tolerations" (list . "syntectServer" ) | trim | nindent 6 }} {{- with .Values.sourcegraph.imagePullSecrets }} imagePullSecrets: From 78ece56be698c716d93373599352892984c3c2b7 Mon Sep 17 00:00:00 2001 From: Marc LeBlanc Date: Mon, 15 Dec 2025 00:40:19 -0700 Subject: [PATCH 4/5] Fix priorityClassName for migrator and executors charts --- TEST.md | 2 +- .../templates/_helpers/_priorityClassName.tpl | 20 +++++++++++++++++++ .../executor/executor.Deployment.yaml | 4 +--- .../private-docker-registry.Deployment.yaml | 4 +--- .../k8s/templates/executor.Deployment.yaml | 4 +--- .../_helpers/_priorityClassName.tpl | 20 +++++++++++++++++++ .../migrator/sourcegraph-migrator.Job.yaml | 4 +--- 7 files changed, 45 insertions(+), 13 deletions(-) create mode 100644 charts/sourcegraph-executor/dind/templates/_helpers/_priorityClassName.tpl create mode 100644 charts/sourcegraph-migrator/_helpers/_priorityClassName.tpl diff --git a/TEST.md b/TEST.md index af12499b..20e8dfa5 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 ./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. diff --git a/charts/sourcegraph-executor/dind/templates/_helpers/_priorityClassName.tpl b/charts/sourcegraph-executor/dind/templates/_helpers/_priorityClassName.tpl new file mode 100644 index 00000000..edff6746 --- /dev/null +++ b/charts/sourcegraph-executor/dind/templates/_helpers/_priorityClassName.tpl @@ -0,0 +1,20 @@ +{{/* + +Allow customers to assign a priorityClassName to all resources which create pods (ex. DaemonSets, Deployments, StatefulSets) + +Customers can configure an instance-wide default priorty class name at .Values.sourcegraph.priorityClassName, +and can override it for individual services, if needed, at .Values..priorityClassName + +*/}} + +{{- define "sourcegraph.priorityClassName" -}} +{{- $top := index . 0 }} +{{- $service := index . 1 }} +{{- $globalPriorityClassName := (index $top.Values "sourcegraph" "priorityClassName") }} +{{- $servicePriorityClassName := (index $top.Values $service "priorityClassName") }} +{{- if $servicePriorityClassName }} +priorityClassName: {{ $servicePriorityClassName | toYaml | trim }} +{{- else if $globalPriorityClassName }} +priorityClassName: {{ $globalPriorityClassName | toYaml | trim }} +{{- end }} +{{- end }} diff --git a/charts/sourcegraph-executor/dind/templates/executor/executor.Deployment.yaml b/charts/sourcegraph-executor/dind/templates/executor/executor.Deployment.yaml index 557c264c..06948149 100644 --- a/charts/sourcegraph-executor/dind/templates/executor/executor.Deployment.yaml +++ b/charts/sourcegraph-executor/dind/templates/executor/executor.Deployment.yaml @@ -130,10 +130,8 @@ spec: affinity: {{- toYaml . | nindent 8 }} {{- end }} + {{- with include "sourcegraph.priorityClassName" (list . "executor") | trim }}{{ . | nindent 6 }}{{- 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 96f308c3..32554be6 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 @@ -74,10 +74,8 @@ spec: affinity: {{- toYaml . | nindent 8 }} {{- end }} + {{- with include "sourcegraph.priorityClassName" (list . "privateDockerRegistry") | trim }}{{ . | nindent 6 }}{{- 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/k8s/templates/executor.Deployment.yaml b/charts/sourcegraph-executor/k8s/templates/executor.Deployment.yaml index e04e0213..4fa52c64 100644 --- a/charts/sourcegraph-executor/k8s/templates/executor.Deployment.yaml +++ b/charts/sourcegraph-executor/k8s/templates/executor.Deployment.yaml @@ -99,10 +99,8 @@ spec: affinity: {{- toYaml . | nindent 8 }} {{- end }} + {{- with include "sourcegraph.priorityClassName" (list . "executor") | trim }}{{ . | nindent 6 }}{{- 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-migrator/_helpers/_priorityClassName.tpl b/charts/sourcegraph-migrator/_helpers/_priorityClassName.tpl new file mode 100644 index 00000000..edff6746 --- /dev/null +++ b/charts/sourcegraph-migrator/_helpers/_priorityClassName.tpl @@ -0,0 +1,20 @@ +{{/* + +Allow customers to assign a priorityClassName to all resources which create pods (ex. DaemonSets, Deployments, StatefulSets) + +Customers can configure an instance-wide default priorty class name at .Values.sourcegraph.priorityClassName, +and can override it for individual services, if needed, at .Values..priorityClassName + +*/}} + +{{- define "sourcegraph.priorityClassName" -}} +{{- $top := index . 0 }} +{{- $service := index . 1 }} +{{- $globalPriorityClassName := (index $top.Values "sourcegraph" "priorityClassName") }} +{{- $servicePriorityClassName := (index $top.Values $service "priorityClassName") }} +{{- if $servicePriorityClassName }} +priorityClassName: {{ $servicePriorityClassName | toYaml | trim }} +{{- else if $globalPriorityClassName }} +priorityClassName: {{ $globalPriorityClassName | toYaml | trim }} +{{- end }} +{{- end }} diff --git a/charts/sourcegraph-migrator/templates/migrator/sourcegraph-migrator.Job.yaml b/charts/sourcegraph-migrator/templates/migrator/sourcegraph-migrator.Job.yaml index 35110123..c77ec3b3 100644 --- a/charts/sourcegraph-migrator/templates/migrator/sourcegraph-migrator.Job.yaml +++ b/charts/sourcegraph-migrator/templates/migrator/sourcegraph-migrator.Job.yaml @@ -68,10 +68,8 @@ spec: affinity: {{- toYaml . | nindent 8 }} {{- end }} + {{- with include "sourcegraph.priorityClassName" (list . "migrator") | trim }}{{ . | nindent 6 }}{{- 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 }} From 49d5a4febd1de75a661b243d8b467eea3e034094 Mon Sep 17 00:00:00 2001 From: Marc LeBlanc Date: Mon, 15 Dec 2025 00:47:12 -0700 Subject: [PATCH 5/5] Fix template file locations --- .../_helpers/_priorityClassName.tpl | 0 .../templates/_helpers/_priorityClassName.tpl | 20 +++++++++++++++++++ 2 files changed, 20 insertions(+) rename charts/{sourcegraph-migrator => sourcegraph-executor/k8s/templates}/_helpers/_priorityClassName.tpl (100%) create mode 100644 charts/sourcegraph-migrator/templates/_helpers/_priorityClassName.tpl diff --git a/charts/sourcegraph-migrator/_helpers/_priorityClassName.tpl b/charts/sourcegraph-executor/k8s/templates/_helpers/_priorityClassName.tpl similarity index 100% rename from charts/sourcegraph-migrator/_helpers/_priorityClassName.tpl rename to charts/sourcegraph-executor/k8s/templates/_helpers/_priorityClassName.tpl diff --git a/charts/sourcegraph-migrator/templates/_helpers/_priorityClassName.tpl b/charts/sourcegraph-migrator/templates/_helpers/_priorityClassName.tpl new file mode 100644 index 00000000..edff6746 --- /dev/null +++ b/charts/sourcegraph-migrator/templates/_helpers/_priorityClassName.tpl @@ -0,0 +1,20 @@ +{{/* + +Allow customers to assign a priorityClassName to all resources which create pods (ex. DaemonSets, Deployments, StatefulSets) + +Customers can configure an instance-wide default priorty class name at .Values.sourcegraph.priorityClassName, +and can override it for individual services, if needed, at .Values..priorityClassName + +*/}} + +{{- define "sourcegraph.priorityClassName" -}} +{{- $top := index . 0 }} +{{- $service := index . 1 }} +{{- $globalPriorityClassName := (index $top.Values "sourcegraph" "priorityClassName") }} +{{- $servicePriorityClassName := (index $top.Values $service "priorityClassName") }} +{{- if $servicePriorityClassName }} +priorityClassName: {{ $servicePriorityClassName | toYaml | trim }} +{{- else if $globalPriorityClassName }} +priorityClassName: {{ $globalPriorityClassName | toYaml | trim }} +{{- end }} +{{- end }}