Skip to content

Commit

Permalink
Merge pull request #3087 from wojtek-t/bump_golang
Browse files Browse the repository at this point in the history
Bump golang in perf-test to 1.23.4
  • Loading branch information
k8s-ci-robot authored Jan 13, 2025
2 parents 3be6af7 + 2a33258 commit 870ce5a
Show file tree
Hide file tree
Showing 21 changed files with 41 additions and 41 deletions.
2 changes: 1 addition & 1 deletion benchmark/go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module k8s.io/perf-tests/benchmark

go 1.22.4
go 1.23.4

require (
github.com/dgryski/go-onlinestats v0.0.0-20170612111826-1c7d19468768
Expand Down
6 changes: 3 additions & 3 deletions benchmark/pkg/util/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -188,20 +188,20 @@ func GetFlattennedComparisonData(leftJobMetrics, rightJobMetrics []map[string][]
return j
}

func computeSampleStats(sample []float64, avg, stDev, max *float64) {
func computeSampleStats(sample []float64, avg, stDev, maxVal *float64) {
length := len(sample)
if length == 0 {
*avg = math.NaN()
*stDev = math.NaN()
*max = math.NaN()
*maxVal = math.NaN()
return
}
sum := 0.0
squareSum := 0.0
for i := 0; i < length; i++ {
sum += sample[i]
squareSum += sample[i] * sample[i]
*max = math.Max(*max, sample[i])
*maxVal = math.Max(*maxVal, sample[i])
}
*avg = sum / float64(length)
*stDev = math.Sqrt(squareSum/float64(length) - (*avg * *avg))
Expand Down
2 changes: 1 addition & 1 deletion clusterloader2/go.mod
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
module k8s.io/perf-tests/clusterloader2

// go 1.15+ is required by k8s 1.20 we use as dependency.
go 1.22.4
go 1.23.4

replace (
k8s.io/api => k8s.io/api v0.29.7
Expand Down
12 changes: 6 additions & 6 deletions clusterloader2/pkg/config/template_functions.go
Original file line number Diff line number Diff line change
Expand Up @@ -193,22 +193,22 @@ func maxFloat(numbers ...interface{}) float64 {
if len(numbers) == 0 {
panic("maximum undefined")
}
max := toFloat64(numbers[0])
result := toFloat64(numbers[0])
for _, number := range numbers {
max = math.Max(max, toFloat64(number))
result = math.Max(result, toFloat64(number))
}
return max
return result
}

func minFloat(numbers ...interface{}) float64 {
if len(numbers) == 0 {
panic("minimum undefined")
}
min := toFloat64(numbers[0])
result := toFloat64(numbers[0])
for _, number := range numbers {
min = math.Min(min, toFloat64(number))
result = math.Min(result, toFloat64(number))
}
return min
return result
}

func mod(a interface{}, b interface{}) int {
Expand Down
12 changes: 6 additions & 6 deletions clusterloader2/pkg/imagepreload/imagepreload.go
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ func (c *controller) PreloadImages() error {
return kclient.CoreV1().Nodes().Watch(context.TODO(), options)
},
},
func(old, new interface{}) { c.checkNode(doneNodes, old, new) })
func(oldObj, newObj interface{}) { c.checkNode(doneNodes, oldObj, newObj) })
if err := informer.StartAndSync(nodeInformer, stopCh, informerTimeout); err != nil {
return err
}
Expand Down Expand Up @@ -164,15 +164,15 @@ func (c *controller) PreloadImages() error {
return nil
}

func (c *controller) checkNode(set map[string]struct{}, old, new interface{}) {
if new != nil {
node := new.(*v1.Node)
func (c *controller) checkNode(set map[string]struct{}, oldObj, newObj interface{}) {
if newObj != nil {
node := newObj.(*v1.Node)
preloaded := c.hasPreloadedImages(node)
c.markDone(set, node.Name, preloaded)
return
}
if old != nil {
node := old.(*v1.Node)
if oldObj != nil {
node := oldObj.(*v1.Node)
c.markDone(set, node.Name, false)
return
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -293,13 +293,13 @@ func isCandidateNode(node v1.Node) bool {
return true
}

func preparePatchBytes(old, new, refStruct interface{}) ([]byte, error) {
oldBytes, err := json.Marshal(old)
func preparePatchBytes(oldObj, newObj, refStruct interface{}) ([]byte, error) {
oldBytes, err := json.Marshal(oldObj)
if err != nil {
return nil, fmt.Errorf("failed to marshal old object: %v", err)
}

newBytes, err := json.Marshal(new)
newBytes, err := json.Marshal(newObj)
if err != nil {
return nil, fmt.Errorf("failed to marshal new object: %v", err)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@ func (npm *networkPerformanceMeasurement) gather() (measurement.Summary, error)
if err != nil {
klog.Infof("Failed to print metrics: %v", err)
}
summaryName := fmt.Sprintf(npm.String() + "_" + resultSummary.podRatio + "_" + resultSummary.protocol + "_" + resultSummary.service)
summaryName := fmt.Sprint(npm.String() + "_" + resultSummary.podRatio + "_" + resultSummary.protocol + "_" + resultSummary.service)
return measurement.CreateSummary(summaryName, "json", content), nil
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -514,7 +514,7 @@ func (w *waitForControlledPodsRunningMeasurement) updateCacheLocked(oldObj, newO
if errList.IsEmpty() {
return nil
}
return fmt.Errorf(errList.Error())
return errList
}

func (w *waitForControlledPodsRunningMeasurement) updateOpResourceVersionLocked(runtimeObj runtime.Object) error {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,18 +135,18 @@ func getNamespaces(namespacesPrefix string, params map[string]interface{}) (meas
if err != nil {
return measurementutil.NamespacesRange{}, err
}
min, err := util.GetInt(namespaceRange, "min")
minParam, err := util.GetInt(namespaceRange, "min")
if err != nil {
return measurementutil.NamespacesRange{}, err
}
max, err := util.GetInt(namespaceRange, "max")
maxParam, err := util.GetInt(namespaceRange, "max")
if err != nil {
return measurementutil.NamespacesRange{}, err
}

return measurementutil.NamespacesRange{
Prefix: namespacesPrefix,
Min: min,
Max: max,
Min: minParam,
Max: maxParam,
}, nil
}
2 changes: 1 addition & 1 deletion dns/dnsperfgo/go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module k8s.io/perf-tests/dns/dnsperfgo

go 1.22.4
go 1.23.4

require (
github.com/prometheus/client_golang v1.20.5
Expand Down
2 changes: 1 addition & 1 deletion dns/jsonify/go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module k8s.io/perf-tests/dns/jsonify

go 1.22.4
go 1.23.4

require (
github.com/golang/glog v1.2.3
Expand Down
2 changes: 1 addition & 1 deletion network/benchmarks/netperf/go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module k8s.io/perf-tests/network

go 1.22.4
go 1.23.4

require (
k8s.io/api v0.31.3
Expand Down
8 changes: 4 additions & 4 deletions network/benchmarks/netperf/nptest/nptest.go
Original file line number Diff line number Diff line change
Expand Up @@ -411,14 +411,14 @@ func flushDataPointsToCsv() {
for _, label := range dataPointKeys {
buffer = fmt.Sprintf("%-45s,", label)
points := dataPoints[label]
var max float64
var result float64
for _, p := range points {
fv, _ := strconv.ParseFloat(p.bandwidth, 64)
if fv > max {
max = fv
if fv > result {
result = fv
}
}
buffer = buffer + fmt.Sprintf("%f,", max)
buffer = buffer + fmt.Sprintf("%f,", result)
for _, p := range points {
buffer = buffer + fmt.Sprintf("%s,", p.bandwidth)
}
Expand Down
2 changes: 1 addition & 1 deletion network/tools/network-policy-enforcement-latency/go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module k8s.io/perf-tests/network/tools/network-policy-enforcement-latency

go 1.22.4
go 1.23.4

require (
github.com/prometheus/client_golang v1.20.5
Expand Down
2 changes: 1 addition & 1 deletion perfdash/go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module k8s.io/perf-tests/perfdash

go 1.22.4
go 1.23.4

require (
cloud.google.com/go v0.116.0 // indirect
Expand Down
2 changes: 1 addition & 1 deletion slo-monitor/go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module k8s.io/perf-tests/slo-monitor

go 1.22.4
go 1.23.4

require (
github.com/golang/glog v1.2.3
Expand Down
2 changes: 1 addition & 1 deletion util-images/access-tokens/go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module k8s.io/perf-tests/access-tokens

go 1.22.4
go 1.23.4

require (
github.com/spf13/pflag v1.0.5
Expand Down
2 changes: 1 addition & 1 deletion util-images/network/netperfbenchmark/go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module k8s.io/perf-tests/util-images/network/netperfbenchmark

go 1.22.4
go 1.23.4

require (
k8s.io/apimachinery v0.31.3
Expand Down
2 changes: 1 addition & 1 deletion util-images/probes/go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module k8s.io/perf-tests/util-images/probes

go 1.22.4
go 1.23.4

require (
github.com/prometheus/client_golang v1.20.5
Expand Down
2 changes: 1 addition & 1 deletion util-images/request-benchmark/go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module k8s.io/perf-tests/request-benchmark

go 1.22.4
go 1.23.4

require k8s.io/client-go v0.31.3

Expand Down
2 changes: 1 addition & 1 deletion util-images/watch-list/go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module k8s.io/perf-tests/watch-list

go 1.22.4
go 1.23.4

require (
k8s.io/apimachinery v0.31.3
Expand Down

0 comments on commit 870ce5a

Please sign in to comment.