Skip to content

Commit

Permalink
Optimize a request to find device plugin pods.
Browse files Browse the repository at this point in the history
Add a resourceVersion=0 to the reuqest to find device plugin pods
on a given node from the latest cache from the kube-apiserver.
Without a resourceVersion the request needs to reach etcd first and
then kube-apiserver will filter out the pods.

Due to this etcd can get overloaded. Since it runs in daemonset,
they get created on every node. If a cluster has a lot of nodes
the list requests will put a cluster down.
  • Loading branch information
alan-kut committed Feb 1, 2024
1 parent a3a5ba9 commit 98f1b77
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions pkg/daemon/daemon.go
Original file line number Diff line number Diff line change
Expand Up @@ -732,8 +732,9 @@ func (dn *Daemon) restartDevicePluginPod() error {

var podToDelete string
pods, err := dn.kubeClient.CoreV1().Pods(vars.Namespace).List(context.Background(), metav1.ListOptions{
LabelSelector: "app=sriov-device-plugin",
FieldSelector: "spec.nodeName=" + vars.NodeName,
LabelSelector: "app=sriov-device-plugin",
FieldSelector: "spec.nodeName=" + vars.NodeName,
ResourceVersion: "0",
})
if err != nil {
if errors.IsNotFound(err) {
Expand Down

0 comments on commit 98f1b77

Please sign in to comment.