Skip to content

Commit

Permalink
Fix concurrent map writes panic (#47)
Browse files Browse the repository at this point in the history
Signed-off-by: Raul Sevilla <[email protected]>
  • Loading branch information
rsevilla87 authored Oct 17, 2023
1 parent a83a1e4 commit 5776cd4
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 13 deletions.
5 changes: 2 additions & 3 deletions cmd/ingress-perf.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ import (
_ "github.com/cloud-bulldozer/ingress-perf/pkg/log"
"github.com/cloud-bulldozer/ingress-perf/pkg/runner"
uid "github.com/satori/go.uuid"
"github.com/sirupsen/logrus"
log "github.com/sirupsen/logrus"
"github.com/spf13/cobra"
)
Expand Down Expand Up @@ -54,11 +53,11 @@ func run() *cobra.Command {
SilenceUsage: true,
SilenceErrors: true,
PreRunE: func(cmd *cobra.Command, args []string) error {
lvl, err := logrus.ParseLevel(logLevel)
lvl, err := log.ParseLevel(logLevel)
if err != nil {
return err
}
logrus.SetLevel(lvl)
log.SetLevel(lvl)
return nil
},
RunE: func(cmd *cobra.Command, args []string) error {
Expand Down
20 changes: 10 additions & 10 deletions pkg/runner/exec.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,20 +41,10 @@ func runBenchmark(cfg config.Config, clusterMetadata tools.ClusterMetadata) ([]t
var benchmarkResult []tools.Result
var clientPods []corev1.Pod
var ep string
var tool tools.Tool
r, err := orClientSet.RouteV1().Routes(benchmarkNs).Get(context.TODO(), fmt.Sprintf("%s-%s", serverName, cfg.Termination), metav1.GetOptions{})
if err != nil {
return benchmarkResult, err
}
if cfg.Termination == "http" {
ep = fmt.Sprintf("http://%v%v", r.Spec.Host, cfg.Path)
} else {
ep = fmt.Sprintf("https://%v%v", r.Spec.Host, cfg.Path)
}
tool, err = tools.New(cfg, ep)
if err != nil {
return benchmarkResult, err
}
allClientPods, err := clientSet.CoreV1().Pods(benchmarkNs).List(context.TODO(), metav1.ListOptions{
LabelSelector: fmt.Sprintf("app=%s", clientName),
})
Expand Down Expand Up @@ -86,6 +76,16 @@ func runBenchmark(cfg config.Config, clusterMetadata tools.ClusterMetadata) ([]t
for i := 0; i < cfg.Procs; i++ {
func(p corev1.Pod) {
errGroup.Go(func() error {
if cfg.Termination == "http" {
ep = fmt.Sprintf("http://%v%v", r.Spec.Host, cfg.Path)
} else {
ep = fmt.Sprintf("https://%v%v", r.Spec.Host, cfg.Path)
}
tool, err := tools.New(cfg, ep)
if err != nil {
return err
}
log.Debugf("Running %v in client pods", tool.Cmd())
return exec(context.TODO(), tool, p, &result)
})
}(pod)
Expand Down

0 comments on commit 5776cd4

Please sign in to comment.