diff --git a/TEST.md b/TEST.md index 7a4f1fa8..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 --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/_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 9570283d..06948149 100644 --- a/charts/sourcegraph-executor/dind/templates/executor/executor.Deployment.yaml +++ b/charts/sourcegraph-executor/dind/templates/executor/executor.Deployment.yaml @@ -130,6 +130,7 @@ spec: affinity: {{- toYaml . | nindent 8 }} {{- end }} + {{- with include "sourcegraph.priorityClassName" (list . "executor") | trim }}{{ . | nindent 6 }}{{- end }} {{- with .Values.sourcegraph.tolerations }} tolerations: {{- toYaml . | nindent 8 }} 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..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,6 +74,7 @@ spec: affinity: {{- toYaml . | nindent 8 }} {{- end }} + {{- with include "sourcegraph.priorityClassName" (list . "privateDockerRegistry") | trim }}{{ . | nindent 6 }}{{- end }} {{- with .Values.sourcegraph.tolerations }} tolerations: {{- toYaml . | nindent 8 }} 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/_helpers/_priorityClassName.tpl b/charts/sourcegraph-executor/k8s/templates/_helpers/_priorityClassName.tpl new file mode 100644 index 00000000..edff6746 --- /dev/null +++ b/charts/sourcegraph-executor/k8s/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/k8s/templates/executor.Deployment.yaml b/charts/sourcegraph-executor/k8s/templates/executor.Deployment.yaml index dd33bdf9..4fa52c64 100644 --- a/charts/sourcegraph-executor/k8s/templates/executor.Deployment.yaml +++ b/charts/sourcegraph-executor/k8s/templates/executor.Deployment.yaml @@ -99,6 +99,7 @@ spec: affinity: {{- toYaml . | nindent 8 }} {{- end }} + {{- with include "sourcegraph.priorityClassName" (list . "executor") | trim }}{{ . | nindent 6 }}{{- end }} {{- with .Values.executor.tolerations }} tolerations: {{- toYaml . | nindent 8 }} 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/_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 }} diff --git a/charts/sourcegraph-migrator/templates/migrator/sourcegraph-migrator.Job.yaml b/charts/sourcegraph-migrator/templates/migrator/sourcegraph-migrator.Job.yaml index 9c06be82..c77ec3b3 100644 --- a/charts/sourcegraph-migrator/templates/migrator/sourcegraph-migrator.Job.yaml +++ b/charts/sourcegraph-migrator/templates/migrator/sourcegraph-migrator.Job.yaml @@ -68,6 +68,7 @@ spec: affinity: {{- toYaml . | nindent 8 }} {{- end }} + {{- with include "sourcegraph.priorityClassName" (list . "migrator") | trim }}{{ . | nindent 6 }}{{- end }} {{- with .Values.sourcegraph.tolerations }} tolerations: {{- toYaml . | nindent 8 }} 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/_helpers/_priorityClassName.tpl b/charts/sourcegraph/templates/_helpers/_priorityClassName.tpl new file mode 100644 index 00000000..edff6746 --- /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 73c4b64a..899bf03b 100644 --- a/charts/sourcegraph/templates/_worker.tpl +++ b/charts/sourcegraph/templates/_worker.tpl @@ -135,6 +135,7 @@ spec: {{- 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 08c87d9d..8f02c7d4 100644 --- a/charts/sourcegraph/templates/blobstore/blobstore.Deployment.yaml +++ b/charts/sourcegraph/templates/blobstore/blobstore.Deployment.yaml @@ -92,6 +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 }} + {{- 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 c0c325ad..e9814a4e 100644 --- a/charts/sourcegraph/templates/cadvisor/cadvisor.DaemonSet.yaml +++ b/charts/sourcegraph/templates/cadvisor/cadvisor.DaemonSet.yaml @@ -103,6 +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 }} + {{- 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 d56a02a8..99c78fd3 100644 --- a/charts/sourcegraph/templates/codeinsights-db/codeinsights-db.StatefulSet.yaml +++ b/charts/sourcegraph/templates/codeinsights-db/codeinsights-db.StatefulSet.yaml @@ -124,6 +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 }} + {{- 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 7ea3c456..d95649a3 100644 --- a/charts/sourcegraph/templates/codeintel-db/codeintel-db.StatefulSet.yaml +++ b/charts/sourcegraph/templates/codeintel-db/codeintel-db.StatefulSet.yaml @@ -136,6 +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 }} + {{- 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 e0f61903..1696644e 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 }} @@ -144,6 +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 }} + {{- 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 9620df24..833b9799 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 }} + {{- with include "sourcegraph.priorityClassName" (list . "gitserver" ) | trim }}{{ . | nindent 6 }}{{- end }} {{- 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 .Values.gitserver.priorityClassName }} - priorityClassName: {{ .Values.gitserver.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 da569d02..66e56943 100644 --- a/charts/sourcegraph/templates/grafana/grafana.StatefulSet.yaml +++ b/charts/sourcegraph/templates/grafana/grafana.StatefulSet.yaml @@ -88,6 +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 }} + {{- 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 cd2df9c9..b96e1ea8 100644 --- a/charts/sourcegraph/templates/indexed-search/indexed-search.StatefulSet.yaml +++ b/charts/sourcegraph/templates/indexed-search/indexed-search.StatefulSet.yaml @@ -119,6 +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 }} + {{- with include "sourcegraph.priorityClassName" (list . "indexedSearch" ) | trim }}{{ . | nindent 6 }}{{- end }} {{- include "sourcegraph.tolerations" (list . "indexedSearch" ) | trim | nindent 6 }} {{- with .Values.sourcegraph.imagePullSecrets }} imagePullSecrets: @@ -130,9 +131,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 38aa01d8..34eb8381 100644 --- a/charts/sourcegraph/templates/jaeger/jaeger.Deployment.yaml +++ b/charts/sourcegraph/templates/jaeger/jaeger.Deployment.yaml @@ -101,6 +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 }} + {{- 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 68693182..db0bc0c3 100644 --- a/charts/sourcegraph/templates/node-exporter/node-exporter.DaemonSet.yaml +++ b/charts/sourcegraph/templates/node-exporter/node-exporter.DaemonSet.yaml @@ -120,6 +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 }} + {{- 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 3efd5b1c..b2771396 100644 --- a/charts/sourcegraph/templates/otel-collector/otel-agent.DaemonSet.yaml +++ b/charts/sourcegraph/templates/otel-collector/otel-agent.DaemonSet.yaml @@ -84,6 +84,7 @@ spec: terminationGracePeriodSeconds: 120 {{- include "sourcegraph.nodeSelector" (list . "openTelemetry" ) | trim | nindent 6 }} {{- include "sourcegraph.affinity" (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 47896c1b..d1d428a4 100644 --- a/charts/sourcegraph/templates/otel-collector/otel-collector.Deployment.yaml +++ b/charts/sourcegraph/templates/otel-collector/otel-collector.Deployment.yaml @@ -105,6 +105,7 @@ spec: terminationGracePeriodSeconds: 120 {{- include "sourcegraph.nodeSelector" (list . "openTelemetry" ) | trim | nindent 6 }} {{- include "sourcegraph.affinity" (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 4155e037..26047eaf 100644 --- a/charts/sourcegraph/templates/pgsql/pgsql.StatefulSet.yaml +++ b/charts/sourcegraph/templates/pgsql/pgsql.StatefulSet.yaml @@ -138,6 +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 }} + {{- 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 17b41e64..bb15fbf7 100644 --- a/charts/sourcegraph/templates/precise-code-intel/worker.Deployment.yaml +++ b/charts/sourcegraph/templates/precise-code-intel/worker.Deployment.yaml @@ -108,6 +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 }} + {{- 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 9616c9de..cee8cc9e 100644 --- a/charts/sourcegraph/templates/prometheus/prometheus.Deployment.yaml +++ b/charts/sourcegraph/templates/prometheus/prometheus.Deployment.yaml @@ -89,6 +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 }} + {{- 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 fc00f487..41eb3042 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 }} + {{- with include "sourcegraph.priorityClassName" (list . "redisCache" ) | trim }}{{ . | nindent 6 }}{{- end }} {{- 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 .Values.redisCache.priorityClassName }} - priorityClassName: {{ .Values.redisCache.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 d1697741..64c2710c 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 }} + {{- with include "sourcegraph.priorityClassName" (list . "redisStore" ) | trim }}{{ . | nindent 6 }}{{- end }} {{- 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 .Values.redisStore.priorityClassName }} - priorityClassName: {{ .Values.redisStore.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 ab201aeb..7c73b48b 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 }} + {{- with include "sourcegraph.priorityClassName" (list . "searcher" ) | trim }}{{ . | nindent 6 }}{{- end }} {{- 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 .Values.searcher.priorityClassName }} - priorityClassName: {{ .Values.searcher.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 96240603..d7a63f37 100644 --- a/charts/sourcegraph/templates/syntactic-code-intel/worker.Deployment.yaml +++ b/charts/sourcegraph/templates/syntactic-code-intel/worker.Deployment.yaml @@ -111,6 +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 }} + {{- 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 7d6e0712..9a66ae5f 100644 --- a/charts/sourcegraph/templates/syntect-server/syntect-server.Deployment.yaml +++ b/charts/sourcegraph/templates/syntect-server/syntect-server.Deployment.yaml @@ -91,6 +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 }} + {{- with include "sourcegraph.priorityClassName" (list . "syntectServer" ) | trim }}{{ . | nindent 6 }}{{- end }} {{- include "sourcegraph.tolerations" (list . "syntectServer" ) | trim | nindent 6 }} {{- with .Values.sourcegraph.imagePullSecrets }} imagePullSecrets: 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