Skip to content

Wire BackendReplicas through to StatefulSet replica count#4291

Merged
yrobla merged 1 commit intomainfrom
issue-4209
Mar 23, 2026
Merged

Wire BackendReplicas through to StatefulSet replica count#4291
yrobla merged 1 commit intomainfrom
issue-4209

Conversation

@yrobla
Copy link
Copy Markdown
Contributor

@yrobla yrobla commented Mar 20, 2026

Summary

Threads RunConfig.BackendReplicas (*int32) from the runner through runtime.Setup and DeployWorkloadOptions to the Kubernetes StatefulSet apply configuration. When BackendReplicas is nil the replicas field is omitted from the server-side apply spec, preserving HPA/kubectl control; when set, the specified count is applied.

Fixes #4209

Type of change

  • Bug fix
  • New feature
  • Refactoring (no behavior change)
  • Dependency update
  • Documentation
  • Other (describe):

Test plan

  • Unit tests (task test)
  • E2E tests (task test-e2e)
  • Linting (task lint-fix)
  • Manual testing (describe below)

Changes

File Change

Does this introduce a user-facing change?

Special notes for reviewers

@github-actions github-actions bot added the size/XS Extra small PR: < 100 lines changed label Mar 20, 2026
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: f7687de321

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@yrobla yrobla requested a review from Copilot March 20, 2026 13:34
@github-actions github-actions bot added size/S Small PR: 100-299 lines changed and removed size/XS Extra small PR: < 100 lines changed labels Mar 20, 2026
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Threads an optional backend replica count from runner configuration through the runtime deployment pipeline into the Kubernetes StatefulSet server-side apply configuration, allowing explicit replica setting when configured while preserving external scaling control when unset.

Changes:

  • Extend runtime.Setup and DeployWorkloadOptions to carry BackendReplicas *int32.
  • Pass configured backend replica count from the runner into runtime setup.
  • Update the Kubernetes client to only apply StatefulSetSpec.replicas when BackendReplicas is non-nil, and add unit tests for replica behaviors.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
pkg/runtime/setup.go Adds backendReplicas parameter and wires it into deploy options.
pkg/runner/runner.go Reads backend replicas from config and passes into runtime.Setup.
pkg/container/runtime/types.go Adds BackendReplicas *int32 to DeployWorkloadOptions.
pkg/container/kubernetes/client.go Conditionally applies StatefulSet replicas only when explicitly configured.
pkg/container/kubernetes/client_test.go Adds tests intended to cover nil vs explicit replica behavior.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@codecov
Copy link
Copy Markdown

codecov bot commented Mar 20, 2026

Codecov Report

❌ Patch coverage is 57.89474% with 8 lines in your changes missing coverage. Please review.
✅ Project coverage is 68.68%. Comparing base (a685e89) to head (d60f3b5).
⚠️ Report is 19 commits behind head on main.

Files with missing lines Patch % Lines
pkg/runner/runner.go 40.00% 2 Missing and 1 partial ⚠️
pkg/container/kubernetes/client.go 81.81% 1 Missing and 1 partial ⚠️
pkg/runtime/setup.go 0.00% 2 Missing ⚠️
pkg/container/runtime/types.go 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #4291      +/-   ##
==========================================
- Coverage   68.85%   68.68%   -0.17%     
==========================================
  Files         473      473              
  Lines       47899    47965      +66     
==========================================
- Hits        32979    32943      -36     
- Misses      12279    12317      +38     
- Partials     2641     2705      +64     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@github-actions github-actions bot added size/S Small PR: 100-299 lines changed and removed size/S Small PR: 100-299 lines changed labels Mar 20, 2026
…nt (RC-11)

Threads RunConfig.BackendReplicas (*int32) from the runner through
runtime.Setup and DeployWorkloadOptions to the Kubernetes StatefulSet
apply configuration. When BackendReplicas is nil the replicas field is
omitted from the server-side apply spec, preserving HPA/kubectl control;
when set, the specified count is applied.

Closes #4209
@yrobla yrobla requested a review from Copilot March 20, 2026 13:43
@github-actions github-actions bot added size/S Small PR: 100-299 lines changed and removed size/S Small PR: 100-299 lines changed labels Mar 20, 2026
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@yrobla yrobla merged commit efb15e9 into main Mar 23, 2026
49 checks passed
@yrobla yrobla deleted the issue-4209 branch March 23, 2026 14:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/S Small PR: 100-299 lines changed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Implement configurable StatefulSet replica count (RC-11)

4 participants