Skip to content

Commit

Permalink
e2e: correctly wait for a fresh DaemonSet
Browse files Browse the repository at this point in the history
  • Loading branch information
burgerdev committed Jun 26, 2024
1 parent 6afa965 commit 1a0206b
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion e2e/internal/kubeclient/deploy.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,15 @@ func (d DaemonSet) watcher(ctx context.Context, client *kubernetes.Clientset, na

func (d DaemonSet) numDesiredPods(obj any) (int, error) {
if ds, ok := obj.(*appsv1.DaemonSet); ok {
return int(ds.Status.DesiredNumberScheduled), nil
n := int(ds.Status.DesiredNumberScheduled)
if n == 0 {
// DaemonSets start out with empty DesiredNumberScheduled, which then gets filled in by
// a controller. We don't expect any DaemonSets in our test resources that are
// intended to be empty, so we artificially require one pod until the status is set
// correctly.
n = 1
}
return n, nil
}
return 0, fmt.Errorf("watcher received unexpected type %T", obj)
}
Expand Down

0 comments on commit 1a0206b

Please sign in to comment.