Skip to content

Conversation

@akurinnoy
Copy link
Collaborator

@akurinnoy akurinnoy commented Apr 17, 2025

What does this PR do?

This pull request enhances the common PVC cleanup job by adding node affinity rule.

This change modifies the cleanup job creation logic to:

  1. Read the volume.kubernetes.io/selected-node annotation from the common PVC associated with the DevWorkspace.
  2. If the annotation exists, add a requiredDuringSchedulingIgnoredDuringExecution node affinity rule to the cleanup job's pod spec, targeting the specified node.

This ensures that the cleanup job pod runs on the same node as the volume. If the annotation is not present, no node affinity is added.

What issues does this PR fix or reference?

resolves #1269

Is it tested? How?

  1. Create at least two DevWorkspaces; at least one should be running.
  2. Verify that the PVC has the volume.kubernetes.io/selected-node annotation. Note the node name specified in the annotation value.
    kubectl get pvc -n <namespace> claim-devworkspace -o jsonpath='{.metadata.annotations.volume\.kubernetes\.io/selected-node}'
  3. Delete a DevWorkspace, and leave at least one running DevWorkspace untouched.
  4. Inspect the cleanup job to verify that the node affinity rule was added:
    kubectl get job -n <namespace> <job-name> -o jsonpath='{.spec.template.spec.affinity.nodeAffinity}'
    Check that the nodeSelectorTerms target the node name noted in step 2 via the kubernetes.io/hostname key.
  5. Ensure the cleanup Job completes successfully and the DevWorkspace is deleted.

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

@openshift-ci
Copy link

openshift-ci bot commented Apr 17, 2025

Skipping CI for Draft Pull Request.
If you want CI signal for your change, please convert it to an actual PR.
You can still manually trigger a test run with /test all

@akurinnoy akurinnoy marked this pull request as ready for review April 18, 2025 14:02
@dkwon17
Copy link
Collaborator

dkwon17 commented Apr 28, 2025

/retest

@dkwon17 dkwon17 requested a review from rohanKanojia May 3, 2025 05:59
Co-authored-by: Rohan Kumar  <[email protected]>
Signed-off-by: Oleksii Kurinnyi <[email protected]>
@openshift-ci
Copy link

openshift-ci bot commented Jun 3, 2025

[APPROVALNOTIFIER] This PR is APPROVED

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

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

The pull request process is described here

Details 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

@openshift-ci openshift-ci bot added the approved label Jun 3, 2025
@dkwon17
Copy link
Collaborator

dkwon17 commented Jun 4, 2025

@akurinnoy I've tested on a single node and multi node cluster, I just have one small suggestion

@openshift-ci openshift-ci bot removed the lgtm label Jun 5, 2025
@openshift-ci
Copy link

openshift-ci bot commented Jun 5, 2025

New changes are detected. LGTM label has been removed.

Co-authored-by: David Kwon <[email protected]>
Signed-off-by: Oleksii Kurinnyi <[email protected]>
@dkwon17
Copy link
Collaborator

dkwon17 commented Jun 5, 2025

Thank you @akurinnoy , please squash and merge

@akurinnoy akurinnoy merged commit 46ecfee into devfile:main Jun 6, 2025
10 checks passed
@akurinnoy akurinnoy deleted the pvc-cleanup branch June 6, 2025 12:06
dkwon17 added a commit that referenced this pull request Jun 25, 2025
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.

Common PVC cleanup job can be assigned to incorrect node in multi-node cluster

3 participants