@@ -81,6 +81,7 @@ const (
8181 FeatureControlSharedPorts FeatureName = "control_shared_ports"
8282 FeatureCustomRoles FeatureName = "custom_roles"
8383 FeatureMultipleOrganizations FeatureName = "multiple_organizations"
84+ FeatureWorkspacePrebuilds FeatureName = "workspace_prebuilds"
8485)
8586
8687// FeatureNames must be kept in-sync with the Feature enum above.
@@ -103,6 +104,7 @@ var FeatureNames = []FeatureName{
103104 FeatureControlSharedPorts ,
104105 FeatureCustomRoles ,
105106 FeatureMultipleOrganizations ,
107+ FeatureWorkspacePrebuilds ,
106108}
107109
108110// Humanize returns the feature name in a human-readable format.
@@ -132,6 +134,7 @@ func (n FeatureName) AlwaysEnable() bool {
132134 FeatureHighAvailability : true ,
133135 FeatureCustomRoles : true ,
134136 FeatureMultipleOrganizations : true ,
137+ FeatureWorkspacePrebuilds : true ,
135138 }[n ]
136139}
137140
@@ -393,6 +396,7 @@ type DeploymentValues struct {
393396 TermsOfServiceURL serpent.String `json:"terms_of_service_url,omitempty" typescript:",notnull"`
394397 Notifications NotificationsConfig `json:"notifications,omitempty" typescript:",notnull"`
395398 AdditionalCSPPolicy serpent.StringArray `json:"additional_csp_policy,omitempty" typescript:",notnull"`
399+ Prebuilds PrebuildsConfig `json:"workspace_prebuilds,omitempty" typescript:",notnull"`
396400 WorkspaceHostnameSuffix serpent.String `json:"workspace_hostname_suffix,omitempty" typescript:",notnull"`
397401
398402 Config serpent.YAMLConfigPath `json:"config,omitempty" typescript:",notnull"`
@@ -1034,6 +1038,11 @@ func (c *DeploymentValues) Options() serpent.OptionSet {
10341038 Parent : & deploymentGroupNotifications ,
10351039 YAML : "webhook" ,
10361040 }
1041+ deploymentGroupPrebuilds = serpent.Group {
1042+ Name : "Workspace Prebuilds" ,
1043+ YAML : "workspace_prebuilds" ,
1044+ Description : "Configure how workspace prebuilds behave." ,
1045+ }
10371046 deploymentGroupInbox = serpent.Group {
10381047 Name : "Inbox" ,
10391048 Parent : & deploymentGroupNotifications ,
@@ -3029,6 +3038,41 @@ Write out the current server config as YAML to stdout.`,
30293038 Annotations : serpent.Annotations {}.Mark (annotationFormatDuration , "true" ),
30303039 Hidden : true , // Hidden because most operators should not need to modify this.
30313040 },
3041+ {
3042+ Name : "Reconciliation Interval" ,
3043+ Description : "How often to reconcile workspace prebuilds state." ,
3044+ Flag : "workspace-prebuilds-reconciliation-interval" ,
3045+ Env : "CODER_WORKSPACE_PREBUILDS_RECONCILIATION_INTERVAL" ,
3046+ Value : & c .Prebuilds .ReconciliationInterval ,
3047+ Default : (time .Second * 15 ).String (),
3048+ Group : & deploymentGroupPrebuilds ,
3049+ YAML : "reconciliation_interval" ,
3050+ Annotations : serpent.Annotations {}.Mark (annotationFormatDuration , "true" ),
3051+ },
3052+ {
3053+ Name : "Reconciliation Backoff Interval" ,
3054+ Description : "Interval to increase reconciliation backoff by when unrecoverable errors occur." ,
3055+ Flag : "workspace-prebuilds-reconciliation-backoff-interval" ,
3056+ Env : "CODER_WORKSPACE_PREBUILDS_RECONCILIATION_BACKOFF_INTERVAL" ,
3057+ Value : & c .Prebuilds .ReconciliationBackoffInterval ,
3058+ Default : (time .Second * 15 ).String (),
3059+ Group : & deploymentGroupPrebuilds ,
3060+ YAML : "reconciliation_backoff_interval" ,
3061+ Annotations : serpent.Annotations {}.Mark (annotationFormatDuration , "true" ),
3062+ Hidden : true ,
3063+ },
3064+ {
3065+ Name : "Reconciliation Backoff Lookback Period" ,
3066+ Description : "Interval to look back to determine number of failed builds, which influences backoff." ,
3067+ Flag : "workspace-prebuilds-reconciliation-backoff-lookback-period" ,
3068+ Env : "CODER_WORKSPACE_PREBUILDS_RECONCILIATION_BACKOFF_LOOKBACK_PERIOD" ,
3069+ Value : & c .Prebuilds .ReconciliationBackoffLookback ,
3070+ Default : (
time .
Hour ).
String (),
// TODO: use https://pkg.go.dev/github.com/jackc/[email protected] #Interval 3071+ Group : & deploymentGroupPrebuilds ,
3072+ YAML : "reconciliation_backoff_lookback_period" ,
3073+ Annotations : serpent.Annotations {}.Mark (annotationFormatDuration , "true" ),
3074+ Hidden : true ,
3075+ },
30323076 // Push notifications.
30333077 }
30343078
@@ -3254,6 +3298,7 @@ const (
32543298 ExperimentAutoFillParameters Experiment = "auto-fill-parameters" // This should not be taken out of experiments until we have redesigned the feature.
32553299 ExperimentNotifications Experiment = "notifications" // Sends notifications via SMTP and webhooks following certain events.
32563300 ExperimentWorkspaceUsage Experiment = "workspace-usage" // Enables the new workspace usage tracking.
3301+ ExperimentWorkspacePrebuilds Experiment = "workspace-prebuilds" // Enables the new workspace prebuilds feature.
32573302 ExperimentWebPush Experiment = "web-push" // Enables web push notifications through the browser.
32583303 ExperimentDynamicParameters Experiment = "dynamic-parameters" // Enables dynamic parameters when creating a workspace.
32593304)
@@ -3262,7 +3307,9 @@ const (
32623307// users to opt-in to via --experimental='*'.
32633308// Experiments that are not ready for consumption by all users should
32643309// not be included here and will be essentially hidden.
3265- var ExperimentsSafe = Experiments {}
3310+ var ExperimentsSafe = Experiments {
3311+ ExperimentWorkspacePrebuilds ,
3312+ }
32663313
32673314// Experiments is a list of experiments.
32683315// Multiple experiments may be enabled at the same time.
0 commit comments