@@ -81,6 +81,7 @@ const (
81
81
FeatureControlSharedPorts FeatureName = "control_shared_ports"
82
82
FeatureCustomRoles FeatureName = "custom_roles"
83
83
FeatureMultipleOrganizations FeatureName = "multiple_organizations"
84
+ FeatureWorkspacePrebuilds FeatureName = "workspace_prebuilds"
84
85
)
85
86
86
87
// FeatureNames must be kept in-sync with the Feature enum above.
@@ -103,6 +104,7 @@ var FeatureNames = []FeatureName{
103
104
FeatureControlSharedPorts ,
104
105
FeatureCustomRoles ,
105
106
FeatureMultipleOrganizations ,
107
+ FeatureWorkspacePrebuilds ,
106
108
}
107
109
108
110
// Humanize returns the feature name in a human-readable format.
@@ -132,6 +134,7 @@ func (n FeatureName) AlwaysEnable() bool {
132
134
FeatureHighAvailability : true ,
133
135
FeatureCustomRoles : true ,
134
136
FeatureMultipleOrganizations : true ,
137
+ FeatureWorkspacePrebuilds : true ,
135
138
}[n ]
136
139
}
137
140
@@ -393,6 +396,7 @@ type DeploymentValues struct {
393
396
TermsOfServiceURL serpent.String `json:"terms_of_service_url,omitempty" typescript:",notnull"`
394
397
Notifications NotificationsConfig `json:"notifications,omitempty" typescript:",notnull"`
395
398
AdditionalCSPPolicy serpent.StringArray `json:"additional_csp_policy,omitempty" typescript:",notnull"`
399
+ Prebuilds PrebuildsConfig `json:"workspace_prebuilds,omitempty" typescript:",notnull"`
396
400
WorkspaceHostnameSuffix serpent.String `json:"workspace_hostname_suffix,omitempty" typescript:",notnull"`
397
401
398
402
Config serpent.YAMLConfigPath `json:"config,omitempty" typescript:",notnull"`
@@ -1034,6 +1038,11 @@ func (c *DeploymentValues) Options() serpent.OptionSet {
1034
1038
Parent : & deploymentGroupNotifications ,
1035
1039
YAML : "webhook" ,
1036
1040
}
1041
+ deploymentGroupPrebuilds = serpent.Group {
1042
+ Name : "Workspace Prebuilds" ,
1043
+ YAML : "workspace_prebuilds" ,
1044
+ Description : "Configure how workspace prebuilds behave." ,
1045
+ }
1037
1046
deploymentGroupInbox = serpent.Group {
1038
1047
Name : "Inbox" ,
1039
1048
Parent : & deploymentGroupNotifications ,
@@ -3029,6 +3038,41 @@ Write out the current server config as YAML to stdout.`,
3029
3038
Annotations : serpent.Annotations {}.Mark (annotationFormatDuration , "true" ),
3030
3039
Hidden : true , // Hidden because most operators should not need to modify this.
3031
3040
},
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
+ },
3032
3076
// Push notifications.
3033
3077
}
3034
3078
@@ -3254,6 +3298,7 @@ const (
3254
3298
ExperimentAutoFillParameters Experiment = "auto-fill-parameters" // This should not be taken out of experiments until we have redesigned the feature.
3255
3299
ExperimentNotifications Experiment = "notifications" // Sends notifications via SMTP and webhooks following certain events.
3256
3300
ExperimentWorkspaceUsage Experiment = "workspace-usage" // Enables the new workspace usage tracking.
3301
+ ExperimentWorkspacePrebuilds Experiment = "workspace-prebuilds" // Enables the new workspace prebuilds feature.
3257
3302
ExperimentWebPush Experiment = "web-push" // Enables web push notifications through the browser.
3258
3303
ExperimentDynamicParameters Experiment = "dynamic-parameters" // Enables dynamic parameters when creating a workspace.
3259
3304
)
@@ -3262,7 +3307,9 @@ const (
3262
3307
// users to opt-in to via --experimental='*'.
3263
3308
// Experiments that are not ready for consumption by all users should
3264
3309
// not be included here and will be essentially hidden.
3265
- var ExperimentsSafe = Experiments {}
3310
+ var ExperimentsSafe = Experiments {
3311
+ ExperimentWorkspacePrebuilds ,
3312
+ }
3266
3313
3267
3314
// Experiments is a list of experiments.
3268
3315
// Multiple experiments may be enabled at the same time.
0 commit comments