Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: auto-mount path collisions #1378

Merged
merged 4 commits into from
Feb 28, 2025
Merged

Conversation

akurinnoy
Copy link
Contributor

What does this PR do?

This PR makes DWO handle auto-mount path collisions and fails the workspace with the error message.

What issues does this PR fix or reference?

fixes #1194

Is it tested? How?

PR Checklist

  • E2E tests pass (when PR is ready, comment /test v8-devworkspace-operator-e2e, v8-che-happy-path to trigger)
    • v8-devworkspace-operator-e2e: DevWorkspace e2e test
    • v8-che-happy-path: Happy path for verification integration with Che

@akurinnoy akurinnoy self-assigned this Feb 10, 2025
@dkwon17
Copy link
Collaborator

dkwon17 commented Feb 10, 2025

Thank you for the PR @akurinnoy ,

Could we do the collision check here?

mountPathToVolumeMounts[volumeMount.MountPath] = append(mountPathToVolumeMounts[volumeMount.MountPath], volumeMount)

Right now, if there is a collision, it fails silently because it overwrites the existing value of the map

@dkwon17
Copy link
Collaborator

dkwon17 commented Feb 11, 2025

This is the case I tested this PR with:

kind: ConfigMap
apiVersion: v1
metadata:
  name: my-configmap-mount-1
  namespace: devworkspace-controller
  labels:
    controller.devfile.io/mount-to-devworkspace: 'true'
    controller.devfile.io/watch-configmap: 'true'
  annotations:
    controller.devfile.io/mount-path: /home/user/hello-world
data:
  myfile: this is my file

and:

kind: ConfigMap
apiVersion: v1
metadata:
  name: my-configmap-mount-2
  namespace: devworkspace-controller
  labels:
    controller.devfile.io/mount-to-devworkspace: 'true'
    controller.devfile.io/watch-configmap: 'true'
  annotations:
    controller.devfile.io/mount-path: /home/user/hello-world
data:
  myfile: this is my file 2

And I was able to start the workspace successfully.

However, I was able to get it working if I add this annotation:

controller.devfile.io/mount-as: subpath

image

@akurinnoy
Copy link
Contributor Author

/test v8-devworkspace-operator-e2e, v8-che-happy-path

Copy link

openshift-ci bot commented Feb 19, 2025

@akurinnoy: The specified target(s) for /test were not found.
The following commands are available to trigger required jobs:

/test v14-che-happy-path
/test v14-devworkspace-operator-e2e
/test v14-images

Use /test all to run the following jobs that were automatically triggered:

pull-ci-devfile-devworkspace-operator-main-v14-devworkspace-operator-e2e
pull-ci-devfile-devworkspace-operator-main-v14-images

In response to this:

/test v8-devworkspace-operator-e2e, v8-che-happy-path

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@akurinnoy
Copy link
Contributor Author

/test v14-che-happy-path

Copy link

openshift-ci bot commented Feb 19, 2025

@akurinnoy: The following test failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
ci/prow/v14-che-happy-path e6cca33 link true /test v14-che-happy-path

Full PR test history. Your PR dashboard.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here.

@dkwon17
Copy link
Collaborator

dkwon17 commented Feb 21, 2025

Hello @akurinnoy could you please rebase this PR?

Signed-off-by: Oleksii Kurinnyi <[email protected]>
Signed-off-by: Oleksii Kurinnyi <[email protected]>
Signed-off-by: Oleksii Kurinnyi <[email protected]>
Copy link

openshift-ci bot commented Feb 27, 2025

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: akurinnoy, dkwon17

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@dkwon17
Copy link
Collaborator

dkwon17 commented Feb 27, 2025

Thank you @akurinnoy, please squash and merge

@akurinnoy akurinnoy merged commit 743da94 into devfile:main Feb 28, 2025
10 checks passed
@akurinnoy akurinnoy deleted the mount-path-conflict branch February 28, 2025 10:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Improve handling of auto-mount path collisions
2 participants