Skip to content

fix: create instances for the Parallel scale policy - #640

Merged
scotwells merged 2 commits into
mainfrom
claude/project-thread-l5glq9
Nov 11, 2026
Merged

scotwells merged 2 commits into
mainfrom
claude/project-thread-l5glq9

Conversation

@scotwells

Copy link
Copy Markdown
Contributor

Requested by Scot Schuchert-Wells · project thread

A Workload that asks for the Parallel instance management policy is accepted but never gets any instances, and nothing tells the user why. This change implements Parallel, so missing instances are created and surplus ones deleted all at once instead of one at a time waiting on readiness. Template changes still replace instances one at a time, held until nothing is being created or is waiting, matching how StatefulSets treat Parallel. The policy field now only admits OrderedReady and Parallel, and the controller returns an error for any other value instead of quietly doing nothing.

Fixes #524

Test plan

  • New unit tests cover Parallel fresh deploys, scale up past a not-ready instance, scale down, and one-at-a-time template rollout
  • Existing OrderedReady unit tests and the controller and webhook envtest suites pass
  • Regenerated CRDs and API docs show the new enum on Workloads and WorkloadDeployments
  • In staging, a one-replica Workload set to Parallel gets its instance and a scale to three creates the rest together

Generated by Claude Code

A Workload with instanceManagementPolicy Parallel was accepted by the API
but never got instances: the stateful control only emitted create, delete
and replace actions for OrderedReady, so every other value silently did
nothing.

Key changes:
- implement Parallel: create and delete every pending instance at once
  without waiting on readiness, and replace outdated instances one at a
  time once nothing is being created or is waiting
- restrict instanceManagementPolicy to OrderedReady and Parallel at
  admission so unknown values are rejected instead of ignored
- return an error for an unsupported policy rather than doing nothing
- add unit tests for Parallel scale up, scale down and template rollout
@scotwells
scotwells requested a review from a team as a code owner November 11, 2026 15:01
@scotwells scotwells self-assigned this Nov 11, 2026
Adding the Parallel case pushed GetActions over the linter's complexity
limit, so the per-policy ordering moves into its own function.

Key changes:
- move the policy switch into orderRolloutActions
- use a constant for the repeated test image and drop an unused test
  helper parameter

@kevwilliams kevwilliams 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.

Verified the executor runs every unskipped action, so Parallel creates and deletes land together, and recreates stay held behind pending creates or waits.

@scotwells
scotwells merged commit be0387e into main Nov 11, 2026
11 checks passed
@scotwells
scotwells deleted the claude/project-thread-l5glq9 branch November 11, 2026 15:28

@ecv ecv 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.

Approve. Parallel now creates and deletes instances at once and still replaces them one at a time on a template change: any pending create or wait skips every recreate, and forcing recreates never to skip fails two Parallel tests. CRDs regenerate with no diff, and main's own stateful tests pass against this head.

  • OrderedReady keeps its action order, but two edges changed. An empty policy now runs as OrderedReady where it used to produce no actions, and any value outside the new enum makes GetActions return an error where it used to stall silently.

Follow-ups:

  • A Workload stored with a policy outside OrderedReady/Parallel will start failing reconciles once this ships. Check stored data before the release, and call the enum out in the release notes.
  • Scale-down deletes are not counted in the recreate gate, so a scale-down and a template change in one reconcile terminate several instances at once. Intended, but untested; add a test for that case.

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.

Workloads with the Parallel scale policy never create instances

3 participants