Skip to content

Conversation

@robholland
Copy link
Collaborator

This prevents the controller from trying to create deployment versions when the Temporal server may reject them.

The default limit is 75, which is 75% of the default server side limit of 100.

The user may override the limit by setting MaxVersions on the CRD. If the user raises this sufficiently that it matches the server side limit and allows deploys to build up until that point, they will start to fail as the controller is not able to make progress.

Fixes #7.

What was changed

Why?

Checklist

  1. Closes

  2. How was this tested:

  1. Any docs updates needed?

This prevents the controller from trying to create deployment versions when the Temporal server may reject them.

The default limit is 75, which is 75% of the default server side limit of 100.

The user may override the limit by setting MaxVersions on the CRD. If the user raises this sufficiently that it matches the server side limit and allows deploys to build up until that point, they will start to fail as the controller is not able to make progress.

Fixes temporalio#7.
@robholland robholland requested a review from jlegrone as a code owner July 11, 2025 14:11
@robholland robholland requested a review from Shivs11 July 14, 2025 13:21
@jlegrone jlegrone requested a review from Copilot July 14, 2025 19:52
Copy link
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

Adds a new MaxVersions limit to prevent creating deployments beyond Temporal’s server limit and wires it through defaulting, validation, plan generation, and status mapping.

  • Introduce MaxVersions field in the CRD with a default of 75 and OpenAPI validation (1–100)
  • Enforce the version limit in shouldCreateDeployment and update GeneratePlan to pass a logger
  • Populate VersionCount in the status mapper and add corresponding tests

Reviewed Changes

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

Show a summary per file
File Description
internal/planner/planner.go Added getMaxVersions, enforced limit in shouldCreateDeployment, updated GeneratePlan signature
internal/planner/planner_test.go Added tests for version-limit behavior and updated sunset defaults
internal/controller/state_mapper.go Set status.VersionCount based on m.temporalState.Versions
internal/controller/state_mapper_test.go Added test to verify VersionCount is mapped correctly
api/v1alpha1/worker_types.go Defined DefaultMaxVersions constant and added MaxVersions field
api/v1alpha1/temporalworker_webhook.go Defaulted and validated MaxVersions, removed old default constants
api/v1alpha1/temporalworker_webhook_test.go Added validation and defaulting tests for MaxVersions
Comments suppressed due to low confidence (1)

api/v1alpha1/worker_types.go:73

  • [nitpick] The doc comments for MaxVersions are misaligned due to mixed spaces and tabs. Align the comment indentation with the surrounding fields to follow GoDoc formatting and project style.
          // MaxVersions defines the maximum number of worker deployment versions allowed. 

Copy link
Member

@Shivs11 Shivs11 left a comment

Choose a reason for hiding this comment

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

thanks for adding the changes!

Copy link
Collaborator

@jlegrone jlegrone left a comment

Choose a reason for hiding this comment

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

lgtm pending comments

@robholland robholland requested a review from a team as a code owner July 17, 2025 12:13
Remove maximum MaxVersion validation as we don't have a sensible maxium (we cannot know what the server has configured).
Refactor webhook defaults a little to be able to use it from tests rather than
runtime per-call defaulting.
@robholland robholland requested a review from jlegrone July 17, 2025 15:46
@robholland robholland merged commit 6e59802 into temporalio:main Jul 18, 2025
4 checks passed
@robholland robholland deleted the robholland/issue7 branch July 18, 2025 12:13
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.

Avoid blocking new deployments when max deployment version limit is reached

3 participants