Skip to content

Commit

Permalink
Add more validation (#124)
Browse files Browse the repository at this point in the history
When sejug was testing microshift he found some corner cases I didn't have
code for... Fixing that!

Signed-off-by: Joe Talerico <[email protected]>
Co-authored-by: Joe Talerico <[email protected]>
  • Loading branch information
jtaleric and Joe Talerico authored Dec 8, 2023
1 parent 5dd5adf commit 4dfa1c5
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 18 deletions.
25 changes: 8 additions & 17 deletions pkg/k8s/kubernetes.go
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ func BuildSUT(client *kubernetes.Clientset, s *config.PerfScenarios) error {
}
}
log.Debugf("Number of nodes with role worker: %d", ncount)
if !s.NodeLocal && ncount < 2 {
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 @@ -150,18 +150,6 @@ func BuildSUT(client *kubernetes.Clientset, s *config.PerfScenarios) error {
cdp.NodeAffinity = apiv1.NodeAffinity{
PreferredDuringSchedulingIgnoredDuringExecution: zoneNodeSelectorExpression(z),
}
cdp.PodAffinity = apiv1.PodAffinity{
RequiredDuringSchedulingIgnoredDuringExecution: []apiv1.PodAffinityTerm{
{
LabelSelector: &metav1.LabelSelector{
MatchExpressions: []metav1.LabelSelectorRequirement{
{Key: "role", Operator: metav1.LabelSelectorOpIn, Values: []string{serverRole}},
},
},
TopologyKey: "kubernetes.io/hostname",
},
},
}
}

cdp.NodeAffinity = apiv1.NodeAffinity{
Expand Down Expand Up @@ -345,10 +333,13 @@ func BuildSUT(client *kubernetes.Clientset, s *config.PerfScenarios) error {
}
sdpHost.PodAntiAffinity = antiAffinity
}
if s.HostNetwork {
s.ServerHost, err = deployDeployment(client, sdpHost)
if err != nil {
return err

if ncount > 1 {
if s.HostNetwork {
s.ServerHost, err = deployDeployment(client, sdpHost)
if err != nil {
return err
}
}
}
s.Server, err = deployDeployment(client, sdp)
Expand Down
7 changes: 6 additions & 1 deletion pkg/netperf/netperf.go
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,11 @@ func ParseResults(stdout *bytes.Buffer) (sample.Sample, error) {
if math.IsNaN(sample.Latency99ptile) {
return sample, fmt.Errorf("Latency value is NaN")
}
sample.LossPercent = 100 - (recv / send * 100)
// Negative values will mean UDP_STREAM
if sample.Retransmits < 0.0 {
sample.LossPercent = 100 - (recv / send * 100)
} else {
sample.LossPercent = 0
}
return sample, nil
}

0 comments on commit 4dfa1c5

Please sign in to comment.