feat(worker): support per-replica replicaCount override#887
Merged
Conversation
Allow each dedicated worker replica configured under `worker.replicas` to specify its own `replicaCount`, falling back to the top-level `worker.replicaCount` when unset. This lets operators scale individual workers horizontally only for jobs that are safe to do so. https://claude.ai/code/session_01L76QgBN8t9M3gbJo5NdyZo
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Follow-up to #582, which added support for scaling
workerhorizontally by configuring dedicated replicas per set of jobs.This PR adds a
replicaCountoverride for each distinct worker replica. Previously every generated worker deployment (the primaryworkerand each dedicatedworker-N) inherited the single top-levelworker.replicaCount. Now each entry underworker.replicascan set its ownreplicaCount, falling back toworker.replicaCountwhen unset.This lets operators scale individual dedicated workers horizontally only for jobs that are safe to scale that way.
Changes
templates/_worker.tpl: added a$replicaCountparameter to thesourcegraph.workerhelper and use it forspec.replicas.templates/worker/worker.Deployment.yaml: passworker.replicaCountfor the primary worker, and per-replicareplicaCount(defaulting toworker.replicaCount) for each dedicated replica.values.yaml: documented the new per-replicareplicaCountoption.tests/worker_test.yaml: added tests covering the default-inheritance and per-replica override behaviour.CHANGELOG.md: added an entry.Test plan
helm unittest charts/sourcegraph— all 99 tests pass (7 in the worker suite)../scripts/helm-docs.shproduces no uncommitted changes.Slack thread: https://sourcegraph.slack.com/archives/C0ATB8N5P3Q/p1781106413632049
Generated by Claude Code