Skip to content

Merge duplicate volume components from parent/plugins #593

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

Merged
merged 5 commits into from
Sep 17, 2021

Conversation

amisevsk
Copy link
Collaborator

What does this PR do?

Adds merging functionality to combine volumes that are duplicated in plugins and parents. This is done by removing duplicate volume components from parents/plugins if they are defined earlier in the flattened devworkspace, in the order devworkspace <- parents <- plugins (i.e. if a volume is defined in the devworkspace, duplicates in the parent and plugins are removed). If a volume is defined in multiple plugins, the first processed instance is kept and the rest are dropped.

Duplicated volumes are merged so that the larger size is used, and so that a persistent volume overrides an ephemeral one. This means that if a plugin defines e.g. a .m2 volume with size 1Gi, it will overwrite a main-devfile volume with size 512Gi. This also means defining volume sizes in plugins can modify main-devfile volumes, which may be undesirable. Generally, a good practice is probably to define plugin volumes as ephemeral unless otherwise necessary, and let the main devworkspace make them persistent if needed.

What issues does this PR fix or reference?

Closes #586

Is it tested? How?

Test cases are included in PR.

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

Copy link
Member

@sleshchenko sleshchenko left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Merging rules looks meaningful to me. So, not approved just since it's WIP

@amisevsk amisevsk changed the title WIP: Merge duplicate volume components from parent/plugins Merge duplicate volume components from parent/plugins Sep 13, 2021
Copy link
Member

@sleshchenko sleshchenko left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I haven't tested but tests suggests it works )

Please create an issue for plugins team to define volumes on Devfile level of plugins.

@openshift-ci openshift-ci bot added the lgtm label Sep 13, 2021
@amisevsk amisevsk force-pushed the merge-volume-components branch from 44e86f4 to 920fd91 Compare September 13, 2021 15:40
@openshift-ci openshift-ci bot removed the lgtm label Sep 13, 2021
Copy link
Contributor

@JPinkney JPinkney left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@openshift-ci
Copy link

openshift-ci bot commented Sep 13, 2021

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: amisevsk, JPinkney, sleshchenko

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:
  • OWNERS [JPinkney,amisevsk,sleshchenko]

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

@amisevsk amisevsk force-pushed the merge-volume-components branch from 920fd91 to 212ab5f Compare September 14, 2021 16:59
@openshift-ci
Copy link

openshift-ci bot commented Sep 14, 2021

New changes are detected. LGTM label has been removed.

@openshift-ci openshift-ci bot removed the lgtm label Sep 14, 2021
@amisevsk
Copy link
Collaborator Author

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

@sleshchenko
Copy link
Member

from e2e tests

2021/09/14 19:56:32 Now current status of developer workspace is: Failed. Message: Detected unrecoverable event FailedMount: MountVolume.SetUp failed for volume "devworkspace-serving-cert-workspace3ff4357331c7441e-service" : secret "workspace3ff4357331c7441e-service" not found

¯_(ツ)_/¯

@sleshchenko
Copy link
Member

Ran tests against RHPDS OpenShift 4.8 and they works.
Let's give it a second try and if no luck - probably FailedMount is not something we should use as unrecoverable event.

@sleshchenko
Copy link
Member

/test v8-devworkspace-operator-e2e

@sleshchenko
Copy link
Member

e2e path seems to pass on #596.

So, trying one more time

@sleshchenko
Copy link
Member

/test v8-devworkspace-operator-e2e

Merge volume components to avoid issues where e.g. a devworkspaces defines a
volume that is also defined in a plugin. This makes devworkspaces more
portable, as adding a plugin is less likely to break an existing
workspace.

Volumes are merged so that the only instance is found in the
devworkspace, its parent, or its plugins in that order (i.e. volumes in
plugins will be deleted in favor of a volume defined in the devworkspace
itself).

To try to avoid issues:
* If one duplicated volume is not ephemeral, the merged volume is not
  ephemeral.
* If two volumes define different sizes, the merged volume uses the
  larger size.

Signed-off-by: Angel Misevski <[email protected]>
Move logic for merging into a separate file and add a more abstract
interface to allow adding additional merging later if necessary.

Signed-off-by: Angel Misevski <[email protected]>
@amisevsk amisevsk force-pushed the merge-volume-components branch from 212ab5f to c6055d9 Compare September 16, 2021 15:11
@amisevsk
Copy link
Collaborator Author

I have no idea why e2e is consistently failing here.

@amisevsk
Copy link
Collaborator Author

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

On some clusters, pods may encounter the 'MountVolume.SetUp failed'
event due to transient cluster issues, causing unnecessary workspace
failures.

Signed-off-by: Angel Misevski <[email protected]>
@amisevsk
Copy link
Collaborator Author

Lets see if the mountVolumes issue is transient I guess (still don't understand why only this PR is affected, and I also can't reproduce locally.)

/test v8-devworkspace-operator-e2e

@amisevsk
Copy link
Collaborator Author

The last failure had a different message:

2021/09/16 17:05:42 Now current status of developer workspace is: Failed. Message: Detected unrecoverable event FailedMount: MountVolume.SetUp failed for volume "devworkspace-serving-cert-workspacedaf72da98cff4016-service" : failed to sync secret cache: timed out waiting for the condition

@sleshchenko
Copy link
Member

Tests passed! 🧙‍♂️ 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Volumes from DevWorkspace and DevWorkspaceTemplates should be merged
3 participants