mirror of
https://github.com/coder/coder.git
synced 2026-09-24 15:04:27 +08:00
feat: add inactivity cleanup and failure cleanup configuration fields to Template Schedule Form (#7402)
* added workspace actions entitlement * added workspace actions experiment * added new route for template enterprise meta * removing new route; repurposing old * add new fields to get endpoints * removed workspace actions experiment * added logic to enterprise template store * added new form fields * feature flagged new fields * fix validation * fixed submit btn * fix tests * changed ttl defaults * added FE tests * added BE tests * fixed lint * adjusted comment language * fixing unstaged changes check * fix test * Update coderd/database/migrations/000122_add_template_cleanup_ttls.down.sql Co-authored-by: Dean Sheather <dean@deansheather.com> * Update coderd/database/migrations/000122_add_template_cleanup_ttls.up.sql Co-authored-by: Dean Sheather <dean@deansheather.com> --------- Co-authored-by: Dean Sheather <dean@deansheather.com>
This commit is contained in:
co-authored by
Dean Sheather
parent
3632ac8c01
commit
5ffa6dae50
@@ -18,6 +18,10 @@ type TemplateScheduleOptions struct {
|
||||
//
|
||||
// If set, users cannot disable automatic workspace shutdown.
|
||||
MaxTTL time.Duration `json:"max_ttl"`
|
||||
// If FailureTTL is set, all failed workspaces will be stopped automatically after this time has elapsed.
|
||||
FailureTTL time.Duration `json:"failure_ttl"`
|
||||
// If InactivityTTL is set, all inactive workspaces will be deleted automatically after this time has elapsed.
|
||||
InactivityTTL time.Duration `json:"inactivity_ttl"`
|
||||
}
|
||||
|
||||
// TemplateScheduleStore provides an interface for retrieving template
|
||||
@@ -47,9 +51,11 @@ func (*agplTemplateScheduleStore) GetTemplateScheduleOptions(ctx context.Context
|
||||
UserAutostartEnabled: true,
|
||||
UserAutostopEnabled: true,
|
||||
DefaultTTL: time.Duration(tpl.DefaultTTL),
|
||||
// Disregard the value in the database, since MaxTTL is an enterprise
|
||||
// feature.
|
||||
MaxTTL: 0,
|
||||
// Disregard the values in the database, since MaxTTL, FailureTTL, and InactivityTTL are enterprise
|
||||
// features.
|
||||
MaxTTL: 0,
|
||||
FailureTTL: 0,
|
||||
InactivityTTL: 0,
|
||||
}, nil
|
||||
}
|
||||
|
||||
@@ -68,5 +74,7 @@ func (*agplTemplateScheduleStore) SetTemplateScheduleOptions(ctx context.Context
|
||||
AllowUserAutostart: tpl.AllowUserAutostart,
|
||||
AllowUserAutostop: tpl.AllowUserAutostop,
|
||||
MaxTTL: tpl.MaxTTL,
|
||||
FailureTTL: tpl.FailureTTL,
|
||||
InactivityTTL: tpl.InactivityTTL,
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user