Skip to content

feat(worker): support per-replica replicaCount override#887

Merged
michaellzc merged 1 commit into
mainfrom
claude/slack-session-n021b7
Jun 10, 2026
Merged

feat(worker): support per-replica replicaCount override#887
michaellzc merged 1 commit into
mainfrom
claude/slack-session-n021b7

Conversation

@michaellzc

Copy link
Copy Markdown
Member

Summary

Follow-up to #582, which added support for scaling worker horizontally by configuring dedicated replicas per set of jobs.

This PR adds a replicaCount override for each distinct worker replica. Previously every generated worker deployment (the primary worker and each dedicated worker-N) inherited the single top-level worker.replicaCount. Now each entry under worker.replicas can set its own replicaCount, falling back to worker.replicaCount when unset.

This lets operators scale individual dedicated workers horizontally only for jobs that are safe to scale that way.

worker:
  replicas:
    - replicaCount: 3 # make sure jobs are safe to scale horizontally
      jobs:
        - job1
        - job2
    - jobs:
        - job3 # inherits worker.replicaCount

Changes

  • templates/_worker.tpl: added a $replicaCount parameter to the sourcegraph.worker helper and use it for spec.replicas.
  • templates/worker/worker.Deployment.yaml: pass worker.replicaCount for the primary worker, and per-replica replicaCount (defaulting to worker.replicaCount) for each dedicated replica.
  • values.yaml: documented the new per-replica replicaCount option.
  • 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.sh produces no uncommitted changes.

Slack thread: https://sourcegraph.slack.com/archives/C0ATB8N5P3Q/p1781106413632049


Generated by Claude Code

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
@michaellzc michaellzc requested a review from a team June 10, 2026 15:54

@filiphaftek filiphaftek left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice!

@michaellzc michaellzc merged commit 33eafc2 into main Jun 10, 2026
5 checks passed
@michaellzc michaellzc deleted the claude/slack-session-n021b7 branch June 10, 2026 16:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants