Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add more validation and local fix #124

Merged
merged 1 commit into from
Dec 8, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
}
Loading