@@ -128,7 +128,7 @@ export interface StartWorkspaceOptions {
128
128
rethrow ?: boolean ;
129
129
forceDefaultImage ?: boolean ;
130
130
excludeFeatureFlags ?: NamedWorkspaceFeatureFlag [ ] ;
131
- forcePVC ?: boolean ;
131
+ pvcEnabledForPrebuilds ?: boolean ;
132
132
}
133
133
134
134
const MAX_INSTANCE_START_RETRIES = 2 ;
@@ -352,7 +352,7 @@ export class WorkspaceStarter {
352
352
user ,
353
353
options . excludeFeatureFlags || [ ] ,
354
354
ideConfig ,
355
- options . forcePVC || false ,
355
+ options . pvcEnabledForPrebuilds || false ,
356
356
) ,
357
357
) ;
358
358
span . log ( { newInstance : instance . id } ) ;
@@ -743,7 +743,7 @@ export class WorkspaceStarter {
743
743
user : User ,
744
744
excludeFeatureFlags : NamedWorkspaceFeatureFlag [ ] ,
745
745
ideConfig : IDEConfig ,
746
- forcePVC : boolean ,
746
+ pvcEnabledForPrebuilds : boolean ,
747
747
) : Promise < WorkspaceInstance > {
748
748
const span = TraceContext . startSpan ( "buildWorkspaceImage" , ctx ) ;
749
749
//#endregion IDE resolution TODO(ak) move to IDE service
@@ -828,8 +828,15 @@ export class WorkspaceStarter {
828
828
829
829
featureFlags = featureFlags . filter ( ( f ) => ! excludeFeatureFlags . includes ( f ) ) ;
830
830
831
- if ( forcePVC === true ) {
832
- featureFlags = featureFlags . concat ( [ "persistent_volume_claim" ] ) ;
831
+ if ( workspace . type === "prebuild" ) {
832
+ if ( pvcEnabledForPrebuilds === true ) {
833
+ featureFlags = featureFlags . concat ( [ "persistent_volume_claim" ] ) ;
834
+ } else {
835
+ // If PVC is disabled for prebuilds, we need to remove the PVC feature flag.
836
+ // This is necessary to ensure if user has PVC enabled on their account, that they
837
+ // will not hijack prebuild with PVC and make everyone who use this prebuild to auto enroll into PVC feature.
838
+ featureFlags = featureFlags . filter ( ( f ) => f !== "persistent_volume_claim" ) ;
839
+ }
833
840
}
834
841
835
842
let workspaceClass = "" ;
@@ -1428,7 +1435,8 @@ export class WorkspaceStarter {
1428
1435
}
1429
1436
1430
1437
const volumeSnapshotId =
1431
- ( ( SnapshotContext . is ( workspace . context ) || WithPrebuild . is ( workspace . context ) ) && ! ! workspace . context . snapshotBucketId )
1438
+ ( SnapshotContext . is ( workspace . context ) || WithPrebuild . is ( workspace . context ) ) &&
1439
+ ! ! workspace . context . snapshotBucketId
1432
1440
? workspace . context . snapshotBucketId
1433
1441
: lastValidWorkspaceInstanceId ;
1434
1442
0 commit comments