Skip to content

Commit ce445f3

Browse files
committed
feat : Set StorageAccessMode while updating WorkspaceConfig during reconcile
While updating WorkspaceConfig with CheClusterDevEnvironment also set StorageAccessMode if present. Signed-off-by: Rohan Kumar <rohaan@redhat.com>
1 parent d46ab9e commit ce445f3

2 files changed

Lines changed: 57 additions & 0 deletions

File tree

pkg/deploy/dev-workspace-config/dev_workspace_config.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,7 @@ func updateWorkspaceStorageConfig(devEnvironments *chev2.CheClusterDevEnvironmen
161161
}[pvcStrategy]
162162

163163
if pvc != nil {
164+
workspaceConfig.StorageAccessMode = pvc.StorageAccessMode
164165
if pvc.StorageClass != "" {
165166
workspaceConfig.StorageClassName = &pvc.StorageClass
166167
}

pkg/deploy/dev-workspace-config/dev_workspace_config_test.go

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,62 @@ func TestReconcileDevWorkspaceConfigStorage(t *testing.T) {
145145
},
146146
},
147147
},
148+
{
149+
name: "Create DevWorkspaceOperatorConfig with non empty StorageAccessMode",
150+
cheCluster: &chev2.CheCluster{
151+
ObjectMeta: metav1.ObjectMeta{
152+
Namespace: "eclipse-che",
153+
Name: "eclipse-che",
154+
},
155+
Spec: chev2.CheClusterSpec{
156+
DevEnvironments: chev2.CheClusterDevEnvironments{
157+
DisableContainerBuildCapabilities: pointer.Bool(true),
158+
Storage: chev2.WorkspaceStorage{
159+
PvcStrategy: constants.PerUserPVCStorageStrategy,
160+
PerUserStrategyPvcConfig: &chev2.PVC{
161+
StorageAccessMode: []corev1.PersistentVolumeAccessMode{
162+
corev1.ReadWriteMany,
163+
},
164+
},
165+
},
166+
},
167+
},
168+
},
169+
expectedOperatorConfig: &controllerv1alpha1.OperatorConfiguration{
170+
Workspace: &controllerv1alpha1.WorkspaceConfig{
171+
StorageAccessMode: []corev1.PersistentVolumeAccessMode{
172+
corev1.ReadWriteMany,
173+
},
174+
DeploymentStrategy: "Recreate",
175+
},
176+
},
177+
},
178+
{
179+
name: "Create DevWorkspaceOperatorConfig with nil StorageAccessMode",
180+
cheCluster: &chev2.CheCluster{
181+
ObjectMeta: metav1.ObjectMeta{
182+
Namespace: "eclipse-che",
183+
Name: "eclipse-che",
184+
},
185+
Spec: chev2.CheClusterSpec{
186+
DevEnvironments: chev2.CheClusterDevEnvironments{
187+
DisableContainerBuildCapabilities: pointer.Bool(true),
188+
Storage: chev2.WorkspaceStorage{
189+
PvcStrategy: constants.PerUserPVCStorageStrategy,
190+
PerUserStrategyPvcConfig: &chev2.PVC{
191+
StorageAccessMode: nil,
192+
},
193+
},
194+
},
195+
},
196+
},
197+
expectedOperatorConfig: &controllerv1alpha1.OperatorConfiguration{
198+
Workspace: &controllerv1alpha1.WorkspaceConfig{
199+
StorageAccessMode: nil,
200+
DeploymentStrategy: "Recreate",
201+
},
202+
},
203+
},
148204
{
149205
name: "Create DevWorkspaceOperatorConfig with per-user storage strategy",
150206
cheCluster: &chev2.CheCluster{

0 commit comments

Comments
 (0)