Skip to content

Conversation

amisevsk
Copy link
Collaborator

@amisevsk amisevsk commented Jun 3, 2022

What does this PR do?

Since support for subpath automount volumes was added, the comparison function used to ignore the order of volumeMounts in a deployment is no use the same volume. This can result in spurious changes to the deployment's spec, if the operator reads volumes in a random order.

To fix this, also compare mountPath and subPath. The comparison function for other slices is unchanged, as in those cases the name is a key in the list and must be unique.

What issues does this PR fix or reference?

Closes #859

Is it tested? How?

Test using reproducer in issue.

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

Since support for subpath automount volumes was added, the comparison
function used to ignore the order of volumeMounts in a deployment is no
longer valid, as multiple volumeMounts can use the same volume. This can
result in spurious changes to the deployment's spec, if the operator
reads volumes in a random order.

To fix this, also compare mountPath and subPath. The comparison function
for other slices is unchanged, as in those cases the name is a key in
the list and must be unique.

Signed-off-by: Angel Misevski <amisevsk@redhat.com>
@amisevsk amisevsk requested a review from ibuziuk as a code owner June 3, 2022 22:28
@openshift-ci openshift-ci bot added the approved label Jun 3, 2022
@amisevsk amisevsk changed the title Fix ignoring order of volumeMounts when comparing deployments fix: ignore order of volumeMounts when comparing deployments Jun 6, 2022
@openshift-ci
Copy link

openshift-ci bot commented Jun 6, 2022

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: amisevsk, ibuziuk

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

@ibuziuk ibuziuk merged commit a69ed55 into devfile:main Jun 6, 2022
@amisevsk amisevsk deleted the fix-volumeMount-order branch June 6, 2022 14:06
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.

Order of volumeMounts, etc. is not consistent in deployment, resulting in repeated changes

2 participants