From 61aad6f6e60fe4fb9b87cdf9ed4f59319b87c4b2 Mon Sep 17 00:00:00 2001 From: Antonin Bas Date: Wed, 9 Aug 2023 14:39:35 -0700 Subject: [PATCH 1/6] Update Go to v1.21 * Replace usage of "golang.org/x/exp/slices" with new "slices" package. * Remove calls to "rand.Seed": starting with Go v1.20, the generator is seeded randomly at program startup, and we no longer need to do it manually. * The codegen image has been updated to kubernetes-1.26.4-build.0 to include the updated version of Go. No changes im generated files. * Stop using "golang.org/x/exp/rand" in test/e2e/performance_test.go: this is unrelated to the Go update. Fixes #5371 Signed-off-by: Antonin Bas --- CONTRIBUTING.md | 2 +- Makefile | 2 +- build/images/codegen/Dockerfile | 1 - build/images/codegen/README.md | 1 + build/images/deps/go-version | 2 +- cmd/antctl/main.go | 3 --- go.mod | 3 +-- go.sum | 26 +++++++++++++++++++-- hack/update-codegen.sh | 4 +++- hack/windows/Install-DevTools.ps1 | 2 +- multicluster/hack/update-codegen.sh | 4 +++- multicluster/test/e2e/main_test.go | 2 -- pkg/agent/openflow/cookie/allocator_test.go | 2 -- pkg/flowaggregator/exporter/log.go | 2 +- test/e2e/main_test.go | 3 --- test/e2e/performance_test.go | 18 ++++++++------ test/integration/agent/net_test.go | 5 ---- 17 files changed, 48 insertions(+), 34 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 30861c3629e..8f58089f06e 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -254,7 +254,7 @@ the `$GOPATH`. To develop locally, you can follow these steps: - 1. [Install Go 1.19](https://golang.org/doc/install) + 1. [Install Go 1.21](https://golang.org/doc/install) 2. Checkout your feature branch and `cd` into it. 3. To build all Go files and install them under `bin`, run `make bin` 4. To run all Go unit tests, run `make test-unit` diff --git a/Makefile b/Makefile index 93fc4439129..3f37a7a844f 100644 --- a/Makefile +++ b/Makefile @@ -20,7 +20,7 @@ GIT_HOOKS := $(shell find hack/git_client_side_hooks -type f -print) DOCKER_NETWORK ?= default TRIVY_TARGET_IMAGE ?= -GOLANGCI_LINT_VERSION := v1.52.2 +GOLANGCI_LINT_VERSION := v1.54.0 GOLANGCI_LINT_BINDIR := $(CURDIR)/.golangci-bin GOLANGCI_LINT_BIN := $(GOLANGCI_LINT_BINDIR)/$(GOLANGCI_LINT_VERSION)/golangci-lint diff --git a/build/images/codegen/Dockerfile b/build/images/codegen/Dockerfile index ce5a8617acb..2162d4c9695 100644 --- a/build/images/codegen/Dockerfile +++ b/build/images/codegen/Dockerfile @@ -53,4 +53,3 @@ RUN go install k8s.io/code-generator/cmd/client-gen@kubernetes-$K8S_VERSION && \ COPY --from=protoc /tmp/protoc/bin /usr/local/bin COPY --from=protoc /tmp/protoc/include /usr/local/include - diff --git a/build/images/codegen/README.md b/build/images/codegen/README.md index 4ef317f36e6..629ce7bb5f7 100644 --- a/build/images/codegen/README.md +++ b/build/images/codegen/README.md @@ -20,6 +20,7 @@ Here is the table of codegen images that have been uploaded: | Tag | Change | | :----------------------------- | --------------------------------------- | +| kubernetes-1.26.4-build.0 | Upgraded Go to v1.21 | | kubernetes-1.26.4 | Upgraded K8s libraries to v1.26.4 | | kubernetes-1.24.0-build.2 | Upgraded base image to ubuntu:22.04 | | kubernetes-1.24.0-build.1 | Upgraded Go to v1.19 | diff --git a/build/images/deps/go-version b/build/images/deps/go-version index bc4493477ae..d2ab029d32c 100644 --- a/build/images/deps/go-version +++ b/build/images/deps/go-version @@ -1 +1 @@ -1.19 +1.21 diff --git a/cmd/antctl/main.go b/cmd/antctl/main.go index 128fe96f413..6ab8224bdd4 100644 --- a/cmd/antctl/main.go +++ b/cmd/antctl/main.go @@ -15,10 +15,8 @@ package main import ( - "math/rand" "os" "path" - "time" "github.com/spf13/cobra" @@ -37,7 +35,6 @@ var rootCmd = &cobra.Command{ func main() { defer log.FlushLogs() - rand.Seed(time.Now().UTC().UnixNano()) antctl.CommandList.ApplyToRootCommand(rootCmd) err := rootCmd.Execute() if err != nil { diff --git a/go.mod b/go.mod index 8568411e477..073fb23bcaa 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module antrea.io/antrea -go 1.19 +go 1.21 require ( antrea.io/libOpenflow v0.12.1 @@ -54,7 +54,6 @@ require ( github.com/vishvananda/netlink v1.1.1-0.20211101163509-b10eb8fe5cf6 github.com/vmware/go-ipfix v0.6.2 golang.org/x/crypto v0.12.0 - golang.org/x/exp v0.0.0-20230321023759-10a507213a29 golang.org/x/mod v0.12.0 golang.org/x/net v0.14.0 golang.org/x/sync v0.3.0 diff --git a/go.sum b/go.sum index eedc10fe90a..70c593e9f96 100644 --- a/go.sum +++ b/go.sum @@ -30,7 +30,9 @@ cloud.google.com/go/bigquery v1.5.0/go.mod h1:snEHRnqQbz117VIFhE8bmtwIDY80NLUZUM cloud.google.com/go/bigquery v1.7.0/go.mod h1://okPTzCYNXSlb24MZs83e2Do+h+VXtc4gLoIoXIAPc= cloud.google.com/go/bigquery v1.8.0/go.mod h1:J5hqkt3O0uAFnINi6JXValWIb1v0goeZM77hZzJN/fQ= cloud.google.com/go/compute v1.19.1 h1:am86mquDUgjGNWxiGn+5PGLbmgiWXlE/yNWpIpNvuXY= +cloud.google.com/go/compute v1.19.1/go.mod h1:6ylj3a05WF8leseCdIf77NK0g1ey+nj5IKd5/kvShxE= cloud.google.com/go/compute/metadata v0.2.3 h1:mg4jlk7mCAj6xXp9UJ4fjI9VUI5rubuGBW5aJ7UnBMY= +cloud.google.com/go/compute/metadata v0.2.3/go.mod h1:VAV5nSsACxMJvgaAuX6Pk2AawlZn8kiOGuCv6gTkwuA= cloud.google.com/go/datastore v1.0.0/go.mod h1:LXYbyblFSglQ5pkeyhO+Qmw7ukd3C+pD7TKLgZqpHYE= cloud.google.com/go/datastore v1.1.0/go.mod h1:umbIZjpQpHh4hmRpGhH4tLFup+FVzqBi1b3c64qFpCk= cloud.google.com/go/pubsub v1.0.1/go.mod h1:R0Gpsv3s54REJCy4fxDixWD93lHJMoZTyQ2kNxGRt3I= @@ -131,6 +133,7 @@ github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6/go.mod h1:grANhF5 github.com/armon/go-metrics v0.0.0-20180917152333-f0300d1749da h1:8GUt8eRujhVEGZFFEjBj46YV4rDjvGrNxb0KMWYkL2I= github.com/armon/go-metrics v0.0.0-20180917152333-f0300d1749da/go.mod h1:Q73ZrmVTwzkszR9V5SSuryQ31EELlFMUz1kKyl939pY= github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5 h1:0CwZNZbxp69SHPdPJAN/hZIm0C4OItdklCFmMRWYpio= +github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5/go.mod h1:wHh0iHkYZB8zMSxRWpUBQtwG5a7fFgvEO+odwuTv2gs= github.com/asaskevich/govalidator v0.0.0-20180720115003-f9ffefc3facf/go.mod h1:lB+ZfQJz7igIIfQNfa7Ml4HSf2uFQQRzpGGRXenZAgY= github.com/asaskevich/govalidator v0.0.0-20190424111038-f61b66f89f4a/go.mod h1:lB+ZfQJz7igIIfQNfa7Ml4HSf2uFQQRzpGGRXenZAgY= github.com/aws/aws-sdk-go v1.15.11/go.mod h1:mFuSZ37Z9YOHbQEwBWztmVzqXrEkub65tZoCYDt7FT0= @@ -172,6 +175,7 @@ github.com/aws/aws-sdk-go-v2/service/sts v1.16.12/go.mod h1:b53qpmhHk7mTL2J/tfG6 github.com/aws/smithy-go v1.12.1 h1:yQRC55aXN/y1W10HgwHle01DRuV9Dpf31iGkotjt3Ag= github.com/aws/smithy-go v1.12.1/go.mod h1:Tg+OJXh4MB2R/uN61Ko2f6hTZwB/ZYGOtib8J3gBHzA= github.com/benbjohnson/clock v1.1.0 h1:Q92kusRqC1XV2MjkWETPvjJVqKetz1OzxZB7mHJLju8= +github.com/benbjohnson/clock v1.1.0/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA= github.com/beorn7/perks v0.0.0-20160804104726-4c0e84591b9a/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q= github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q= github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8= @@ -230,6 +234,7 @@ github.com/cncf/xds/go v0.0.0-20210805033703-aa0b78936158/go.mod h1:eXthEFrGJvWH github.com/cncf/xds/go v0.0.0-20210922020428-25de7278fc84/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= github.com/cncf/xds/go v0.0.0-20211011173535-cb28da3451f1/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= github.com/cncf/xds/go v0.0.0-20230607035331-e9ce68804cb4 h1:/inchEIKaYC1Akx+H+gqO04wryn5h75LSazbRlnya1k= +github.com/cncf/xds/go v0.0.0-20230607035331-e9ce68804cb4/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= github.com/cockroachdb/datadriven v0.0.0-20190809214429-80d97fb3cbaa/go.mod h1:zn76sxSg3SzpJ0PPJaLDCu+Bu0Lg3sKTORVIj19EIF8= github.com/confluentinc/bincover v0.1.0 h1:M4Gfj4rCXuUQVe8TqT/VXcAMjLyvN81oDRy79fjSv3o= github.com/confluentinc/bincover v0.1.0/go.mod h1:qeI1wx0RxdGTZtrJY0HVlgJ4NqC/X2Z+fHbvy87tgHE= @@ -387,6 +392,7 @@ github.com/docopt/docopt-go v0.0.0-20180111231733-ee0de3bc6815/go.mod h1:WwZ+bS3 github.com/dustin/go-humanize v0.0.0-20171111073723-bb3d318650d4/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= github.com/dustin/go-humanize v1.0.0/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= github.com/dustin/go-humanize v1.0.1 h1:GzkhY7T5VNhEkwH0PVJgjz+fX1rhBrR7pRT3mDkpeCY= +github.com/dustin/go-humanize v1.0.1/go.mod h1:Mu1zIs6XwVuF/gI1OepvI0qD18qycQx+mFykh5fBlto= github.com/elazarl/goproxy v0.0.0-20180725130230-947c36da3153/go.mod h1:/Zj4wYkgs4iZTTu3o/KG3Itv/qCCa8VVMlb3i9OVuzc= github.com/elazarl/goproxy v0.0.0-20190911111923-ecfe977594f1 h1:yY9rWGoXv1U5pl4gxqlULARMQD7x0QG85lqEXTWysik= github.com/elazarl/goproxy v0.0.0-20190911111923-ecfe977594f1/go.mod h1:Ro8st/ElPeALwNFlcTpWmkr6IoMFfkjXAvTHpevnDsM= @@ -405,6 +411,7 @@ github.com/envoyproxy/go-control-plane v0.9.9-0.20210512163311-63b5d3c536b0/go.m github.com/envoyproxy/go-control-plane v0.9.10-0.20210907150352-cf90f659a021/go.mod h1:AFq3mo9L8Lqqiid3OhADV3RfLJnjiw63cSpi+fDTRC0= github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= github.com/envoyproxy/protoc-gen-validate v0.10.1 h1:c0g45+xCJhdgFGw7a5QAfdS4byAbud7miNWJ1WwEVf8= +github.com/envoyproxy/protoc-gen-validate v0.10.1/go.mod h1:DRjgyB0I43LtJapqN6NiRwroiAU2PaFuvk/vjgh61ss= github.com/evanphx/json-patch v0.5.2/go.mod h1:ZWS5hhDbVDyob71nXKNL0+PWn6ToqBHMikGIFbs31qQ= github.com/evanphx/json-patch v4.2.0+incompatible/go.mod h1:50XU6AFN0ol/bzJsmQLiYLvXMP4fmwYFNcr97nuDLSk= github.com/evanphx/json-patch v4.5.0+incompatible/go.mod h1:50XU6AFN0ol/bzJsmQLiYLvXMP4fmwYFNcr97nuDLSk= @@ -423,6 +430,7 @@ github.com/felixge/httpsnoop v1.0.3 h1:s/nj+GCswXYzN5v2DpNMuMQYe+0DDwt5WVCU6CWBd github.com/felixge/httpsnoop v1.0.3/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSwevea8zH2U= github.com/form3tech-oss/jwt-go v3.2.2+incompatible/go.mod h1:pbq4aXjuKjdthFRnoDwaVPLA+WlJuPGy+QneDUgJi2k= github.com/form3tech-oss/jwt-go v3.2.3+incompatible h1:7ZaBxOI7TMoYBfyA3cQHErNNyAWIKUMIwqxEtgHOs5c= +github.com/form3tech-oss/jwt-go v3.2.3+incompatible/go.mod h1:pbq4aXjuKjdthFRnoDwaVPLA+WlJuPGy+QneDUgJi2k= github.com/frankban/quicktest v1.11.3/go.mod h1:wRf/ReqHper53s+kmmSZizM8NamnL3IM0I9ntUbOk+k= github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ= @@ -464,6 +472,7 @@ github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= github.com/go-logr/zapr v0.1.0/go.mod h1:tabnROwaDl0UNxkVeFRbY8bwB37GwRv0P8lg6aAiEnk= github.com/go-logr/zapr v1.2.3 h1:a9vnzlIBPQBBkeaR9IuMUfmVOrQlkoC4YfPoFkX3T7A= +github.com/go-logr/zapr v1.2.3/go.mod h1:eIauM6P8qSvTw5o2ez6UEAfGjQKrxQTl5EoK+Qa2oG4= github.com/go-openapi/analysis v0.0.0-20180825180245-b006789cd277/go.mod h1:k70tL6pCuVxPJOHXQ+wIac1FUrvNkHolPie/cLEU6hI= github.com/go-openapi/analysis v0.17.0/go.mod h1:IowGgpVeD0vNm45So8nr+IcQ3pxVtpRoBWb8PVZO0ik= github.com/go-openapi/analysis v0.18.0/go.mod h1:IowGgpVeD0vNm45So8nr+IcQ3pxVtpRoBWb8PVZO0ik= @@ -535,6 +544,7 @@ github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69 github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= github.com/golang/glog v1.0.0/go.mod h1:EWib/APOK0SL3dFbYqvxE3UYd8E6s1ouQ7iEp/0LWV4= github.com/golang/glog v1.1.0 h1:/d3pCKDPWNnvIWe0vVUpNP32qc8U3PDVxySP/y360qE= +github.com/golang/glog v1.1.0/go.mod h1:pfYeQZ3JWZoXTV5sFc986z3HTpwQs9At6P4ImfuP3NQ= github.com/golang/groupcache v0.0.0-20160516000752-02826c3e7903/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/groupcache v0.0.0-20190129154638-5b532d6fd5ef/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= @@ -644,6 +654,7 @@ github.com/gregjones/httpcache v0.0.0-20180305231024-9cad4c3443a7/go.mod h1:Fecb github.com/grpc-ecosystem/go-grpc-middleware v1.0.0/go.mod h1:FiyG127CGDf3tlThmgyCl78X/SZQqEOJBCDaAfeWzPs= github.com/grpc-ecosystem/go-grpc-middleware v1.0.1-0.20190118093823-f849b5445de4/go.mod h1:FiyG127CGDf3tlThmgyCl78X/SZQqEOJBCDaAfeWzPs= github.com/grpc-ecosystem/go-grpc-middleware v1.3.0 h1:+9834+KizmvFV7pXQGSXQTsaWhq2GjuNUt0aUU0YBYw= +github.com/grpc-ecosystem/go-grpc-middleware v1.3.0/go.mod h1:z0ButlSOZa5vEBq9m2m2hlwIgKw+rp3sdCBRoJY+30Y= github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0 h1:Ovs26xHkKqVztRpIrF/92BcuyuQ/YW4NSIpoGtfXNho= github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0/go.mod h1:8NvIoxWQoOIhqOTXgfV/d3M/q6VIi02HzZEHgUlZvzk= github.com/grpc-ecosystem/grpc-gateway v1.9.0/go.mod h1:vNeuVxBJEsws4ogUvrchl83t/GYV9WGTSLVdBhOQFDY= @@ -668,6 +679,7 @@ github.com/hashicorp/go-sockaddr v1.0.0 h1:GeH6tui99pF4NJgfnhp+L6+FfobzVW3Ah46sL github.com/hashicorp/go-sockaddr v1.0.0/go.mod h1:7Xibr9yA9JjQq1JpNB2Vw7kxv8xerXegt+ozgdvDeDU= github.com/hashicorp/go-uuid v1.0.0/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= github.com/hashicorp/go-uuid v1.0.3 h1:2gKiV6YVmrJ1i2CKKa9obLvRieoRGviZFL26PcT/Co8= +github.com/hashicorp/go-uuid v1.0.3/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= github.com/hashicorp/golang-lru v0.5.4 h1:YDjusn29QI/Das2iO9M0BHnIbxPeyuCHsjMW+lJfyTc= @@ -699,6 +711,7 @@ github.com/jmespath/go-jmespath/internal/testify v1.5.1/go.mod h1:L3OGu8Wl2/fWfC github.com/joefitzgerald/rainbow-reporter v0.1.0/go.mod h1:481CNgqmVHQZzdIbN52CupLJyoVwB10FQ/IQlF1pdL8= github.com/jonboulle/clockwork v0.1.0/go.mod h1:Ii8DK3G1RaLaWxj9trq07+26W01tbo22gdxWY5EU2bo= github.com/jonboulle/clockwork v0.2.2 h1:UOGuzwb1PwsrDAObMuhUnj0p5ULPj8V/xJ7Kx9qUBdQ= +github.com/jonboulle/clockwork v0.2.2/go.mod h1:Pkfl5aHPm1nk2H9h0bjmnJD/BcgbGXUBGnn1kMkgxc8= github.com/josharian/intern v1.0.0 h1:vlS4z54oSdjm0bgjRigI+G1HpF+tI+9rE5LLzOg8HmY= github.com/josharian/intern v1.0.0/go.mod h1:5DoeVV0s6jJacbCEi61lwdGj/aVlrQvzHFFd8Hwg//Y= github.com/josharian/native v0.0.0-20200817173448-b6b71def0850/go.mod h1:7X/raswPFr05uY3HiLlYeyQntB6OO7E/d2Cu7qoaN2w= @@ -749,6 +762,7 @@ github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORN github.com/kr/pretty v0.2.0/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= +github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= github.com/kr/pty v1.1.5/go.mod h1:9r2w37qlBe7rQ6e1fg1S/9xpWHSnaqNdHD3WcMdbPDA= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= @@ -872,6 +886,7 @@ github.com/onsi/ginkgo v1.12.1/go.mod h1:zj2OWP4+oCPe1qIXoGWkgMRwljMUYCdkwsT2108 github.com/onsi/ginkgo v1.14.0/go.mod h1:iSB4RoI2tjJc9BBv4NKIKWKya62Rps+oPG/Lv9klQyY= github.com/onsi/ginkgo v1.16.4/go.mod h1:dX+/inL/fNMqNlz0e9LfyB9TswhZpCVdJM/Z6Vvnwo0= github.com/onsi/ginkgo v1.16.5 h1:8xi0RTUf59SOSfEtZMvwTvXYMzG4gV23XVHOZiXNtnE= +github.com/onsi/ginkgo v1.16.5/go.mod h1:+E8gABHa3K6zRBolWtd+ROzc/U5bkGt0FwiG042wbpU= github.com/onsi/ginkgo/v2 v2.1.3/go.mod h1:vw5CSIxN1JObi/U8gcbwft7ZxR2dgaR70JSE3/PpL4c= github.com/onsi/ginkgo/v2 v2.11.0 h1:WgqUCUt/lT6yXoQ8Wef0fsNn5cAuMK7+KT9UFRz2tcU= github.com/onsi/ginkgo/v2 v2.11.0/go.mod h1:ZhrRA5XmEE3x3rhlzamx/JJvujdZoJ2uvgI7kR0iZvM= @@ -992,6 +1007,7 @@ github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6L github.com/rogpeppe/go-charset v0.0.0-20180617210344-2471d30d28b4/go.mod h1:qgYeAmZ5ZIpBWTGllZSQnw97Dj+woV0toclVaRGI8pc= github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= github.com/rogpeppe/go-internal v1.10.0 h1:TMyTOH3F/DB16zRVcYyreMH6GnZZrwQVAoYjRBZyWFQ= +github.com/rogpeppe/go-internal v1.10.0/go.mod h1:UQnix2H7Ngw/k4C5ijL5+65zddjncjaFoBhdsK/akog= github.com/russross/blackfriday v1.5.2/go.mod h1:JO/DiYxRf+HjHt06OyowR9PTA263kcR/rfWxYHBV53g= github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= github.com/russross/blackfriday/v2 v2.1.0 h1:JIOH55/0cWyOuilr9/qlrm0BSXldqnqwMsf35Ld67mk= @@ -1008,6 +1024,7 @@ github.com/segmentio/asm v1.2.0 h1:9BQrFxC+YOHJlTlHGkTrFWf59nbL3XnCoFLTwDCI7ys= github.com/segmentio/asm v1.2.0/go.mod h1:BqMnlJP91P8d+4ibuonYZw9mfnzI9HfxselHZr5aAcs= github.com/sergi/go-diff v1.0.0/go.mod h1:0CfEIISq7TuYL3j771MWULgwwjU+GofnZX9QAmXWZgo= github.com/sergi/go-diff v1.1.0 h1:we8PVUC3FE2uYfodKH/nBHMSetSfHDR6scGdBi+erh0= +github.com/sergi/go-diff v1.1.0/go.mod h1:STckp+ISIX8hZLjrqAeVduY0gWCT9IjLuqbuNXdaHfM= github.com/shopspring/decimal v1.3.1 h1:2Usl1nmF/WZucqkFZhnfFYxxxu8LG21F6nPQBE5gKV8= github.com/shopspring/decimal v1.3.1/go.mod h1:DKyhrW/HYNuLGql+MJL6WCR6knT2jwCFRcu2hWCYk4o= github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc= @@ -1025,6 +1042,7 @@ github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1 github.com/smartystreets/goconvey v0.0.0-20190330032615-68dc04aab96a/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA= github.com/soheilhy/cmux v0.1.4/go.mod h1:IM3LyeVVIOuxMH7sFAkER9+bJ4dT7Ms6E4xg4kGIyLM= github.com/soheilhy/cmux v0.1.5 h1:jjzc5WVemNEDTLwv9tlmemhC73tI08BNOIGwBOo10Js= +github.com/soheilhy/cmux v0.1.5/go.mod h1:T7TcVDs9LWfQgPlPsdngu6I6QIoyIFZDDC6sNE1GqG0= github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= github.com/spf13/afero v1.1.2/go.mod h1:j4pytiNVoe2o6bmDsKpLACNPDBIoEAkihy7loJ1B0CQ= github.com/spf13/afero v1.2.2/go.mod h1:9ZxEEn6pIJ8Rxe320qSDBk6AsU0r9pR7Q4OcevTdifk= @@ -1081,6 +1099,7 @@ github.com/tidwall/pretty v1.0.0/go.mod h1:XNkn88O1ChpSDQmQeStsy+sBenx6DDtFZJxhV github.com/tmc/grpc-websocket-proxy v0.0.0-20170815181823-89b8d40f7ca8/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U= github.com/tmc/grpc-websocket-proxy v0.0.0-20190109142713-0ad062ec5ee5/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U= github.com/tmc/grpc-websocket-proxy v0.0.0-20201229170055-e5319fda7802 h1:uruHq4dN7GR16kFc5fp3d1RIYzJW5onx8Ybykw2YQFA= +github.com/tmc/grpc-websocket-proxy v0.0.0-20201229170055-e5319fda7802/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U= github.com/ugorji/go v1.1.4/go.mod h1:uQMGLiO92mf5W77hV/PUCpI3pbzQx3CRekS0kk+RGrc= github.com/ugorji/go/codec v0.0.0-20181204163529-d75b2dcb6bc8/go.mod h1:VFNgLljTbGfSG7qAOspJ7OScBnGdDN/yBr0sguwnwf0= github.com/urfave/cli v0.0.0-20171014202726-7bc6a0acffa5/go.mod h1:70zkFmudgCuE/ngEzBv17Jvp/497gISqfk5gWijbERA= @@ -1134,11 +1153,15 @@ go.etcd.io/etcd/api/v3 v3.5.5/go.mod h1:KFtNaxGDw4Yx/BA4iPPwevUTAuqcsPxzyX8PHydc go.etcd.io/etcd/client/pkg/v3 v3.5.5 h1:9S0JUVvmrVl7wCF39iTQthdaaNIiAaQbmK75ogO6GU8= go.etcd.io/etcd/client/pkg/v3 v3.5.5/go.mod h1:ggrwbk069qxpKPq8/FKkQ3Xq9y39kbFR4LnKszpRXeQ= go.etcd.io/etcd/client/v2 v2.305.5 h1:DktRP60//JJpnPC0VBymAN/7V71GHMdjDCBt4ZPXDjI= +go.etcd.io/etcd/client/v2 v2.305.5/go.mod h1:zQjKllfqfBVyVStbt4FaosoX2iYd8fV/GRy/PbowgP4= go.etcd.io/etcd/client/v3 v3.5.5 h1:q++2WTJbUgpQu4B6hCuT7VkdwaTP7Qz6Daak3WzbrlI= go.etcd.io/etcd/client/v3 v3.5.5/go.mod h1:aApjR4WGlSumpnJ2kloS75h6aHUmAyaPLjHMxpc7E7c= go.etcd.io/etcd/pkg/v3 v3.5.5 h1:Ablg7T7OkR+AeeeU32kdVhw/AGDsitkKPl7aW73ssjU= +go.etcd.io/etcd/pkg/v3 v3.5.5/go.mod h1:6ksYFxttiUGzC2uxyqiyOEvhAiD0tuIqSZkX3TyPdaE= go.etcd.io/etcd/raft/v3 v3.5.5 h1:Ibz6XyZ60OYyRopu73lLM/P+qco3YtlZMOhnXNS051I= +go.etcd.io/etcd/raft/v3 v3.5.5/go.mod h1:76TA48q03g1y1VpTue92jZLr9lIHKUNcYdZOOGyx8rI= go.etcd.io/etcd/server/v3 v3.5.5 h1:jNjYm/9s+f9A9r6+SC4RvNaz6AqixpOvhrFdT0PvIj0= +go.etcd.io/etcd/server/v3 v3.5.5/go.mod h1:rZ95vDw/jrvsbj9XpTqPrTAB9/kzchVdhRirySPkUBc= go.mongodb.org/mongo-driver v1.0.3/go.mod h1:u7ryQJ+DOzQmeO7zB6MHyr8jkEQvC8vH7qLUO4lqsUM= go.mongodb.org/mongo-driver v1.1.1/go.mod h1:u7ryQJ+DOzQmeO7zB6MHyr8jkEQvC8vH7qLUO4lqsUM= go.mongodb.org/mongo-driver v1.1.2/go.mod h1:u7ryQJ+DOzQmeO7zB6MHyr8jkEQvC8vH7qLUO4lqsUM= @@ -1180,6 +1203,7 @@ go.uber.org/atomic v1.7.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc= go.uber.org/atomic v1.10.0 h1:9qC72Qh0+3MqyJbAn8YU5xVq1frD8bn3JtD2oXtafVQ= go.uber.org/atomic v1.10.0/go.mod h1:LUxbIzbOniOlMKjJjyPfpl4v+PKK2cNJn91OQbhoJI0= go.uber.org/goleak v1.2.0 h1:xqgm/S+aQvhWFTtR0XK3Jvg7z8kGV8P4X14IzwN3Eqk= +go.uber.org/goleak v1.2.0/go.mod h1:XJYK+MuIchqpmGmUSAzotztawfKvYLUIgg7guXrwVUo= go.uber.org/multierr v1.1.0/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/0= go.uber.org/multierr v1.6.0/go.mod h1:cdWPpRnG4AhwMwsgIHip0KRBQjJy5kYEpYjJxpXp9iU= go.uber.org/multierr v1.9.0 h1:7fIwc/ZtS0q++VgcfqFDxSBZVv/Xo49/SYnDFupUwlI= @@ -1227,8 +1251,6 @@ golang.org/x/exp v0.0.0-20191227195350-da58074b4299/go.mod h1:2RIsYlXP63K8oxa1u0 golang.org/x/exp v0.0.0-20200119233911-0405dc783f0a/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= golang.org/x/exp v0.0.0-20200207192155-f17229e696bd/go.mod h1:J/WKrq2StrnmMY6+EHIKF9dgMWnmCNThgcyBT1FY9mM= golang.org/x/exp v0.0.0-20200224162631-6cc2880d07d6/go.mod h1:3jZMyOhIsHpP37uCMkUooju7aAi5cS1Q23tOzKc+0MU= -golang.org/x/exp v0.0.0-20230321023759-10a507213a29 h1:ooxPy7fPvB4kwsA2h+iBNHkAbp/4JxTSwCmvdjEYmug= -golang.org/x/exp v0.0.0-20230321023759-10a507213a29/go.mod h1:CxIveKay+FTh1D0yPZemJVgC/95VzuuOLq5Qi4xnoYc= golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js= golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= diff --git a/hack/update-codegen.sh b/hack/update-codegen.sh index 807dd7638fa..7e1d39095c3 100755 --- a/hack/update-codegen.sh +++ b/hack/update-codegen.sh @@ -18,7 +18,7 @@ set -o errexit set -o pipefail ANTREA_ROOT="$( cd "$( dirname "${BASH_SOURCE[0]}" )/../" && pwd )" -IMAGE_NAME="antrea/codegen:kubernetes-1.26.4" +IMAGE_NAME="antrea/codegen:kubernetes-1.26.4-build.0" # Recent versions of Git will not access .git directories which are owned by # another user (as a security measure), unless the directories are explicitly @@ -30,6 +30,8 @@ IMAGE_NAME="antrea/codegen:kubernetes-1.26.4" # directory to the list of "safe" directories. We are still looking into the # possibility of running the Docker container as the "current host user". function docker_run() { + # Silence CLI suggestions. + export DOCKER_CLI_HINTS=false docker pull ${IMAGE_NAME} set -x ANTREA_PATH="/go/src/antrea.io/antrea" diff --git a/hack/windows/Install-DevTools.ps1 b/hack/windows/Install-DevTools.ps1 index 2f66deabc98..e1fbe0e72a0 100644 --- a/hack/windows/Install-DevTools.ps1 +++ b/hack/windows/Install-DevTools.ps1 @@ -70,7 +70,7 @@ function InstallMingw() { } function InstallGolang() { - $GOLANG_VERSION = "1.19" + $GOLANG_VERSION = "1.21" Write-Host "Installing Golang $GOLANG_VERSION" Write-Host "==============" if (CommandExists("go")) { diff --git a/multicluster/hack/update-codegen.sh b/multicluster/hack/update-codegen.sh index 0127ade2648..4d5140c7a4e 100755 --- a/multicluster/hack/update-codegen.sh +++ b/multicluster/hack/update-codegen.sh @@ -18,7 +18,7 @@ set -o errexit set -o pipefail ANTREA_ROOT="$( cd "$( dirname "${BASH_SOURCE[0]}" )/../../" && pwd )" -IMAGE_NAME="antrea/codegen:kubernetes-1.26.4" +IMAGE_NAME="antrea/codegen:kubernetes-1.26.4-build.0" # Recent versions of Git will not access .git directories which are owned by # another user (as a security measure), unless the directories are explicitly @@ -30,6 +30,8 @@ IMAGE_NAME="antrea/codegen:kubernetes-1.26.4" # directory to the list of "safe" directories. We are still looking into the # possibility of running the Docker container as the "current host user". function docker_run() { + # Silence CLI suggestions. + export DOCKER_CLI_HINTS=false docker pull ${IMAGE_NAME} set -x ANTREA_PATH="/go/src/antrea.io/antrea" diff --git a/multicluster/test/e2e/main_test.go b/multicluster/test/e2e/main_test.go index ca0e791e7e5..c366667ee6b 100644 --- a/multicluster/test/e2e/main_test.go +++ b/multicluster/test/e2e/main_test.go @@ -21,7 +21,6 @@ package e2e import ( "flag" "log" - "math/rand" "os" "path" "testing" @@ -90,7 +89,6 @@ func testMain(m *testing.M) int { if err := testData.initProviders(); err != nil { log.Fatalf("Error when initializing providers for ClusterSet: %v", err) } - rand.Seed(time.Now().UnixNano()) ret := m.Run() if ret != 0 { diff --git a/pkg/agent/openflow/cookie/allocator_test.go b/pkg/agent/openflow/cookie/allocator_test.go index 739839c3216..44edd6faf22 100644 --- a/pkg/agent/openflow/cookie/allocator_test.go +++ b/pkg/agent/openflow/cookie/allocator_test.go @@ -18,7 +18,6 @@ import ( "math/rand" "sync" "testing" - "time" "github.com/stretchr/testify/assert" ) @@ -37,7 +36,6 @@ func TestConcurrentAllocate(t *testing.T) { eachTotal := 10000 concurrentNum := 8 - rand.Seed(time.Now().UnixNano()) // #nosec G404: random number generator not used for security purposes round := rand.Uint64() >> (64 - BitwidthRound) a := NewAllocator(round) diff --git a/pkg/flowaggregator/exporter/log.go b/pkg/flowaggregator/exporter/log.go index a87479ac85f..f7a5fa8eaff 100644 --- a/pkg/flowaggregator/exporter/log.go +++ b/pkg/flowaggregator/exporter/log.go @@ -17,11 +17,11 @@ package exporter import ( "math" "reflect" + "slices" "sync" ipfixentities "github.com/vmware/go-ipfix/pkg/entities" "github.com/vmware/go-ipfix/pkg/registry" - "golang.org/x/exp/slices" "k8s.io/klog/v2" flowaggregatorconfig "antrea.io/antrea/pkg/config/flowaggregator" diff --git a/test/e2e/main_test.go b/test/e2e/main_test.go index 15a02735b44..9caf6ec3a1c 100644 --- a/test/e2e/main_test.go +++ b/test/e2e/main_test.go @@ -18,10 +18,8 @@ import ( "flag" "fmt" "log" - "math/rand" "os" "testing" - "time" ) // setupLogging creates a temporary directory to export the test logs if necessary. If a directory @@ -144,7 +142,6 @@ func testMain(m *testing.M) int { if err != nil { log.Fatalf("Error when getting antrea-config configmap: %v", err) } - rand.Seed(time.Now().UnixNano()) if testOptions.enableCoverage { cleanupCoverage := testOptions.setupCoverage(testData) defer cleanupCoverage() diff --git a/test/e2e/performance_test.go b/test/e2e/performance_test.go index 66121a42a05..db7f525ff9e 100644 --- a/test/e2e/performance_test.go +++ b/test/e2e/performance_test.go @@ -18,12 +18,12 @@ import ( "context" "flag" "fmt" + "math/rand" "net/url" "strings" "testing" "time" - "golang.org/x/exp/rand" corev1 "k8s.io/api/core/v1" networkv1 "k8s.io/api/networking/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -33,7 +33,7 @@ import ( ) const ( - seed uint64 = 0xA1E47 // Use a specific rand seed to make the generated workloads always same + seed = 0xA1E47 // Use a specific rand seed to make the generated workloads always same perfTestAppLabel = "antrea-perf-test" podsConnectionNetworkPolicyName = "pods.ingress" @@ -95,8 +95,11 @@ func BenchmarkCustomizeRealizeNetworkPolicy(b *testing.B) { withPerfTestSetup(func(data *TestData) { networkPolicyRealize(*customizePolicyRules, data, b) }, b) } -func randCidr(rndSrc rand.Source) string { - return fmt.Sprintf("%d.%d.%d.%d/32", rndSrc.Uint64()%255+1, rndSrc.Uint64()%255+1, rndSrc.Uint64()%255+1, rndSrc.Uint64()%255+1) +func randCidr(rnd *rand.Rand) string { + getByte := func() int { + return rnd.Intn(255) + 1 + } + return fmt.Sprintf("%d.%d.%d.%d/32", getByte(), getByte(), getByte(), getByte()) } // createPerfTestPodDefinition creates the Pod specification for the perf test. @@ -148,12 +151,13 @@ func setupTestPodsConnection(data *TestData) error { func generateWorkloadNetworkPolicy(policyRules int) *networkv1.NetworkPolicy { ingressRules := make([]networkv1.NetworkPolicyPeer, policyRules) - rndSrc := rand.NewSource(seed) + // #nosec G404: random number generator not used for security purposes + rnd := rand.New(rand.NewSource(seed)) existingCIDRs := make(map[string]struct{}) // ensure no duplicated cidrs for i := 0; i < policyRules; i++ { - cidr := randCidr(rndSrc) + cidr := randCidr(rnd) for _, ok := existingCIDRs[cidr]; ok; { - cidr = randCidr(rndSrc) + cidr = randCidr(rnd) } existingCIDRs[cidr] = struct{}{} ingressRules[i] = networkv1.NetworkPolicyPeer{IPBlock: &networkv1.IPBlock{CIDR: cidr}} diff --git a/test/integration/agent/net_test.go b/test/integration/agent/net_test.go index 441329da0d0..47c6f36aefd 100644 --- a/test/integration/agent/net_test.go +++ b/test/integration/agent/net_test.go @@ -19,7 +19,6 @@ import ( "math/rand" "net" "testing" - "time" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" @@ -27,10 +26,6 @@ import ( "antrea.io/antrea/pkg/agent/util" ) -func init() { - rand.Seed(time.Now().UTC().UnixNano()) -} - func randName() string { // #nosec G404: random number generator not used for security purposes suffix := rand.Uint32() From e8e86f370b3b3e7bc98d862ba08fd678b9d049b9 Mon Sep 17 00:00:00 2001 From: Antonin Bas Date: Wed, 9 Aug 2023 16:47:46 -0700 Subject: [PATCH 2/6] Use windows-2022 runners for Go Windows unit tests After upgrading to Go v1.21, Go Windows unit tests (which we run with the race detector enabled) cannot be run: go exists immediately with `exit status 0xc0000139`. That may be caused by older mingw-w64 runtime libraries. See https://github.com/golang/go/issues/61058. Signed-off-by: Antonin Bas --- .github/workflows/go.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index 275e4eae7d1..366c76a1e12 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -55,8 +55,8 @@ jobs: test-unit-windows: needs: check-changes if: ${{ needs.check-changes.outputs.has_changes == 'yes' }} - name: Unit test (windows-2019) - runs-on: [windows-2019] + name: Unit test (windows-2022) + runs-on: [windows-2022] steps: - name: Check-out code uses: actions/checkout@v3 From db961bda291d3b4127b063e6964abcf282b9663c Mon Sep 17 00:00:00 2001 From: Antonin Bas Date: Wed, 9 Aug 2023 19:00:04 -0700 Subject: [PATCH 3/6] Fix Dockerfile for integrations tests image The Dockerfile should install the latest patch release for the minor Go version currently supported by Antrea. Signed-off-by: Antonin Bas --- build/images/test/Dockerfile | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/build/images/test/Dockerfile b/build/images/test/Dockerfile index a526968dd8c..4b4ae0899a0 100644 --- a/build/images/test/Dockerfile +++ b/build/images/test/Dockerfile @@ -19,13 +19,14 @@ LABEL maintainer="Antrea " LABEL description="A Docker image for Antrea integration tests." RUN apt-get update && \ - apt-get install -y --no-install-recommends iproute2 iptables ipset make wget gcc libc6-dev ca-certificates git && \ + apt-get install -y --no-install-recommends iproute2 iptables ipset jq make wget gcc libc6-dev ca-certificates git && \ rm -rf /var/cache/apt/* /var/lib/apt/lists/* ARG GO_VERSION ENV GOPATH /go -RUN wget -q -O - https://golang.org/dl/go${GO_VERSION}.linux-amd64.tar.gz | tar xz -C /usr/local/ && \ +RUN GO_ARCHIVE=$(wget -q -O - "https://go.dev/dl/?mode=json&include=all" | jq --arg version_prefix "go${GO_VERSION}." -r '. | map(select(. | .version | startswith($version_prefix))) | first | .files[] | select(.os == "linux" and .arch == "amd64" and .kind == "archive").filename') && \ + wget -q -O - https://go.dev/dl/${GO_ARCHIVE} | tar xz -C /usr/local/ && \ export PATH="/usr/local/go/bin:$PATH" && \ mkdir -p "$GOPATH/src" "$GOPATH/bin" && chmod -R 777 "$GOPATH" From e2f50455e2ae15a933a9b0094ee160f7ae3c645f Mon Sep 17 00:00:00 2001 From: Antonin Bas Date: Thu, 10 Aug 2023 10:35:56 -0700 Subject: [PATCH 4/6] Fix Antctl e2e test cases Signed-off-by: Antonin Bas --- test/e2e/antctl_test.go | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/test/e2e/antctl_test.go b/test/e2e/antctl_test.go index 46d0e8fa470..df2e2148797 100644 --- a/test/e2e/antctl_test.go +++ b/test/e2e/antctl_test.go @@ -145,7 +145,14 @@ func testAntctlAgentLocalAccess(t *testing.T, data *TestData) { cmd := strings.Join(args, " ") t.Run(cmd, func(t *testing.T) { stdout, stderr, err := runAntctl(podName, args, data) - if err != nil && !strings.HasSuffix(stderr, "not enabled\n") { + // After upgrading from Go v1.19 to Go v1.21, stderr will also include the + // following warning in the error case: + // warning: GOCOVERDIR not set, no coverage data emitted + // As a result, we temporarily replace strings.HasSuffix with strings.Contains. + // We can revert this change when the following issue is addressed: + // https://github.com/antrea-io/antrea/issues/4962 + // if err != nil && !strings.HasSuffix(stderr, "not enabled\n") { + if err != nil && !strings.Contains(stderr, "not enabled\n") { t.Fatalf("Error when running `antctl %s` from %s: %v\n%s", c, podName, err, antctlOutput(stdout, stderr)) } }) From da69cb767101c1c6f75bf17a0e3c5a8d0f10a8d7 Mon Sep 17 00:00:00 2001 From: Antonin Bas Date: Thu, 10 Aug 2023 14:41:17 -0700 Subject: [PATCH 5/6] Update metrics doc Additional metrics are available with Go v1.21. Signed-off-by: Antonin Bas --- docs/prometheus-integration.md | 160 ++++++++++++++++++++++++++++++--- 1 file changed, 149 insertions(+), 11 deletions(-) diff --git a/docs/prometheus-integration.md b/docs/prometheus-integration.md index cc0ce58b57f..3283ccb7668 100644 --- a/docs/prometheus-integration.md +++ b/docs/prometheus-integration.md @@ -311,6 +311,63 @@ enabled or not - **go_cgo_go_to_c_calls_calls_total:** Count of calls made from Go to C by the current process. +- **go_cpu_classes_gc_mark_assist_cpu_seconds_total:** Estimated total CPU +time goroutines spent performing GC tasks to assist the GC and prevent it +from falling behind the application. This metric is an overestimate, and +not directly comparable to system CPU time measurements. Compare only with +other /cpu/classes metrics. +- **go_cpu_classes_gc_mark_dedicated_cpu_seconds_total:** Estimated total +CPU time spent performing GC tasks on processors (as defined by GOMAXPROCS) +dedicated to those tasks. This metric is an overestimate, and not directly +comparable to system CPU time measurements. Compare only with other +/cpu/classes metrics. +- **go_cpu_classes_gc_mark_idle_cpu_seconds_total:** Estimated total CPU +time spent performing GC tasks on spare CPU resources that the Go scheduler +could not otherwise find a use for. This should be subtracted from the +total GC CPU time to obtain a measure of compulsory GC CPU time. This +metric is an overestimate, and not directly comparable to system CPU time +measurements. Compare only with other /cpu/classes metrics. +- **go_cpu_classes_gc_pause_cpu_seconds_total:** Estimated total CPU time spent +with the application paused by the GC. Even if only one thread is running +during the pause, this is computed as GOMAXPROCS times the pause latency +because nothing else can be executing. This is the exact sum of samples in +/gc/pause:seconds if each sample is multiplied by GOMAXPROCS at the time +it is taken. This metric is an overestimate, and not directly comparable to +system CPU time measurements. Compare only with other /cpu/classes metrics. +- **go_cpu_classes_gc_total_cpu_seconds_total:** Estimated total CPU +time spent performing GC tasks. This metric is an overestimate, and not +directly comparable to system CPU time measurements. Compare only with other +/cpu/classes metrics. Sum of all metrics in /cpu/classes/gc. +- **go_cpu_classes_idle_cpu_seconds_total:** Estimated total available CPU +time not spent executing any Go or Go runtime code. In other words, the part of +/cpu/classes/total:cpu-seconds that was unused. This metric is an overestimate, +and not directly comparable to system CPU time measurements. Compare only +with other /cpu/classes metrics. +- **go_cpu_classes_scavenge_assist_cpu_seconds_total:** Estimated total CPU +time spent returning unused memory to the underlying platform in response +eagerly in response to memory pressure. This metric is an overestimate, +and not directly comparable to system CPU time measurements. Compare only +with other /cpu/classes metrics. +- **go_cpu_classes_scavenge_background_cpu_seconds_total:** Estimated total +CPU time spent performing background tasks to return unused memory to the +underlying platform. This metric is an overestimate, and not directly +comparable to system CPU time measurements. Compare only with other +/cpu/classes metrics. +- **go_cpu_classes_scavenge_total_cpu_seconds_total:** Estimated total +CPU time spent performing tasks that return unused memory to the underlying +platform. This metric is an overestimate, and not directly comparable to system +CPU time measurements. Compare only with other /cpu/classes metrics. Sum of +all metrics in /cpu/classes/scavenge. +- **go_cpu_classes_total_cpu_seconds_total:** Estimated total available CPU +time for user Go code or the Go runtime, as defined by GOMAXPROCS. In other +words, GOMAXPROCS integrated over the wall-clock duration this process has been +executing for. This metric is an overestimate, and not directly comparable to +system CPU time measurements. Compare only with other /cpu/classes metrics. Sum +of all metrics in /cpu/classes. +- **go_cpu_classes_user_cpu_seconds_total:** Estimated total CPU time spent +running user Go code. This may also include some small amount of time spent +in the Go runtime. This metric is an overestimate, and not directly comparable +to system CPU time measurements. Compare only with other /cpu/classes metrics. - **go_gc_cycles_automatic_gc_cycles_total:** Count of completed GC cycles generated by the Go runtime. - **go_gc_cycles_forced_gc_cycles_total:** Count of completed GC cycles @@ -318,17 +375,25 @@ forced by the application. - **go_gc_cycles_total_gc_cycles_total:** Count of all completed GC cycles. - **go_gc_duration_seconds:** A summary of the pause duration of garbage collection cycles. -- **go_gc_heap_allocs_by_size_bytes:** Distribution of heap allocations by -approximate size. Note that this does not include tiny objects as defined -by /gc/heap/tiny/allocs:objects, only tiny blocks. +- **go_gc_gogc_percent:** Heap size target percentage configured by the +user, otherwise 100. This value is set by the GOGC environment variable, +and the runtime/debug.SetGCPercent function. +- **go_gc_gomemlimit_bytes:** Go runtime memory limit configured by the user, +otherwise math.MaxInt64. This value is set by the GOMEMLIMIT environment +variable, and the runtime/debug.SetMemoryLimit function. +- **go_gc_heap_allocs_by_size_bytes:** Distribution of heap allocations +by approximate size. Bucket counts increase monotonically. Note that this +does not include tiny objects as defined by /gc/heap/tiny/allocs:objects, +only tiny blocks. - **go_gc_heap_allocs_bytes_total:** Cumulative sum of memory allocated to the heap by the application. - **go_gc_heap_allocs_objects_total:** Cumulative count of heap allocations triggered by the application. Note that this does not include tiny objects as defined by /gc/heap/tiny/allocs:objects, only tiny blocks. - **go_gc_heap_frees_by_size_bytes:** Distribution of freed heap allocations -by approximate size. Note that this does not include tiny objects as defined -by /gc/heap/tiny/allocs:objects, only tiny blocks. +by approximate size. Bucket counts increase monotonically. Note that this +does not include tiny objects as defined by /gc/heap/tiny/allocs:objects, +only tiny blocks. - **go_gc_heap_frees_bytes_total:** Cumulative sum of heap memory freed by the garbage collector. - **go_gc_heap_frees_objects_total:** Cumulative count of heap allocations @@ -336,6 +401,8 @@ whose storage was freed by the garbage collector. Note that this does not include tiny objects as defined by /gc/heap/tiny/allocs:objects, only tiny blocks. - **go_gc_heap_goal_bytes:** Heap size target for the end of the GC cycle. +- **go_gc_heap_live_bytes:** Heap memory occupied by live objects that were +marked by the previous GC. - **go_gc_heap_objects_objects:** Number of objects, live or unswept, occupying heap memory. - **go_gc_heap_tiny_allocs_objects_total:** Count of small allocations that @@ -349,9 +416,67 @@ of an out-of-memory error, because the limiter trades memory for CPU time when the GC's CPU time gets too high. This is most likely to occur with use of SetMemoryLimit. The first GC cycle is cycle 1, so a value of 0 indicates that it was never enabled. -- **go_gc_pauses_seconds:** Distribution individual GC-related stop-the-world -pause latencies. +- **go_gc_pauses_seconds:** Distribution of individual GC-related +stop-the-world pause latencies. Bucket counts increase monotonically. +- **go_gc_scan_globals_bytes:** The total amount of global variable space +that is scannable. +- **go_gc_scan_heap_bytes:** The total amount of heap space that is scannable. +- **go_gc_scan_stack_bytes:** The number of bytes of stack that were scanned +last GC cycle. +- **go_gc_scan_total_bytes:** The total amount space that is scannable. Sum +of all metrics in /gc/scan. - **go_gc_stack_starting_size_bytes:** The stack size of new goroutines. +- **go_godebug_non_default_behavior_execerrdot_events_total:** The number of +non-default behaviors executed by the os/exec package due to a non-default +GODEBUG=execerrdot=... setting. +- **go_godebug_non_default_behavior_gocachehash_events_total:** The number +of non-default behaviors executed by the cmd/go package due to a non-default +GODEBUG=gocachehash=... setting. +- **go_godebug_non_default_behavior_gocachetest_events_total:** The number +of non-default behaviors executed by the cmd/go package due to a non-default +GODEBUG=gocachetest=... setting. +- **go_godebug_non_default_behavior_gocacheverify_events_total:** The number +of non-default behaviors executed by the cmd/go package due to a non-default +GODEBUG=gocacheverify=... setting. +- **go_godebug_non_default_behavior_http2client_events_total:** The number of +non-default behaviors executed by the net/http package due to a non-default +GODEBUG=http2client=... setting. +- **go_godebug_non_default_behavior_http2server_events_total:** The number of +non-default behaviors executed by the net/http package due to a non-default +GODEBUG=http2server=... setting. +- **go_godebug_non_default_behavior_installgoroot_events_total:** The number +of non-default behaviors executed by the go/build package due to a non-default +GODEBUG=installgoroot=... setting. +- **go_godebug_non_default_behavior_jstmpllitinterp_events_total:** The +number of non-default behaviors executed by the html/template package due +to a non-default GODEBUG=jstmpllitinterp=... setting. +- **go_godebug_non_default_behavior_multipartmaxheaders_events_total:** +The number of non-default behaviors executed by the mime/multipart package +due to a non-default GODEBUG=multipartmaxheaders=... setting. +- **go_godebug_non_default_behavior_multipartmaxparts_events_total:** The +number of non-default behaviors executed by the mime/multipart package due +to a non-default GODEBUG=multipartmaxparts=... setting. +- **go_godebug_non_default_behavior_multipathtcp_events_total:** The number +of non-default behaviors executed by the net package due to a non-default +GODEBUG=multipathtcp=... setting. +- **go_godebug_non_default_behavior_panicnil_events_total:** The number of +non-default behaviors executed by the runtime package due to a non-default +GODEBUG=panicnil=... setting. +- **go_godebug_non_default_behavior_randautoseed_events_total:** The number of +non-default behaviors executed by the math/rand package due to a non-default +GODEBUG=randautoseed=... setting. +- **go_godebug_non_default_behavior_tarinsecurepath_events_total:** The +number of non-default behaviors executed by the archive/tar package due to +a non-default GODEBUG=tarinsecurepath=... setting. +- **go_godebug_non_default_behavior_x509sha1_events_total:** The number of +non-default behaviors executed by the crypto/x509 package due to a non-default +GODEBUG=x509sha1=... setting. +- **go_godebug_non_default_behavior_x509usefallbackroots_events_total:** +The number of non-default behaviors executed by the crypto/x509 package due +to a non-default GODEBUG=x509usefallbackroots=... setting. +- **go_godebug_non_default_behavior_zipinsecurepath_events_total:** The +number of non-default behaviors executed by the archive/zip package due to +a non-default GODEBUG=zipinsecurepath=... setting. - **go_goroutines:** Number of goroutines that currently exist. - **go_info:** Information about the Go environment. - **go_memory_classes_heap_free_bytes:** Memory that is completely free and @@ -364,8 +489,11 @@ and dead objects that have not yet been marked free by the garbage collector. and has been returned to the underlying system. This metric is the runtime's estimate of free address space that is still mapped into the process, but is not backed by physical memory. -- **go_memory_classes_heap_stacks_bytes:** Memory allocated from the heap -that is reserved for stack space, whether or not it is currently in-use. +- **go_memory_classes_heap_stacks_bytes:** Memory allocated from the +heap that is reserved for stack space, whether or not it is currently +in-use. Currently, this represents all stack memory for goroutines. It also +includes all OS thread stacks in non-cgo programs. Note that stacks may be +allocated differently in the future, and this may change. - **go_memory_classes_heap_unused_bytes:** Memory that is reserved for heap objects but is not currently used to hold heap objects. - **go_memory_classes_metadata_mcache_free_bytes:** Memory that is reserved @@ -379,7 +507,11 @@ by runtime mspan structures that are currently being used. - **go_memory_classes_metadata_other_bytes:** Memory that is reserved for or used to hold runtime metadata. - **go_memory_classes_os_stacks_bytes:** Stack memory allocated by the -underlying operating system. +underlying operating system. In non-cgo programs this metric is currently +zero. This may change in the future.In cgo programs this metric includes OS +thread stacks allocated directly from the OS. Currently, this only accounts +for one stack in c-shared and c-archive build modes, and other sources of +stacks from the OS are not measured. This too may change in the future. - **go_memory_classes_other_bytes:** Memory used by execution trace buffers, structures for debugging the runtime, finalizer and profiler specials, and more. @@ -430,7 +562,13 @@ or the number of operating system threads that can execute user-level Go code simultaneously. - **go_sched_goroutines_goroutines:** Count of live goroutines. - **go_sched_latencies_seconds:** Distribution of the time goroutines have -spent in the scheduler in a runnable state before actually running. +spent in the scheduler in a runnable state before actually running. Bucket +counts increase monotonically. +- **go_sync_mutex_wait_total_seconds_total:** Approximate cumulative time +goroutines have spent blocked on a sync.Mutex or sync.RWMutex. This metric +is useful for identifying global changes in lock contention. Collect a +mutex or block profile using the runtime/pprof package for more detailed +contention data. - **go_threads:** Number of OS threads created. #### Hidden Metrics From 231f5090a98d05aa314e51d292eaf584f1a1a9df Mon Sep 17 00:00:00 2001 From: Antonin Bas Date: Mon, 21 Aug 2023 10:41:46 -0700 Subject: [PATCH 6/6] Increase timeout in e2e test Signed-off-by: Antonin Bas --- test/e2e/antctl_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/e2e/antctl_test.go b/test/e2e/antctl_test.go index df2e2148797..ae7936c0f10 100644 --- a/test/e2e/antctl_test.go +++ b/test/e2e/antctl_test.go @@ -315,7 +315,7 @@ func testAntctlProxy(t *testing.T, data *TestData, antctlServiceAccountName stri require.NoError(t, NewPodBuilder(testPodName, data.testNamespace, toolboxImage).WithContainerName(testContainerName).OnNode(controlPlaneNodeName()).InHostNetwork().Create(data)) defer data.DeletePodAndWait(defaultTimeout, testPodName, data.testNamespace) - require.NoError(t, data.podWaitForRunning(30*time.Second, testPodName, data.testNamespace), "test Pod not in the Running state") + require.NoError(t, data.podWaitForRunning(defaultTimeout, testPodName, data.testNamespace), "test Pod not in the Running state") // getEndpointStatus will return "Success", "Failure", or the empty string when out is not a // marshalled metav1.Status object.