chore: rename template restart requirement to autostop requirement (#9295)

This commit is contained in:
Dean Sheather
2023-08-29 11:35:05 -07:00
committed by GitHub
parent fc4683d8b3
commit a572800d47
40 changed files with 925 additions and 891 deletions

View File

@ -35,19 +35,19 @@ const (
type FeatureName string
const (
FeatureUserLimit FeatureName = "user_limit"
FeatureAuditLog FeatureName = "audit_log"
FeatureBrowserOnly FeatureName = "browser_only"
FeatureSCIM FeatureName = "scim"
FeatureTemplateRBAC FeatureName = "template_rbac"
FeatureUserRoleManagement FeatureName = "user_role_management"
FeatureHighAvailability FeatureName = "high_availability"
FeatureMultipleGitAuth FeatureName = "multiple_git_auth"
FeatureExternalProvisionerDaemons FeatureName = "external_provisioner_daemons"
FeatureAppearance FeatureName = "appearance"
FeatureAdvancedTemplateScheduling FeatureName = "advanced_template_scheduling"
FeatureTemplateRestartRequirement FeatureName = "template_restart_requirement"
FeatureWorkspaceProxy FeatureName = "workspace_proxy"
FeatureUserLimit FeatureName = "user_limit"
FeatureAuditLog FeatureName = "audit_log"
FeatureBrowserOnly FeatureName = "browser_only"
FeatureSCIM FeatureName = "scim"
FeatureTemplateRBAC FeatureName = "template_rbac"
FeatureUserRoleManagement FeatureName = "user_role_management"
FeatureHighAvailability FeatureName = "high_availability"
FeatureMultipleGitAuth FeatureName = "multiple_git_auth"
FeatureExternalProvisionerDaemons FeatureName = "external_provisioner_daemons"
FeatureAppearance FeatureName = "appearance"
FeatureAdvancedTemplateScheduling FeatureName = "advanced_template_scheduling"
FeatureTemplateAutostopRequirement FeatureName = "template_autostop_requirement"
FeatureWorkspaceProxy FeatureName = "workspace_proxy"
)
// FeatureNames must be kept in-sync with the Feature enum above.
@ -1924,17 +1924,19 @@ const (
// WARNING: This cannot be enabled when using HA.
ExperimentSingleTailnet Experiment = "single_tailnet"
// ExperimentTemplateRestartRequirement allows template admins to have more
// ExperimentTemplateAutostopRequirement allows template admins to have more
// control over when workspaces created on a template are required to
// restart, and allows users to ensure these restarts never happen during
// their business hours.
// stop, and allows users to ensure these restarts never happen during their
// business hours.
//
// This will replace the MaxTTL setting on templates.
//
// Enables:
// - User quiet hours schedule settings
// - Template restart requirement settings
// - Changes the max_deadline algorithm to use restart requirement and user
// - Template autostop requirement settings
// - Changes the max_deadline algorithm to use autostop requirement and user
// quiet hours instead of max_ttl.
ExperimentTemplateRestartRequirement Experiment = "template_restart_requirement"
ExperimentTemplateAutostopRequirement Experiment = "template_autostop_requirement"
// Deployment health page
ExperimentDeploymentHealthPage Experiment = "deployment_health_page"

View File

@ -84,11 +84,11 @@ type CreateTemplateRequest struct {
// DefaultTTLMillis allows optionally specifying the default TTL
// for all workspaces created from this template.
DefaultTTLMillis *int64 `json:"default_ttl_ms,omitempty"`
// TODO(@dean): remove max_ttl once restart_requirement is matured
// TODO(@dean): remove max_ttl once autostop_requirement is matured
MaxTTLMillis *int64 `json:"max_ttl_ms,omitempty"`
// RestartRequirement allows optionally specifying the restart requirement
// AutostopRequirement allows optionally specifying the autostop requirement
// for workspaces created from this template. This is an enterprise feature.
RestartRequirement *TemplateRestartRequirement `json:"restart_requirement,omitempty"`
AutostopRequirement *TemplateAutostopRequirement `json:"autostop_requirement,omitempty"`
// Allow users to cancel in-progress workspace jobs.
// *bool as the default value is "true".

View File

@ -29,13 +29,13 @@ type Template struct {
Description string `json:"description"`
Icon string `json:"icon"`
DefaultTTLMillis int64 `json:"default_ttl_ms"`
// TODO(@dean): remove max_ttl once restart_requirement is matured
// TODO(@dean): remove max_ttl once autostop_requirement is matured
MaxTTLMillis int64 `json:"max_ttl_ms"`
// RestartRequirement is an enterprise feature. Its value is only used if
// AutostopRequirement is an enterprise feature. Its value is only used if
// your license is entitled to use the advanced template scheduling feature.
RestartRequirement TemplateRestartRequirement `json:"restart_requirement"`
CreatedByID uuid.UUID `json:"created_by_id" format:"uuid"`
CreatedByName string `json:"created_by_name"`
AutostopRequirement TemplateAutostopRequirement `json:"autostop_requirement"`
CreatedByID uuid.UUID `json:"created_by_id" format:"uuid"`
CreatedByName string `json:"created_by_name"`
// AllowUserAutostart and AllowUserAutostop are enterprise-only. Their
// values are only used if your license is entitled to use the advanced
@ -107,7 +107,7 @@ func BitmapToWeekdays(bitmap uint8) []string {
return days
}
type TemplateRestartRequirement struct {
type TemplateAutostopRequirement struct {
// DaysOfWeek is a list of days of the week on which restarts are required.
// Restarts happen within the user's quiet hours (in their configured
// timezone). If no days are specified, restarts are not required. Weekdays
@ -180,18 +180,18 @@ type UpdateTemplateMeta struct {
Description string `json:"description,omitempty"`
Icon string `json:"icon,omitempty"`
DefaultTTLMillis int64 `json:"default_ttl_ms,omitempty"`
// TODO(@dean): remove max_ttl once restart_requirement is matured
// TODO(@dean): remove max_ttl once autostop_requirement is matured
MaxTTLMillis int64 `json:"max_ttl_ms,omitempty"`
// RestartRequirement can only be set if your license includes the advanced
// AutostopRequirement can only be set if your license includes the advanced
// template scheduling feature. If you attempt to set this value while
// unlicensed, it will be ignored.
RestartRequirement *TemplateRestartRequirement `json:"restart_requirement,omitempty"`
AllowUserAutostart bool `json:"allow_user_autostart,omitempty"`
AllowUserAutostop bool `json:"allow_user_autostop,omitempty"`
AllowUserCancelWorkspaceJobs bool `json:"allow_user_cancel_workspace_jobs,omitempty"`
FailureTTLMillis int64 `json:"failure_ttl_ms,omitempty"`
TimeTilDormantMillis int64 `json:"time_til_dormant_ms,omitempty"`
TimeTilDormantAutoDeleteMillis int64 `json:"time_til_dormant_autodelete_ms,omitempty"`
AutostopRequirement *TemplateAutostopRequirement `json:"autostop_requirement,omitempty"`
AllowUserAutostart bool `json:"allow_user_autostart,omitempty"`
AllowUserAutostop bool `json:"allow_user_autostop,omitempty"`
AllowUserCancelWorkspaceJobs bool `json:"allow_user_cancel_workspace_jobs,omitempty"`
FailureTTLMillis int64 `json:"failure_ttl_ms,omitempty"`
TimeTilDormantMillis int64 `json:"time_til_dormant_ms,omitempty"`
TimeTilDormantAutoDeleteMillis int64 `json:"time_til_dormant_autodelete_ms,omitempty"`
// UpdateWorkspaceLastUsedAt updates the last_used_at field of workspaces
// spawned from the template. This is useful for preventing workspaces being
// immediately locked when updating the inactivity_ttl field to a new, shorter