-
Notifications
You must be signed in to change notification settings - Fork 18
Add a version limit. #82
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
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.
Co-authored-by: Shivam <[email protected]>
Fix webhook test to use new version limit.
There was a problem hiding this 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
MaxVersionsfield in the CRD with a default of 75 and OpenAPI validation (1–100) - Enforce the version limit in
shouldCreateDeploymentand updateGeneratePlanto pass a logger - Populate
VersionCountin 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.
Shivs11
left a comment
There was a problem hiding this 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!
jlegrone
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm pending comments
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.
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
Closes
How was this tested: