fix(cli): pause and resume the deployed etcd with a StatefulSet control plane by blacksoxx · Pull Request #4208 · loft-sh/vcluster · GitHub
Skip to content

fix(cli): pause and resume the deployed etcd with a StatefulSet control plane - #4208

Open
blacksoxx wants to merge 2 commits into
loft-sh:mainfrom
blacksoxx:pause-resume-deployed-etcd
Open

blacksoxx wants to merge 2 commits into
loft-sh:mainfrom
blacksoxx:pause-resume-deployed-etcd

Conversation

@blacksoxx

@blacksoxx blacksoxx commented Oct 13, 2026 •

Copy link
Copy Markdown

What issue type does this pull request address? (keep at least one, remove the others)
/kind bugfix

What does this pull request do? Which issues does it resolve? (use resolves #<issue_number> if possible)
resolves #4194

PauseVCluster only scaled the etcd StatefulSet down inside the branch that handles a Deployment control plane, and ResumeVCluster only scaled it up there, so with a StatefulSet control plane vcluster pause left the deployed etcd pods running and vcluster resume never touched them. Etcd is now scaled after the control plane regardless of the control plane kind; the Deployment layout keeps its api and controller scale down in the legacy branch and the isRestore guard is unchanged.

PauseResumeDeployedEtcdSpec mirrors PauseResumeScaledDownSpec with controlPlane.backingStore.etcd.deploy.enabled=true and a volume claim, so the control plane renders as a StatefulSet, and asserts the <name>-etcd StatefulSet is annotated and at 0 replicas with no etcd pods after pause, then back to 1 with running pods after resume. createAndWaitForReady takes extra --set arguments for that. The spec is labelled pr and core; a ginkgo dry run with the pr filter lists both of its specs.

Please provide a short message that should be published in the vcluster release notes
Fixed an issue where vcluster pause did not scale down the deployed etcd StatefulSet when the control plane runs as a StatefulSet, and resume did not scale it back up.

What else do we need to know?
A cluster paused by an older CLI, with the control plane at 0 and etcd still running, gets its etcd paused on the next vcluster pause because the control plane's already paused path still reports it as found.

E2E Tests

Default Test Execution

The mandatory PR suite runs automatically. Only specify additional test suites below if needed.

Adding New Test Suites

When adding a new ginkgo test suite:

  • Add labels to the test suite
  • Update label-filter section below to execute the new test suite
  • Verify test suite runs in CI/CD pipeline

Additional test suites

Additional test suite(s) that will be executed before the mandatory PR suite:

none

Note

Medium Risk
Changes core pause/resume lifecycle behavior for deployed etcd across control-plane layouts; incorrect scaling could leave clusters partially running or fail to resume.

Overview
Fixes pause/resume so a deployed etcd StatefulSet is scaled down and back up when the control plane runs as a StatefulSet, not only when it uses the Deployment layout.

In PauseVCluster / ResumeVCluster, etcd scale operations were nested inside the branch that handles Deployment control planes, so vcluster pause could leave etcd pods running and vcluster resume never restored them. Etcd scaling now runs after control-plane scaling for both layouts; Deployment-only api/controller scale-down and the isRestore guard on etcd pause are unchanged.

E2E adds PauseResumeDeployedEtcdSpec (registered in the lifecycle suite): creates a cluster with deployed etcd and a volume claim (StatefulSet control plane), then asserts etcd pause annotations, zero replicas, and pod teardown, then resume to one replica and running pods. createAndWaitForReady accepts optional extra vcluster create --set arguments for that setup.

Reviewed by Cursor Bugbot for commit 37b0934. Bugbot is set up for automated code reviews on this repo. Configure here.

…ol plane

The etcd StatefulSet was only scaled down and up inside the branch that
handles a Deployment control plane, so with a StatefulSet control plane
vcluster pause left the etcd pods running and resume never touched them.
Scale etcd after the control plane regardless of the control plane kind.

Signed-off-by: Youssef Omar Bouden <youssef.bouden2002@gmail.com>
@blacksoxx
blacksoxx requested review from a team as code owners October 13, 2026 10:12

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Want fixes drafted automatically? Bugbot Autofix can create code changes for findings. A team admin can enable Autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 19de961. Configure here.

Comment thread e2e/test_core/lifecycle/test_pause_resume.go Outdated
Signed-off-by: Youssef Omar Bouden <youssef.bouden2002@gmail.com>

This branch has not been deployed

No deployments
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.

Pause doesn't work with StatefulSet control plane

1 participant