Skip to content

Commit 3d1c1f0

Browse files
committed
Fix issue where volumeMounts were being unnecessarily added
Improve check for whether the volumeMount subpaths workaround is required for a particular deployment. Previously, we only checked whether any volumes were defined, which failed on OpenShift due to a secret volume being in the list. Now we check to make sure the common PVC volume is present in the deployment before applying the workaround. Signed-off-by: Angel Misevski <[email protected]>
1 parent de51953 commit 3d1c1f0

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

controllers/workspace/provision/deployment.go

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,7 @@ func getSpecDeployment(
223223
},
224224
}
225225

226-
if len(podAdditions.Volumes) > 0 {
226+
if needsPVCWorkaround(podAdditions) {
227227
// Kubernetes creates directories in a PVC to support subpaths such that only the leaf directory has g+rwx permissions.
228228
// This means that mounting the subpath e.g. <workspace-id>/plugins will result in the <workspace-id> directory being
229229
// created with 755 permissions, requiring the root UID to remove it.
@@ -353,3 +353,13 @@ func getWorkspaceSubpathVolumeMount(workspaceId string) corev1.VolumeMount {
353353

354354
return workspaceVolumeMount
355355
}
356+
357+
func needsPVCWorkaround(podAdditions *v1alpha1.PodAdditions) bool {
358+
commonPVCName := config.ControllerCfg.GetWorkspacePVCName()
359+
for _, vol := range podAdditions.Volumes {
360+
if vol.Name == commonPVCName {
361+
return true
362+
}
363+
}
364+
return false
365+
}

0 commit comments

Comments
 (0)