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

Update Go to v1.21 #5377

Merged
merged 6 commits into from
Aug 22, 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
4 changes: 2 additions & 2 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
1 change: 0 additions & 1 deletion build/images/codegen/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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

1 change: 1 addition & 0 deletions build/images/codegen/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 |
Expand Down
2 changes: 1 addition & 1 deletion build/images/deps/go-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.19
1.21
5 changes: 3 additions & 2 deletions build/images/test/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,14 @@ LABEL maintainer="Antrea <[email protected]>"
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"

Expand Down
3 changes: 0 additions & 3 deletions cmd/antctl/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,8 @@
package main

import (
"math/rand"
"os"
"path"
"time"

"github.com/spf13/cobra"

Expand All @@ -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 {
Expand Down
160 changes: 149 additions & 11 deletions docs/prometheus-integration.md
Original file line number Diff line number Diff line change
Expand Up @@ -311,31 +311,98 @@ 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
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
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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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.
Expand Down Expand Up @@ -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
Expand Down
3 changes: 1 addition & 2 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module antrea.io/antrea

go 1.19
go 1.21

require (
antrea.io/libOpenflow v0.12.1
Expand Down Expand Up @@ -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
Expand Down
Loading