mirror of
https://github.com/coder/coder.git
synced 2026-06-02 20:48:20 +00:00
feat: implement expiration policy logic for prebuilds (#17996)
## Summary This PR introduces support for expiration policies in prebuilds. The TTL (time-to-live) is retrieved from the Terraform configuration ([terraform-provider-coder PR](https://github.com/coder/terraform-provider-coder/pull/404)): ``` prebuilds = { instances = 2 expiration_policy { ttl = 86400 } } ``` **Note**: Since there is no need for precise TTL enforcement down to the second, in this implementation expired prebuilds are handled in a single reconciliation cycle: they are deleted, and new instances are created only if needed to match the desired count. ## Changes * The outcome of a reconciliation cycle is now expressed as a slice of reconciliation actions, instead of a single aggregated action. * Adjusted reconciliation logic to delete expired prebuilds and guarantee that the number of desired instances is correct. * Updated relevant data structures and methods to support expiration policies parameters. * Added documentation to `Prebuilt workspaces` page * Update `terraform-provider-coder` to version 2.5.0: https://github.com/coder/terraform-provider-coder/releases/tag/v2.5.0 Depends on: https://github.com/coder/terraform-provider-coder/pull/404 Fixes: https://github.com/coder/coder/issues/17916
This commit is contained in:
Generated
+841
-762
File diff suppressed because it is too large
Load Diff
@@ -57,8 +57,16 @@ message RichParameterValue {
|
||||
string value = 2;
|
||||
}
|
||||
|
||||
// ExpirationPolicy defines the policy for expiring unclaimed prebuilds.
|
||||
// If a prebuild remains unclaimed for longer than ttl seconds, it is deleted and
|
||||
// recreated to prevent staleness.
|
||||
message ExpirationPolicy {
|
||||
int32 ttl = 1;
|
||||
}
|
||||
|
||||
message Prebuild {
|
||||
int32 instances = 1;
|
||||
ExpirationPolicy expiration_policy = 2;
|
||||
}
|
||||
|
||||
// Preset represents a set of preset parameters for a template version.
|
||||
|
||||
Reference in New Issue
Block a user