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 Jan 30, 2024
1 parent 54b342c commit e6dbb56
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 @@ -734,8 +734,9 @@ func (dn *Daemon) restartDevicePluginPod() error {

var podToDelete string
pods, err := dn.kubeClient.CoreV1().Pods(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 e6dbb56

Please sign in to comment.