Skip to content

Commit 08142a2

Browse files
committed
fix(sourcegraph): unable to block job when running replicas
1 parent f2cf93e commit 08142a2

File tree

4 files changed

+21
-2
lines changed

4 files changed

+21
-2
lines changed

charts/sourcegraph/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -355,6 +355,7 @@ In addition to the documented values, all services also support the following va
355355
| syntectServer.resources | object | `{"limits":{"cpu":"4","memory":"6G"},"requests":{"cpu":"250m","memory":"2G"}}` | Resource requests & limits for the `syntect-server` container, learn more from the [Kubernetes documentation](https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/) |
356356
| syntectServer.serviceAccount.create | bool | `false` | Enable creation of ServiceAccount for `syntect-server` |
357357
| syntectServer.serviceAccount.name | string | `""` | Name of the ServiceAccount to be created or an existing ServiceAccount |
358+
| worker.blocklist | list | `[]` | List of jobs to block globally If replicas are configured, use this values to block jobs instead of manually setting WORKER_JOB_BLOCKLIST |
358359
| worker.containerSecurityContext | object | `{"allowPrivilegeEscalation":false,"readOnlyRootFilesystem":true,"runAsGroup":101,"runAsUser":100}` | Security context for the `worker` container, learn more from the [Kubernetes documentation](https://kubernetes.io/docs/tasks/configure-pod-container/security-context/#set-the-security-context-for-a-container) |
359360
| worker.env | object | `{}` | Environment variables for the `worker` container |
360361
| worker.image.defaultTag | string | `"5.9.1590@sha256:b258021d297a7a562982a5606507d4e4ddb27ebe010f3fdbbda20ab7f0a9f4fc"` | Docker image tag for the `worker` image |

charts/sourcegraph/templates/worker/worker.Deployment.yaml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,13 @@
1+
{{- $globalBlocklist := "" }}
2+
{{- if .Values.worker.blocklist }}
3+
{{- $globalBlocklist = join "," (.Values.worker.blocklist | uniq | sortAlpha) }}
4+
{{- end }}
5+
16
{{- if not .Values.worker.replicas }}
2-
{{- include "sourcegraph.worker" (list . "" "" "" .Values.worker.resources ) | nindent 0 }}
7+
{{- include "sourcegraph.worker" (list . "" "" $globalBlocklist .Values.worker.resources ) | nindent 0 }}
38
{{- else }}
49
{{- $dedicatedJobs := list }}
10+
{{- $dedicatedJobs = $dedicatedJobs | concat .Values.worker.blocklist }}
511
{{- range .Values.worker.replicas }}
612
{{- $dedicatedJobs = $dedicatedJobs | concat .jobs }}
713
{{- end }}

charts/sourcegraph/tests/worker_test.yaml

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,9 @@ tests:
3333
template: worker/worker.Deployment.yaml
3434
set:
3535
worker:
36+
blocklist:
37+
- rogue-job-1
38+
- rogue-job-2
3639
replicas:
3740
- jobs: ["job1", "job2"]
3841
- jobs: ["job3", "job4"]
@@ -47,7 +50,7 @@ tests:
4750
path: spec.template.spec.containers[0].env
4851
content:
4952
name: WORKER_JOB_BLOCKLIST
50-
value: job1,job2,job3,job4
53+
value: job1,job2,job3,job4,rogue-job-1,rogue-job-2
5154
- isEmpty:
5255
path: spec.selector.matchLabels.worker-replica
5356
- it: should have the correct worker-0 deployment
@@ -61,6 +64,9 @@ tests:
6164
requests:
6265
cpu: 500m
6366
memory: 2G
67+
blocklist:
68+
- rogue-job-1
69+
- rogue-job-2
6470
replicas:
6571
- jobs: ["job1", "job2"]
6672
- jobs: ["job3", "job4"]
@@ -98,6 +104,9 @@ tests:
98104
template: worker/worker.Deployment.yaml
99105
set:
100106
worker:
107+
blocklist:
108+
- rogue-job-1
109+
- rogue-job-2
101110
replicas:
102111
- jobs: ["job1", "job2"]
103112
- jobs: ["job3", "job4"]

charts/sourcegraph/values.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1282,6 +1282,9 @@ worker:
12821282
podSecurityContext: {}
12831283
# -- Number of `worker` pod
12841284
replicaCount: 1
1285+
# -- List of jobs to block globally
1286+
# If replicas are configured, use this values to block jobs instead of manually setting WORKER_JOB_BLOCKLIST
1287+
blocklist: []
12851288
# -- Scale worker horizontally by configuring additional replicas dedicated to specific jobs.
12861289
# for each replica, configure the dedicated jobs to run on this replica.
12871290
# learn more from https://sourcegraph.com/docs/admin/workers#3-split-jobs-and-scale-independently

0 commit comments

Comments
 (0)