Skip to content
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

Support draining DaemonSet pods using sriov devices #840

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

SchSeba
Copy link
Collaborator

@SchSeba SchSeba commented Feb 9, 2025

with this commit we also take care of removing DaemonSet owned pods using sriov devices.

we only do it when drain is requested we don't do it for reboot requests

Copy link

github-actions bot commented Feb 9, 2025

Thanks for your PR,
To run vendors CIs, Maintainers can use one of:

  • /test-all: To run all tests for all vendors.
  • /test-e2e-all: To run all E2E tests for all vendors.
  • /test-e2e-nvidia-all: To run all E2E tests for NVIDIA vendor.

To skip the vendors CIs, Maintainers can use one of:

  • /skip-all: To skip all tests for all vendors.
  • /skip-e2e-all: To skip all E2E tests for all vendors.
  • /skip-e2e-nvidia-all: To skip all E2E tests for NVIDIA vendor.
    Best regards.

@coveralls
Copy link

coveralls commented Feb 9, 2025

Pull Request Test Coverage Report for Build 13370907002

Details

  • 20 of 54 (37.04%) changed or added relevant lines in 1 file are covered.
  • 2 unchanged lines in 1 file lost coverage.
  • Overall coverage increased (+0.05%) to 47.344%

Changes Missing Coverage Covered Lines Changed/Added Lines %
pkg/drain/drainer.go 20 54 37.04%
Files with Coverage Reduction New Missed Lines %
pkg/drain/drainer.go 2 59.33%
Totals Coverage Status
Change from base Build 13109399258: 0.05%
Covered Lines: 7282
Relevant Lines: 15381

💛 - Coveralls

// remove pods that are owned by a DaemonSet and use SR-IOV devices
dsPodsList := getDsPodsToRemove(podList)
for _, pod := range dsPodsList {
err = d.kubeClient.CoreV1().Pods(pod.Namespace).Delete(ctx, pod.Name, metav1.DeleteOptions{})
Copy link
Collaborator

Choose a reason for hiding this comment

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

Shouldn't we block? Waiting to ensure that the pod is fully removed before continuing? A pod that's slow to delete might cause a race condition

Copy link
Collaborator Author

@SchSeba SchSeba Feb 17, 2025

Choose a reason for hiding this comment

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

yes I switch to use the drain from the kubernetes drain helper it does that :)

@SchSeba SchSeba force-pushed the drain_daemon branch 2 times, most recently from 2140f89 to c20fba0 Compare February 17, 2025 13:03

// on full drain there is no need to try and remove pods that are owned by DaemonSets
// as we are going to reboot the node in any case.
if fullNodeDrain {
Copy link
Collaborator

@adrianchiris adrianchiris Feb 18, 2025

Choose a reason for hiding this comment

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

do we care ? (just thinking how to simplify) why not always remove DS pods from node IF they have sriov resources ?

with this commit we also take care of removing daemonset owned pods
using sriov devices.

we only do it when drain is requested we don't do it for reboot requests

Signed-off-by: Sebastian Sch <[email protected]>
@@ -2376,6 +2538,18 @@ func waitForPodRunning(p *corev1.Pod) *corev1.Pod {
return ret
}

func waitForDaemonReady(d *appsv1.DaemonSet) *appsv1.DaemonSet {
Copy link
Collaborator

Choose a reason for hiding this comment

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

nit: waitForDaemonSetReady

reqLogger.Info("drainNode(): Draining failed, retrying", "error", err)
return false, nil

err = d.removeDaemonSetsFromNode(ctx, node.Name)
Copy link
Collaborator

Choose a reason for hiding this comment

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

I'm not entirely clear on how this works. I understand the process of selecting and removing DS pods, but I'm unsure how we prevent the DS controller from restarting pods on the node we intend to drain. Could you clarify?

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

Successfully merging this pull request may close these issues.

5 participants