feat: allow configuring persistent workspace home directory

Signed-off-by: Andrew Obuchowicz <aobuchow@redhat.com>
pull/1740/head
Andrew Obuchowicz 2023-05-23 18:47:34 +00:00 committed by Ilya Buziuk
parent d55d8a77be
commit 17ea193f27
2 changed files with 11 additions and 0 deletions

View File

@ -108,6 +108,7 @@ const (
CommonPVCStorageStrategy = "common"
DefaultDeploymentStrategy = "Recreate"
DefaultAutoProvision = true
DefaultPersistUserHomeEnabled = false
DefaultWorkspaceJavaOpts = "-XX:MaxRAM=150m -XX:MaxRAMFraction=2 -XX:+UseParallelGC " +
"-XX:MinHeapFreeRatio=10 -XX:MaxHeapFreeRatio=20 -XX:GCTimeRatio=4 -XX:AdaptiveSizePolicyWeight=90 " +
"-Dsun.zip.disableMemoryMapping=true " +

View File

@ -101,6 +101,8 @@ func updateWorkspaceConfig(cheCluster *chev2.CheCluster, operatorConfig *control
updateStartTimeout(operatorConfig, devEnvironments.StartTimeoutSeconds)
updatePersistUserHomeConfig(devEnvironments.PersistUserHome, operatorConfig.Workspace)
operatorConfig.Workspace.DeploymentStrategy = v1.DeploymentStrategyType(utils.GetValue(string(devEnvironments.DeploymentStrategy), constants.DefaultDeploymentStrategy))
return nil
}
@ -148,6 +150,14 @@ func updateWorkspaceStorageConfig(devEnvironments *chev2.CheClusterDevEnvironmen
return nil
}
func updatePersistUserHomeConfig(persistentHomeConfig *chev2.PersistentHomeConfig, workspaceConfig *controllerv1alpha1.WorkspaceConfig) {
workspaceConfig.PersistUserHome = nil
if persistentHomeConfig != nil {
workspaceConfig.PersistUserHome = &controllerv1alpha1.PersistentHomeConfig{}
workspaceConfig.PersistUserHome.Enabled = persistentHomeConfig.Enabled
}
}
func updateWorkspaceServiceAccountConfig(devEnvironments *chev2.CheClusterDevEnvironments, workspaceConfig *controllerv1alpha1.WorkspaceConfig) {
isNamespaceAutoProvisioned := pointer.BoolDeref(devEnvironments.DefaultNamespace.AutoProvision, constants.DefaultAutoProvision)