You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[Backport 6.11.x] Add priorityClassName to remaining pods (#785)
Linear issue [FEIE-297: Add `priorityClassName` to remaining
pods](https://linear.app/sourcegraph/issue/FEIE-297/add-priorityclassname-to-remaining-pods)
- Customer's Kubernetes cluster policy blocks pods from starting if they do not have a priorityClassName in their config.
- We already had support for priorityClassName, but only for ~5 pods, need to add this for all remaining pods
- Added logic so that priorityClassName could be defined once, under the `sourcegraph` top level key, and / or under each pod's top-level key, which would override the config on the `sourcegraph` top level key, so the customer could configure:
```yaml
sourcegraph:
priorityClassName: p2
pgsql:
priorityClassName: p1
```
### Checklist
- [x] Follow the [manual testing
process](https://github.com/sourcegraph/deploy-sourcegraph-helm/blob/main/TEST.md)
- [ ] Update
[changelog](https://github.com/sourcegraph/deploy-sourcegraph-helm/blob/main/charts/sourcegraph/CHANGELOG.md)
- [ ] Update [Kubernetes update
doc](https://docs.sourcegraph.com/admin/updates/kubernetes)
### Test plan
- Tested with Helm template
- Followed the manual testing process
- Deployed it on my test cluster, with the following override file:
```yaml
priorityClasses:
- name: test
value: 100
preemptionPolicy: Never
description: "test"
- name: test2
value: 102
preemptionPolicy: Never
description: "test2"
sourcegraph:
image:
defaultTag: 6.10.3349
useGlobalTagAsDefault: true
priorityClassName: test
```
- Then re-applied, adding:
```yaml
gitserver:
priorityClassName: test2
```
- Both worked, output:
```
[2025-12-15 03:58:52] config % kubectl get pods -o custom-columns=NAME:.metadata.name,PRIORITY_CLASS:.spec.priorityClassName,PRIORITY_VALUE:.spec.priority
NAME PRIORITY_CLASS PRIORITY_VALUE
blobstore-579cbc4cb9-2gn69 test 100
codeinsights-db-0 test 100
codeintel-db-0 test 100
gitserver-0 test2 102
gitserver-1 test2 102
grafana-0 test 100
indexed-search-0 test 100
pgsql-0 test 100
precise-code-intel-worker-5b6bd8d898-9zrbg test 100
prometheus-65468d765d-j4rgw test 100
redis-cache-595c746f84-2wxtf test 100
redis-store-5f4b87dbf4-8n24m test 100
searcher-0 test 100
sourcegraph-frontend-677d647479-77zrl test 100
syntect-server-657b89b6f4-p59x6 test 100
worker-6d68db5b5c-twxkk test 100
```
<br> Backport a49fce2 from #778
Co-authored-by: Marc <7050295+marcleblanc2@users.noreply.github.com>
Copy file name to clipboardExpand all lines: charts/sourcegraph-executor/dind/README.md
+1Lines changed: 1 addition & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -79,6 +79,7 @@ In addition to the documented values, the `executor` and `private-docker-registr
79
79
| sourcegraph.nodeSelector | object |`{}`| NodeSelector, learn more from the [Kubernetes documentation](https://kubernetes.io/docs/concepts/configuration/assign-pod-node/#nodeselector)|
80
80
| sourcegraph.podAnnotations | object |`{}`| Add extra annotations to attach to all pods |
81
81
| sourcegraph.podLabels | object |`{}`| Add extra labels to attach to all pods |
82
+
| sourcegraph.priorityClassName | string |`""`| Assign a priorityClass to all pods (daemonSets, deployments, and statefulSets) |
82
83
| sourcegraph.tolerations | list |`[]`| Tolerations, learn more from the [Kubernetes documentation](https://kubernetes.io/docs/concepts/scheduling-eviction/taint-and-toleration/)|
83
84
| storageClass.allowedTopologies | object |`{}`| Persistent volumes topology configuration, learn more from the [Kubernetes documentation](https://kubernetes.io/docs/concepts/storage/storage-classes/#allowed-topologies)|
84
85
| storageClass.create | bool |`false`| Enable creation of storageClass. Defaults to Google Cloud Platform. Disable if you have your own existing storage class |
Copy file name to clipboardExpand all lines: charts/sourcegraph-executor/dind/templates/private-docker-registry/private-docker-registry.Deployment.yaml
+1Lines changed: 1 addition & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -74,6 +74,7 @@ spec:
74
74
affinity:
75
75
{{- toYaml . | nindent 8 }}
76
76
{{- end }}
77
+
{{- with include "sourcegraph.priorityClassName" (list . "privateDockerRegistry") | trim }}{{ . | nindent 6 }}{{- end }}
Copy file name to clipboardExpand all lines: charts/sourcegraph-executor/k8s/README.md
+5-4Lines changed: 5 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -60,16 +60,16 @@ In addition to the documented values, the `executor` and `private-docker-registr
60
60
| executor.extraEnv | string |`nil`| Sets extra environment variables on the executor deployment. See `values.yaml` for the format. |
61
61
| 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. |
62
62
| executor.frontendPassword | string |`""`| The shared secret configured in the Sourcegraph instance site config under executors.accessToken. Required if `executor.frontendExistingSecret`` is not configured. |
63
-
| 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. |
63
+
| 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.kubeconfigPath | string |`""`| The path to the kubeconfig file. If not specified, the in-cluster config is used. |
67
67
| executor.kubernetesJob.deadline | string |`"1200"`| The number of seconds after which a Kubernetes job will be terminated. |
68
-
| executor.kubernetesJob.fsGroup | string |`"1000"`| The group ID which is set on the job PVC file system. |
69
-
| 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. |
68
+
| executor.kubernetesJob.fsGroup | string |`"1000"`| The group ID which is set on the job PVC file system. |
69
+
| 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. |
70
70
| executor.kubernetesJob.node.requiredAffinityMatchExpressions | string |`""`| The JSON encoded required affinity match expressions for Kubernetes Jobs. e.g. '[{\"key\":\"foo\",\"operator\":\"In\",\"values\":[\"bar\"]}]' |
71
71
| executor.kubernetesJob.node.requiredAffinityMatchFields | string |`""`| The JSON encoded required affinity match fields for Kubernetes Jobs. e.g. '[{\"key\":\"foo\",\"operator\":\"In\",\"values\":[\"bar\"]}]' |
72
-
| 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`|
72
+
| 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`|
73
73
| executor.kubernetesJob.node.tolerations | string |`""`| The JSON encoded tolerations for Kubernetes Jobs. e.g. '[{\"key\":\"foo\",\"operator\":\"Equal\",\"value\":\"bar\",\"effect\":\"NoSchedule\"}]' |
74
74
| 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\"}]' |
75
75
| 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
108
108
| sourcegraph.nodeSelector | object |`{}`| NodeSelector, learn more from the [Kubernetes documentation](https://kubernetes.io/docs/concepts/configuration/assign-pod-node/#nodeselector)|
109
109
| sourcegraph.podAnnotations | object |`{}`| Add extra annotations to attach to all pods |
110
110
| sourcegraph.podLabels | object |`{}`| Add extra labels to attach to all pods |
111
+
| sourcegraph.priorityClassName | string |`""`| Assign a priorityClass to all pods (daemonSets, deployments, and statefulSets) |
111
112
| sourcegraph.tolerations | list |`[]`| Tolerations, learn more from the [Kubernetes documentation](https://kubernetes.io/docs/concepts/scheduling-eviction/taint-and-toleration/)|
112
113
| storageClass.allowedTopologies | object |`{}`| Persistent volumes topology configuration, learn more from the [Kubernetes documentation](https://kubernetes.io/docs/concepts/storage/storage-classes/#allowed-topologies)|
113
114
| storageClass.create | bool |`false`| Enable creation of storageClass. Defaults to Google Cloud Platform. Disable if you have your own existing storage class |
Copy file name to clipboardExpand all lines: charts/sourcegraph-executor/k8s/values.yaml
+20-18Lines changed: 20 additions & 18 deletions
Original file line number
Diff line number
Diff line change
@@ -32,6 +32,8 @@ sourcegraph:
32
32
podAnnotations: { }
33
33
# -- Add extra labels to attach to all pods
34
34
podLabels: { }
35
+
# -- Assign a priorityClass to all pods (daemonSets, deployments, and statefulSets)
36
+
priorityClassName: ""
35
37
36
38
37
39
storageClass:
@@ -68,7 +70,7 @@ executor:
68
70
requests:
69
71
cpu: 500m
70
72
memory: 200Mi
71
-
# -- 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).
73
+
# -- 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).
72
74
# This will avoid unnecessary network charges as traffic will stay within the local network.
73
75
frontendUrl: ""
74
76
# -- Name of existing k8s Secret to use for frontend password
@@ -86,13 +88,13 @@ executor:
86
88
maximumNumJobs: 10
87
89
# - The maximum wall time that can be spent on a single job.
88
90
maximumRuntimePerJob: "30m"
89
-
91
+
90
92
log:
91
93
# -- Possible values are `dbug`, `info`, `warn`, `eror`, `crit`.
92
94
level: "warn"
93
95
format: "condensed"
94
96
trace: "false"
95
-
97
+
96
98
# -- The storage size of the PVC attached to the executor deployment.
97
99
storageSize: 10Gi
98
100
# -- The namespace in which jobs are generated by the executor.
@@ -102,24 +104,24 @@ executor:
102
104
# -- The containerSecurityContext for the executor image
103
105
securityContext:
104
106
# @default -- nil; accepts [0, 2147483647]
105
-
runAsUser:
107
+
runAsUser:
106
108
# @default -- nil; accepts [0, 2147483647]
107
-
runAsGroup:
109
+
runAsGroup:
108
110
# @default -- nil; accepts [0, 2147483647]
109
111
fsGroup:
110
112
# @default -- false; accepts [true, false]
111
113
privileged: false
112
-
114
+
113
115
kubernetesJob:
114
116
# -- The number of seconds after which a Kubernetes job will be terminated.
115
117
deadline: "1200"
116
118
# -- (int) The user ID to run Kubernetes jobs as.
117
119
# @default -- `nil`; accepts [0, 2147483647]
118
-
runAsUser:
120
+
runAsUser:
119
121
# -- (int) The group ID to run Kubernetes jobs as.
120
122
# @default -- `nil`; accepts [0, 2147483647]
121
-
runAsGroup:
122
-
# -- The group ID which is set on the job PVC file system.
123
+
runAsGroup:
124
+
# -- The group ID which is set on the job PVC file system.
123
125
fsGroup: "1000"
124
126
resources:
125
127
requests:
@@ -132,11 +134,11 @@ executor:
132
134
cpu: ""
133
135
# -- The maximum memory for a job.
134
136
memory: "12Gi"
135
-
137
+
136
138
node:
137
-
# -- The name of the Kubernetes Node to create job pods on. If not specified, the pods are created on the first available node.
139
+
# -- The name of the Kubernetes Node to create job pods on. If not specified, the pods are created on the first available node.
138
140
name: ""
139
-
# -- A comma separated list of values to use as a node selector for Kubernetes Jobs. e.g. `foo=bar,app=my-app`
141
+
# -- A comma separated list of values to use as a node selector for Kubernetes Jobs. e.g. `foo=bar,app=my-app`
140
142
selector: ""
141
143
# -- The JSON encoded tolerations for Kubernetes Jobs. e.g. '[{\"key\":\"foo\",\"operator\":\"Equal\",\"value\":\"bar\",\"effect\":\"NoSchedule\"}]'
142
144
tolerations: ""
@@ -150,28 +152,28 @@ executor:
150
152
affinity: ""
151
153
# -- The JSON encoded pod anti-affinity for Kubernetes Jobs. e.g. '[{\"labelSelector\": {\"matchExpressions\": [{\"key\": \"foo\",\"operator\": \"In\",\"values\": [\"bar\"]}]},\"topologyKey\": \"kubernetes.io/hostname\"}]'
152
154
antiAffinity: ""
153
-
155
+
154
156
debug:
155
157
# -- If true, Kubernetes jobs will not be deleted after they complete. Not recommended for production use as it can hit cluster limits.
156
158
keepJobs: "false"
157
159
keepWorkspaces: "false"
158
-
160
+
159
161
# -- Affinity,
160
162
# learn more from the [Kubernetes documentation](https://kubernetes.io/docs/concepts/scheduling-eviction/assign-pod-node/#affinity-and-anti-affinity)
161
163
affinity: { }
162
-
164
+
163
165
# -- NodeSelector,
164
166
# learn more from the [Kubernetes documentation](https://kubernetes.io/docs/concepts/configuration/assign-pod-node/#nodeselector)
165
167
nodeSelector: { }
166
-
168
+
167
169
# -- Tolerations,
168
170
# learn more from the [Kubernetes documentation](https://kubernetes.io/docs/concepts/scheduling-eviction/taint-and-toleration/)
169
171
tolerations: [ ]
170
-
172
+
171
173
# -- Sets extra environment variables on the executor deployment. See `values.yaml` for the format.
172
174
extraEnv:
173
175
# - name: MY_ENV
174
176
# value: my_value
175
-
177
+
176
178
# -- For local deployments the host is 'host.docker.internal' and this needs to be true
0 commit comments