Skip to content

Commit

Permalink
Add missing err check
Browse files Browse the repository at this point in the history
Signed-off-by: Raul Sevilla <rsevilla@redhat.com>
  • Loading branch information
rsevilla87 committed Sep 25, 2024
1 parent c50f9d7 commit 06b8d8e
Showing 1 changed file with 5 additions and 9 deletions.
14 changes: 5 additions & 9 deletions pkg/k8s/kubernetes.go
Original file line number Diff line number Diff line change
Expand Up @@ -154,16 +154,11 @@ func BuildSUT(client *kubernetes.Clientset, s *config.PerfScenarios) error {
}

// Get node count
nodes, err := client.CoreV1().Nodes().List(context.TODO(), metav1.ListOptions{LabelSelector: "node-role.kubernetes.io/worker="})
nodes, err := client.CoreV1().Nodes().List(context.TODO(), metav1.ListOptions{LabelSelector: "node-role.kubernetes.io/worker=,node-role.kubernetes.io/infra!="})
if err != nil {
return err
}
ncount := 0
for _, node := range nodes.Items {
if _, ok := node.Labels["node-role.kubernetes.io/infra"]; !ok {
ncount++
}
}
ncount := len(nodes.Items)
log.Debugf("Number of nodes with role worker: %d", ncount)
if (s.HostNetwork || !s.NodeLocal) && ncount < 2 {
return fmt.Errorf(" not enough nodes with label worker= to execute test (current number of nodes: %d).", ncount)
Expand Down Expand Up @@ -220,7 +215,9 @@ func BuildSUT(client *kubernetes.Clientset, s *config.PerfScenarios) error {
}
}
s.ClientNodeInfo, err = GetPodNodeInfo(client, labels.Set(cdp.Labels).String())
return err
if err != nil {
return err
}
}

// Create iperf service
Expand Down Expand Up @@ -412,7 +409,6 @@ func BuildSUT(client *kubernetes.Clientset, s *config.PerfScenarios) error {
}
sdpHost.PodAntiAffinity = antiAffinity
}

if ncount > 1 {
if s.HostNetwork {
if !s.VM {
Expand Down

0 comments on commit 06b8d8e

Please sign in to comment.