mirror of
https://github.com/coder/coder.git
synced 2026-09-24 15:04:27 +08:00
chore: remove max_ttl from templates (#12644)
* chore: remove max_ttl from templates Completely removing max_ttl as a feature on template scheduling. Must use other template scheduling features to achieve autostop.
This commit is contained in:
+2
-18
@@ -24,7 +24,6 @@ func (r *RootCmd) templateEdit() *serpent.Command {
|
||||
icon string
|
||||
defaultTTL time.Duration
|
||||
activityBump time.Duration
|
||||
maxTTL time.Duration
|
||||
autostopRequirementDaysOfWeek []string
|
||||
autostopRequirementWeeks int64
|
||||
autostartRequirementDaysOfWeek []string
|
||||
@@ -53,7 +52,6 @@ func (r *RootCmd) templateEdit() *serpent.Command {
|
||||
autostopRequirementWeeks > 0 ||
|
||||
!allowUserAutostart ||
|
||||
!allowUserAutostop ||
|
||||
maxTTL != 0 ||
|
||||
failureTTL != 0 ||
|
||||
dormancyThreshold != 0 ||
|
||||
dormancyAutoDeletion != 0 ||
|
||||
@@ -69,7 +67,7 @@ func (r *RootCmd) templateEdit() *serpent.Command {
|
||||
}
|
||||
|
||||
if requiresScheduling && !entitlements.Features[codersdk.FeatureAdvancedTemplateScheduling].Enabled {
|
||||
return xerrors.Errorf("your license is not entitled to use advanced template scheduling, so you cannot set --max-ttl, --failure-ttl, --inactivityTTL, --allow-user-autostart=false or --allow-user-autostop=false")
|
||||
return xerrors.Errorf("your license is not entitled to use advanced template scheduling, so you cannot set --failure-ttl, --inactivityTTL, --allow-user-autostart=false or --allow-user-autostop=false")
|
||||
}
|
||||
|
||||
if requireActiveVersion {
|
||||
@@ -101,10 +99,6 @@ func (r *RootCmd) templateEdit() *serpent.Command {
|
||||
displayName = template.DisplayName
|
||||
}
|
||||
|
||||
if !userSetOption(inv, "max-ttl") {
|
||||
maxTTL = time.Duration(template.MaxTTLMillis) * time.Millisecond
|
||||
}
|
||||
|
||||
if !userSetOption(inv, "default-ttl") {
|
||||
defaultTTL = time.Duration(template.DefaultTTLMillis) * time.Millisecond
|
||||
}
|
||||
@@ -179,7 +173,6 @@ func (r *RootCmd) templateEdit() *serpent.Command {
|
||||
Icon: icon,
|
||||
DefaultTTLMillis: defaultTTL.Milliseconds(),
|
||||
ActivityBumpMillis: activityBump.Milliseconds(),
|
||||
MaxTTLMillis: maxTTL.Milliseconds(),
|
||||
AutostopRequirement: &codersdk.TemplateAutostopRequirement{
|
||||
DaysOfWeek: autostopRequirementDaysOfWeek,
|
||||
Weeks: autostopRequirementWeeks,
|
||||
@@ -244,11 +237,6 @@ func (r *RootCmd) templateEdit() *serpent.Command {
|
||||
Description: "Edit the template activity bump - workspaces created from this template will have their shutdown time bumped by this value when activity is detected. Maps to \"Activity bump\" in the UI.",
|
||||
Value: serpent.DurationOf(&activityBump),
|
||||
},
|
||||
{
|
||||
Flag: "max-ttl",
|
||||
Description: "Edit the template maximum time before shutdown - workspaces created from this template must shutdown within the given duration after starting, regardless of user activity. This is an enterprise-only feature. Maps to \"Max lifetime\" in the UI.",
|
||||
Value: serpent.DurationOf(&maxTTL),
|
||||
},
|
||||
{
|
||||
Flag: "autostart-requirement-weekdays",
|
||||
// workspaces created from this template must be restarted on the given weekdays. To unset this value for the template (and disable the autostop requirement for the template), pass 'none'.
|
||||
@@ -268,8 +256,6 @@ func (r *RootCmd) templateEdit() *serpent.Command {
|
||||
{
|
||||
Flag: "autostop-requirement-weekdays",
|
||||
Description: "Edit the template autostop requirement weekdays - workspaces created from this template must be restarted on the given weekdays. To unset this value for the template (and disable the autostop requirement for the template), pass 'none'.",
|
||||
// TODO(@dean): unhide when we delete max_ttl
|
||||
Hidden: true,
|
||||
Value: serpent.Validate(serpent.StringArrayOf(&autostopRequirementDaysOfWeek), func(value *serpent.StringArray) error {
|
||||
v := value.GetSlice()
|
||||
if len(v) == 1 && v[0] == "none" {
|
||||
@@ -285,9 +271,7 @@ func (r *RootCmd) templateEdit() *serpent.Command {
|
||||
{
|
||||
Flag: "autostop-requirement-weeks",
|
||||
Description: "Edit the template autostop requirement weeks - workspaces created from this template must be restarted on an n-weekly basis.",
|
||||
// TODO(@dean): unhide when we delete max_ttl
|
||||
Hidden: true,
|
||||
Value: serpent.Int64Of(&autostopRequirementWeeks),
|
||||
Value: serpent.Int64Of(&autostopRequirementWeeks),
|
||||
},
|
||||
{
|
||||
Flag: "failure-ttl",
|
||||
|
||||
Reference in New Issue
Block a user