Skip to content

Commit

Permalink
Update k8s library and klog (#1973)
Browse files Browse the repository at this point in the history
K8s library v0.21.0 merged @tnqn's commit to fix the performance issue
of fake.NewSimpleClientset. With this update we can remove the import
redirection for k8s.io/client-go. The new library also contains fixes
for the timeout issue of aggregated apiservers.

Fixes #1837

Signed-off-by: Xu Liu <[email protected]>
  • Loading branch information
xliuxu committed May 11, 2021
1 parent 03fe6ee commit ce7c844
Show file tree
Hide file tree
Showing 162 changed files with 2,491 additions and 1,106 deletions.
4 changes: 2 additions & 2 deletions build/images/codegen/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ LABEL description="A Docker image based on golang 1.15 which includes codegen to

ENV GO111MODULE=on

ARG K8S_VERSION=1.18.4
ARG K8S_VERSION=1.21.0
# The k8s.io/kube-openapi repo does not have tag, using a workable commit hash.
ARG KUBEOPENAPI_VERSION=v0.0.0-20200410145947-61e04a5be9a6
ARG KUBEOPENAPI_VERSION=v0.0.0-20210305164622-f622666832c1

RUN go get k8s.io/code-generator/cmd/client-gen@kubernetes-$K8S_VERSION && \
go get k8s.io/code-generator/cmd/deepcopy-gen@kubernetes-$K8S_VERSION && \
Expand Down
2 changes: 1 addition & 1 deletion ci/clair-scan/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
package main

import (
"k8s.io/klog"
"k8s.io/klog/v2"

"encoding/json"
"flag"
Expand Down
2 changes: 1 addition & 1 deletion ci/clair-scan/notify.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import (
"github.com/aws/aws-sdk-go/aws/session"
"github.com/aws/aws-sdk-go/service/ses"
"gopkg.in/gomail.v2"
"k8s.io/klog"
"k8s.io/klog/v2"
)

const (
Expand Down
2 changes: 1 addition & 1 deletion cmd/antrea-agent-simulator/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import (

"github.com/spf13/cobra"
"k8s.io/component-base/logs"
"k8s.io/klog"
"k8s.io/klog/v2"

"github.com/vmware-tanzu/antrea/pkg/log"
"github.com/vmware-tanzu/antrea/pkg/version"
Expand Down
2 changes: 1 addition & 1 deletion cmd/antrea-agent-simulator/simulator.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import (
"k8s.io/apimachinery/pkg/util/wait"
"k8s.io/apimachinery/pkg/watch"
componentbaseconfig "k8s.io/component-base/config"
"k8s.io/klog"
"k8s.io/klog/v2"

"github.com/vmware-tanzu/antrea/pkg/agent"
"github.com/vmware-tanzu/antrea/pkg/k8s"
Expand Down
2 changes: 1 addition & 1 deletion cmd/antrea-agent/agent.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import (
"time"

"k8s.io/client-go/informers"
"k8s.io/klog"
"k8s.io/klog/v2"

"github.com/vmware-tanzu/antrea/pkg/agent"
"github.com/vmware-tanzu/antrea/pkg/agent/apiserver"
Expand Down
2 changes: 1 addition & 1 deletion cmd/antrea-agent/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import (

"github.com/spf13/cobra"
"k8s.io/component-base/logs"
"k8s.io/klog"
"k8s.io/klog/v2"

"github.com/vmware-tanzu/antrea/pkg/log"
"github.com/vmware-tanzu/antrea/pkg/version"
Expand Down
2 changes: 1 addition & 1 deletion cmd/antrea-agent/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import (

"github.com/spf13/pflag"
"gopkg.in/yaml.v2"
"k8s.io/klog"
"k8s.io/klog/v2"

"github.com/vmware-tanzu/antrea/pkg/agent/config"
"github.com/vmware-tanzu/antrea/pkg/apis"
Expand Down
2 changes: 1 addition & 1 deletion cmd/antrea-agent/options_windows.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import (
"strings"

"k8s.io/component-base/featuregate"
"k8s.io/klog"
"k8s.io/klog/v2"

"github.com/vmware-tanzu/antrea/pkg/agent/config"
"github.com/vmware-tanzu/antrea/pkg/features"
Expand Down
2 changes: 1 addition & 1 deletion cmd/antrea-controller/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import (
genericoptions "k8s.io/apiserver/pkg/server/options"
"k8s.io/client-go/informers"
clientset "k8s.io/client-go/kubernetes"
"k8s.io/klog"
"k8s.io/klog/v2"
aggregatorclientset "k8s.io/kube-aggregator/pkg/client/clientset_generated/clientset"

"github.com/vmware-tanzu/antrea/pkg/apiserver"
Expand Down
2 changes: 1 addition & 1 deletion cmd/antrea-controller/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import (

"github.com/spf13/cobra"
"k8s.io/component-base/logs"
"k8s.io/klog"
"k8s.io/klog/v2"

"github.com/vmware-tanzu/antrea/pkg/log"
"github.com/vmware-tanzu/antrea/pkg/version"
Expand Down
2 changes: 1 addition & 1 deletion cmd/flow-aggregator/flow-aggregator.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import (
"k8s.io/apimachinery/pkg/util/wait"
"k8s.io/client-go/kubernetes"
"k8s.io/client-go/rest"
"k8s.io/klog"
"k8s.io/klog/v2"

"github.com/vmware-tanzu/antrea/pkg/clusteridentity"
aggregator "github.com/vmware-tanzu/antrea/pkg/flowaggregator"
Expand Down
2 changes: 1 addition & 1 deletion cmd/flow-aggregator/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import (

"github.com/spf13/cobra"
"k8s.io/component-base/logs"
"k8s.io/klog"
"k8s.io/klog/v2"

"github.com/vmware-tanzu/antrea/pkg/log"
"github.com/vmware-tanzu/antrea/pkg/version"
Expand Down
29 changes: 27 additions & 2 deletions docs/prometheus-integration.md
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,10 @@ remaining lifetime on the certificate used to authenticate a request.
inflight request limit of this apiserver per request kind in last second.
- **apiserver_envelope_encryption_dek_cache_fill_percent:** Percent of the
cache slots currently occupied by cached DEKs.
- **apiserver_flowcontrol_read_vs_write_request_count_samples:** Periodic
observations of the number of requests
- **apiserver_flowcontrol_read_vs_write_request_count_watermarks:** Watermarks
of the number of requests
- **apiserver_longrunning_gauge:** Gauge of all active long-running apiserver
requests broken out by verb, group, version, resource, scope and component. Not
all requests are tracked this way.
Expand All @@ -230,9 +234,11 @@ for a given resources
- **apiserver_request_duration_seconds:** Response latency distribution in
seconds for each verb, dry run value, group, version, resource, subresource,
scope and component.
- **apiserver_request_filter_duration_seconds:** Request filter latency
distribution in seconds, for each filter type
- **apiserver_request_total:** Counter of apiserver requests broken out
for each verb, dry run value, group, version, resource, scope, component,
and HTTP response contentType and code.
and HTTP response code.
- **apiserver_response_sizes:** Response size distribution in bytes for each
group, version, verb, resource, subresource, scope and component.
- **apiserver_storage_data_key_generation_duration_seconds:** Latencies in
Expand All @@ -241,6 +247,8 @@ seconds of data encryption key(DEK) generation operations.
failed data encryption key(DEK) generation operations.
- **apiserver_storage_envelope_transformation_cache_misses_total:** Total
number of cache misses while accessing key decryption key(KEK).
- **apiserver_tls_handshake_errors_total:** Number of requests dropped with
'TLS handshake error from' error
- **apiserver_watch_events_sizes:** Watch event size distribution in bytes
- **apiserver_watch_events_total:** Number of events sent in watch clients

Expand All @@ -261,7 +269,8 @@ broken out by result.

#### Go Metrics

- **go_gc_duration_seconds:** A summary of the GC invocation durations.
- **go_gc_duration_seconds:** A summary of the pause duration of garbage
collection cycles.
- **go_goroutines:** Number of goroutines that currently exist.
- **go_info:** Information about the Go environment.
- **go_memstats_alloc_bytes:** Number of bytes allocated and still in use.
Expand Down Expand Up @@ -316,3 +325,19 @@ in seconds.
- **process_virtual_memory_bytes:** Virtual memory size in bytes.
- **process_virtual_memory_max_bytes:** Maximum amount of virtual memory
available in bytes.

#### Workqueue Metrics

- **workqueue_adds_total:** Total number of adds handled by workqueue
- **workqueue_depth:** Current depth of workqueue
- **workqueue_longest_running_processor_seconds:** How many seconds has the
longest running processor for workqueue been running.
- **workqueue_queue_duration_seconds:** How long in seconds an item stays
in workqueue before being requested.
- **workqueue_retries_total:** Total number of retries handled by workqueue
- **workqueue_unfinished_work_seconds:** How many seconds of work has
done that is in progress and hasn't been observed by work_duration. Large
values indicate stuck threads. One can deduce the number of stuck threads
by observing the rate at which this increases.
- **workqueue_work_duration_seconds:** How long in seconds processing an
item from workqueue takes.
66 changes: 29 additions & 37 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ require (
github.com/TomCodeLV/OVSDB-golang-lib v0.0.0-20200116135253-9bbdfadcd881
github.com/antoninbas/go-powershell v0.1.0
github.com/awalterschulze/gographviz v2.0.1+incompatible
github.com/blang/semver v3.5.0+incompatible
github.com/blang/semver v3.5.1+incompatible
github.com/cenk/hub v1.0.1 // indirect
github.com/cenkalti/hub v1.0.1 // indirect
github.com/cenkalti/rpc2 v0.0.0-20180727162946-9642ea02d0aa // indirect
Expand All @@ -21,48 +21,47 @@ require (
github.com/contiv/ofnet v0.0.0-00010101000000-000000000000
github.com/coreos/go-iptables v0.4.5
github.com/elazarl/goproxy v0.0.0-20190911111923-ecfe977594f1 // indirect
github.com/evanphx/json-patch v4.5.0+incompatible // indirect
github.com/go-openapi/spec v0.19.3
github.com/gogo/protobuf v1.3.1
github.com/golang/mock v1.4.4
github.com/golang/protobuf v1.3.2
github.com/google/uuid v1.1.1
github.com/go-openapi/spec v0.19.5
github.com/gogo/protobuf v1.3.2
github.com/golang/mock v1.5.0
github.com/golang/protobuf v1.4.3
github.com/google/uuid v1.1.2
github.com/kevinburke/ssh_config v0.0.0-20190725054713-01f96b0aa0cd
github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e // indirect
github.com/pkg/errors v0.9.1
github.com/prometheus/common v0.4.1
github.com/prometheus/client_golang v1.7.1
github.com/prometheus/common v0.10.0
github.com/rakelkar/gonetsh v0.0.0-20210226024844-dfffed138500
github.com/satori/go.uuid v1.2.0
github.com/sirupsen/logrus v1.4.2
github.com/sirupsen/logrus v1.7.0
github.com/spf13/afero v1.4.1
github.com/spf13/cobra v0.0.5
github.com/spf13/cobra v1.1.1
github.com/spf13/pflag v1.0.5
github.com/streamrail/concurrent-map v0.0.0-20160823150647-8bf1e9bacbf6 // indirect
github.com/stretchr/testify v1.6.1
github.com/ti-mo/conntrack v0.3.0
github.com/vishvananda/netlink v1.1.0
github.com/vmware/go-ipfix v0.4.7
golang.org/x/crypto v0.0.0-20200820211705-5c72a883971a
golang.org/x/exp v0.0.0-20190312203227-4b39c73a6495
github.com/vmware/go-ipfix v0.4.8
golang.org/x/crypto v0.0.0-20210220033148-5ea612d1eb83
golang.org/x/exp v0.0.0-20200224162631-6cc2880d07d6
golang.org/x/mod v0.4.0
golang.org/x/net v0.0.0-20200904194848-62affa334b73
golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e
golang.org/x/sys v0.0.0-20201201145000-ef89a241ccb3
golang.org/x/time v0.0.0-20190308202827-9d24e82272b4
google.golang.org/grpc v1.26.0
golang.org/x/net v0.0.0-20210224082022-3d97a244fca7
golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9
golang.org/x/sys v0.0.0-20210225134936-a50acf3fe073
golang.org/x/time v0.0.0-20210220033141-f8bda1e9f3ba
google.golang.org/grpc v1.27.1
gopkg.in/check.v1 v1.0.0-20200902074654-038fdea0a05b // indirect
gopkg.in/natefinch/lumberjack.v2 v2.0.0
gopkg.in/yaml.v2 v2.3.0
k8s.io/api v0.18.4
k8s.io/apimachinery v0.18.4
k8s.io/apiserver v0.18.4
k8s.io/client-go v0.18.4
k8s.io/component-base v0.18.4
k8s.io/klog v1.0.0
k8s.io/kube-aggregator v0.18.4
k8s.io/kube-openapi v0.0.0-20200410145947-61e04a5be9a6
k8s.io/kubectl v0.18.4
k8s.io/utils v0.0.0-20200410111917-5770800c2500
gopkg.in/yaml.v2 v2.4.0
k8s.io/api v0.21.0
k8s.io/apimachinery v0.21.0
k8s.io/apiserver v0.21.0
k8s.io/client-go v0.21.0
k8s.io/component-base v0.21.0
k8s.io/klog/v2 v2.8.0
k8s.io/kube-aggregator v0.21.0
k8s.io/kube-openapi v0.0.0-20210305164622-f622666832c1
k8s.io/kubectl v0.21.0
k8s.io/utils v0.0.0-20210305010621-2afb4311ab10
)

replace (
Expand All @@ -72,11 +71,4 @@ replace (
// antrea/plugins/octant/go.mod also has this replacement since replace statement in dependencies
// were ignored. We need to change antrea/plugins/octant/go.mod if there is any change here.
github.com/contiv/ofnet => github.com/wenyingd/ofnet v0.0.0-20210318032909-171b6795a2da
// fake.NewSimpleClientset is quite slow when it's initialized with massive objects due to
// https://github.com/kubernetes/kubernetes/issues/89574. It takes more than tens of minutes to
// init a fake client with 200k objects, which makes it hard to run the NetworkPolicy scale test.
// There is an optimization https://github.com/kubernetes/kubernetes/pull/89575 but will only be
// available from 1.19.0 and later releases. Use this commit before Antrea bumps up its K8s
// dependency version.
k8s.io/client-go => github.com/tnqn/client-go v0.18.4-1
)
Loading

0 comments on commit ce7c844

Please sign in to comment.