-
Notifications
You must be signed in to change notification settings - Fork 24
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(sourcegraph): add support to scale worker horizontally #582
feat(sourcegraph): add support to scale worker horizontally #582
Conversation
090699e
to
99dc046
Compare
99dc046
to
ef05c2b
Compare
- it: should have the correct worker-0 deployment | ||
template: worker/worker.Deployment.yaml | ||
set: | ||
worker: | ||
resources: | ||
limits: | ||
cpu: "2" | ||
memory: 4G | ||
requests: | ||
cpu: 500m | ||
memory: 2G | ||
replicas: | ||
- jobs: ["job1", "job2"] | ||
- jobs: ["job3", "job4"] | ||
documentIndex: 1 | ||
asserts: | ||
- containsDocument: | ||
kind: Deployment | ||
apiVersion: apps/v1 | ||
name: worker-0 | ||
- contains: | ||
path: spec.template.spec.containers[0].env | ||
content: | ||
name: WORKER_JOB_ALLOWLIST | ||
value: job1,job2 | ||
- notContains: | ||
path: spec.template.spec.containers[0].env | ||
content: | ||
name: WORKER_JOB_BLOCKLIST | ||
- equal: | ||
path: spec.selector.matchLabels.worker-replica | ||
value: worker-0 | ||
- equal: | ||
path: spec.template.metadata.labels.worker-replica | ||
value: worker-0 | ||
- equal: | ||
path: spec.template.spec.containers[0].resources | ||
value: | ||
limits: | ||
cpu: "2" | ||
memory: 4G | ||
requests: | ||
cpu: 500m | ||
memory: 2G | ||
- it: should have the correct worker-1 deployment | ||
template: worker/worker.Deployment.yaml | ||
set: | ||
worker: | ||
replicas: | ||
- jobs: ["job1", "job2"] | ||
- jobs: ["job3", "job4"] | ||
resources: | ||
limits: | ||
cpu: 2000m | ||
memory: 4Gi | ||
requests: | ||
cpu: 2000m | ||
memory: 4Gi | ||
documentIndex: 2 | ||
asserts: | ||
- containsDocument: | ||
kind: Deployment | ||
apiVersion: apps/v1 | ||
name: worker-1 | ||
- contains: | ||
path: spec.template.spec.containers[0].env | ||
content: | ||
name: WORKER_JOB_ALLOWLIST | ||
value: job3,job4 | ||
- notContains: | ||
path: spec.template.spec.containers[0].env | ||
content: | ||
name: WORKER_JOB_BLOCKLIST | ||
- equal: | ||
path: spec.selector.matchLabels.worker-replica | ||
value: worker-1 | ||
- equal: | ||
path: spec.template.metadata.labels.worker-replica | ||
value: worker-1 | ||
- equal: | ||
path: spec.template.spec.containers[0].resources | ||
value: | ||
limits: | ||
cpu: 2000m | ||
memory: 4Gi | ||
requests: | ||
cpu: 2000m | ||
memory: 4Gi |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👀
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice! I really like the config format for this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just tested and works as expected, awesome 🚀
ef05c2b
to
f8d5e61
Compare
ref CLO-1023
https://sourcegraph.com/docs/admin/workers#3-split-jobs-and-scale-independently
worker
is not really horizontally scalable, and it requires manually creating additionallyworker
deployments with the correctWORKER_JOB_ALLOWLIST
andWORKER_JOB_BLOCKLIST
environment variable.This PR added native support for managing multiple worker deployment through helm template.
By default, it will work as is to day with a single
worker
deployment. To enable additional dedicated worker, user can specify the following overrides:This will create 3 distinct worker deployment (
worker
,worker-0
, andworker-1
) with the correctWORKER_JOB_*
env var. Additinoally, we also support overriding replica specific resources config. See unit test for more information.Checklist
Test plan
CI, and manual testing with
all pods are healthy
you can also play around with
helm template --debug -f ./override.yaml sourcegraph charts/sourcegraph/.
and inspect the rendered YAML