Uh oh!
There was an error while loading. Please reload this page.
stop reconciling workspace when PVC cleanup job fails - #851
Conversation
| if err != nil && !k8sErrors.IsConflict(err) { | ||
| return reconcile.Result{}, err | ||
| } | ||
| if workspace.Status.Phase != dw.DevWorkspaceStatusError { |
There was a problem hiding this comment.
There are potentially other places where the workspace status phase may be set to Error that do not concern the common PVC cleanup job.
For example, finalizeServiceAccount() may set the workspace status phase to Error. Furthermore, it is possible that in the future, other unrelated conditions may set the workspace's status phase to Error.
Thus, it might be best to also check the workspaces condition message for "Failed to clean up DevWorkspace storage" in the finalize function (unless this bug also occurs with finalizeServiceAccount(), which may be likely? 🤔 )
| Args: []string{ | ||
| "-c", | ||
| fmt.Sprintf(cleanupCommandFmt, path.Join(pvcClaimMountPath, workspaceId)), | ||
| "exit 1", |
There was a problem hiding this comment.
This commit/change needs to be removed before the PR can be merged. It's only here to facilitate testing.
amisevsk
left a comment
There was a problem hiding this comment.
LGTM.
This PR is pretty far behind main right now, and does not include the PVC cleanup changes -- I rebased on main while testing to verify how this works with "cleanup PVC on deletion".
Also, don't forget to remove the temporary patch before merging :)
dkwon17
commented
Jun 2, 2022
I've tested the PR with the provided instructions, and it is working 👍 is being printed quite often, but that is expected since new cleanup pods will start and will fail continuously for our test case, is that right? |
AObuchow
commented
Jun 2, 2022
Thanks for testing @dkwon17 :) |
ibuziuk
left a comment
There was a problem hiding this comment.
LGTM, please do not forget to replace exit 1 before merging
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: amisevsk, AObuchow, ibuziuk The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
@AObuchow , sorry, I meant to write my comment: #851 (comment) on your other PR: #846 I just tested this PR and it is working for me , as I only see the log only once 👍 |
Fixdevfile#845 Signed-off-by: Andrew Obuchowicz <aobuchow@redhat.com>
5203833 to
28a3599CompareNew changes are detected. LGTM label has been removed. |
AObuchow
commented
Jun 3, 2022
Awesome, thanks for confirmation @dkwon17 :) |
What does this PR do?
Currently, in the reconcile loop, there is a bug with marking a workspace as having an error after the common PVC cleanup job fails.
From my understanding, after detecting that the cleanup job has failed and returning a
ProvisionErrorfromstorageProvisioner.CleanupWorkspaceStorage(), the workspace's status phase is set toError. However, the reconcile function checks for deleted workspaces before checking for workspaces with errors/failures. The existing logic in thefinalizefunction (which is called when reconciling deleted workspaces) then overwrites the workspace's status phase (setting it toTerminating) and eventually runsstorageProvisioner.CleanupWorkspaceStorage()again, leading to an endless loop.My current fix simply modifies the
finalizefunction to check if the workspace's status phase is set toError, and if so, it does not overwrite the workspace's status phase and returns early.What issues does this PR fix or reference?
Fix#845
Is it tested? How?
kubectl delete dw theia-next -n $NAMESPACEErrorphase by doingkubectl get devworkspace -n $NAMESPACE:PR Checklist
/test v8-devworkspace-operator-e2e, v8-che-happy-pathto trigger)v8-devworkspace-operator-e2e: DevWorkspace e2e testv8-che-happy-path: Happy path for verification integration with Che