Ignore order of envFrom when comparing deployments #850
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What does this PR do?
When listing configmaps and secrets on the cluster, the API can return objects in a random order (for two configmaps, I see the reverse order almost exactly 1/8th of the time, at random)
This can result in the operator defining a Deployment spec for workspaces with the envFrom fields switched, if those configmaps are automounted as environment variables. To get around this, we ignore the order of envFrom entries when deciding if the deployment needs to be updated.
What issues does this PR fix or reference?
Closes #849
Is it tested? How?
Create two
mount-as: env
configmaps in a namespace and attempt to start a workspace. Since the issue does not reproduce consistently, the only way to be 100% sure is to add debug logging inpkg/provision/automount/configmap.go
to list the order of configmaps seen -- add the following to line 39 in that fileand then grep the DWO logs for "configmaps_found". You should see different orders appear:
You might have to repeatedly edit a workspace to get enough reconciles to see the bug:
PR Checklist
/test v8-devworkspace-operator-e2e, v8-che-happy-path
to trigger)v8-devworkspace-operator-e2e
: DevWorkspace e2e testv8-che-happy-path
: Happy path for verification integration with Che