Skip to content

Commit

Permalink
Upgrade k8s libraries to v0.29.2
Browse files Browse the repository at this point in the history
1. Upgrade k8s libraries to v0.29.2
2. Upgrade controller-runtime to v0.16.3

Signed-off-by: hjiajing <[email protected]>
  • Loading branch information
hjiajing committed Mar 18, 2024
1 parent bc54253 commit 77a1eb9
Show file tree
Hide file tree
Showing 203 changed files with 2,401 additions and 1,654 deletions.
4 changes: 2 additions & 2 deletions build/images/codegen/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,11 @@ LABEL description="A Docker image based on the golang image, which includes code

ENV GO111MODULE=on

ARG K8S_VERSION=1.26.4
ARG K8S_VERSION=1.29.2
# The k8s.io/kube-openapi repo does not have tag, using a workable commit hash.
# We use the version that is referenced in the Kubernetes go.mod (for the
# correct K8s version).
ARG KUBEOPENAPI_VERSION=v0.0.0-20221012153701-172d655c2280
ARG KUBEOPENAPI_VERSION=v0.0.0-20231010175941-2dd684a91f00

RUN go install k8s.io/code-generator/cmd/client-gen@kubernetes-$K8S_VERSION && \
go install k8s.io/code-generator/cmd/deepcopy-gen@kubernetes-$K8S_VERSION && \
Expand Down
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.29.2 | Upgraded K8s libraries to v1.29.2 |
| kubernetes-1.26.4-build.1 | Replace github.com/golang/mock with go.uber.org/mock |
| kubernetes-1.26.4-build.0 | Upgraded Go to v1.21 |
| kubernetes-1.26.4 | Upgraded K8s libraries to v1.26.4 |
Expand Down
4 changes: 2 additions & 2 deletions cmd/antrea-agent-simulator/simulator.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ func run() error {

// Add loop to check whether client is ready
attempts := 0
if err := wait.PollImmediateUntil(200*time.Millisecond, func() (bool, error) {
if err := wait.PollUntilContextCancel(wait.ContextForChannel(stopCh), 200*time.Millisecond, true, func(ctx context.Context) (bool, error) {
if attempts%10 == 0 {
klog.Info("Waiting for Antrea client to be ready")
}
Expand All @@ -76,7 +76,7 @@ func run() error {
return false, nil
}
return true, nil
}, stopCh); err != nil {
}); err != nil {
klog.Info("Stopped waiting for Antrea client")
return err
}
Expand Down
4 changes: 2 additions & 2 deletions cmd/antrea-agent/agent.go
Original file line number Diff line number Diff line change
Expand Up @@ -778,10 +778,10 @@ func run(o *Options) error {
// Service would fail.
if o.config.AntreaProxy.ProxyAll {
klog.InfoS("Waiting for AntreaProxy to be ready")
if err := wait.PollUntil(time.Second, func() (bool, error) {
if err := wait.PollUntilContextCancel(wait.ContextForChannel(stopCh), time.Second, false, func(ctx context.Context) (bool, error) {
klog.V(2).InfoS("Checking if AntreaProxy is ready")
return proxier.GetProxyProvider().SyncedOnce(), nil
}, stopCh); err != nil {
}); err != nil {
return fmt.Errorf("error when waiting for AntreaProxy to be ready: %v", err)
}
klog.InfoS("AntreaProxy is ready")
Expand Down
8 changes: 4 additions & 4 deletions cmd/antrea-agent/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import (
cliflag "k8s.io/component-base/cli/flag"
"k8s.io/component-base/featuregate"
"k8s.io/klog/v2"
"k8s.io/utils/pointer"
"k8s.io/utils/ptr"

"antrea.io/antrea/pkg/agent/config"
"antrea.io/antrea/pkg/apis"
Expand Down Expand Up @@ -411,10 +411,10 @@ func (o *Options) setK8sNodeDefaultOptions() {
o.config.HostProcPathPrefix = defaultHostProcPathPrefix
}
if o.config.AntreaProxy.Enable == nil {
o.config.AntreaProxy.Enable = pointer.Bool(true)
o.config.AntreaProxy.Enable = ptr.To(true)
}
if o.config.AntreaProxy.ProxyLoadBalancerIPs == nil {
o.config.AntreaProxy.ProxyLoadBalancerIPs = pointer.Bool(true)
o.config.AntreaProxy.ProxyLoadBalancerIPs = ptr.To(true)
}
if o.config.ServiceCIDR == "" {
//It's okay to set the default value of this field even when AntreaProxy is enabled and the field is not used.
Expand All @@ -427,7 +427,7 @@ func (o *Options) setK8sNodeDefaultOptions() {
o.config.ClusterMembershipPort = apis.AntreaAgentClusterMembershipPort
}
if o.config.EnablePrometheusMetrics == nil {
o.config.EnablePrometheusMetrics = pointer.Bool(true)
o.config.EnablePrometheusMetrics = ptr.To(true)
}
if o.config.WireGuard.Port == 0 {
o.config.WireGuard.Port = apis.WireGuardListenPort
Expand Down
12 changes: 6 additions & 6 deletions cmd/antrea-agent/options_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import (
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
featuregatetesting "k8s.io/component-base/featuregate/testing"
"k8s.io/utils/pointer"
"k8s.io/utils/ptr"

"antrea.io/antrea/pkg/agent/config"
agentconfig "antrea.io/antrea/pkg/config/agent"
Expand Down Expand Up @@ -93,7 +93,7 @@ func TestOptionsValidateAntreaProxyConfig(t *testing.T) {
name: "default",
trafficEncapMode: config.TrafficEncapModeEncap,
antreaProxyConfig: agentconfig.AntreaProxyConfig{
Enable: pointer.Bool(true),
Enable: ptr.To(true),
DefaultLoadBalancerMode: config.LoadBalancerModeNAT.String(),
},
expectedDefaultLoadBalancerMode: config.LoadBalancerModeNAT,
Expand All @@ -103,15 +103,15 @@ func TestOptionsValidateAntreaProxyConfig(t *testing.T) {
enabledDSR: true,
trafficEncapMode: config.TrafficEncapModeEncap,
antreaProxyConfig: agentconfig.AntreaProxyConfig{
Enable: pointer.Bool(true),
Enable: ptr.To(true),
DefaultLoadBalancerMode: config.LoadBalancerModeDSR.String(),
},
expectedDefaultLoadBalancerMode: config.LoadBalancerModeDSR,
},
{
name: "LoadBalancerModeDSR disabled",
antreaProxyConfig: agentconfig.AntreaProxyConfig{
Enable: pointer.Bool(true),
Enable: ptr.To(true),
DefaultLoadBalancerMode: config.LoadBalancerModeDSR.String(),
},
trafficEncapMode: config.TrafficEncapModeEncap,
Expand All @@ -121,7 +121,7 @@ func TestOptionsValidateAntreaProxyConfig(t *testing.T) {
name: "unsupported encap mode",
enabledDSR: true,
antreaProxyConfig: agentconfig.AntreaProxyConfig{
Enable: pointer.Bool(true),
Enable: ptr.To(true),
DefaultLoadBalancerMode: config.LoadBalancerModeDSR.String(),
},
trafficEncapMode: config.TrafficEncapModeNoEncap,
Expand All @@ -131,7 +131,7 @@ func TestOptionsValidateAntreaProxyConfig(t *testing.T) {
name: "invalid LoadBalancerMode",
trafficEncapMode: config.TrafficEncapModeEncap,
antreaProxyConfig: agentconfig.AntreaProxyConfig{
Enable: pointer.Bool(true),
Enable: ptr.To(true),
DefaultLoadBalancerMode: "drs",
},
expectedErr: "LoadBalancerMode drs is unknown",
Expand Down
3 changes: 3 additions & 0 deletions cmd/antrea-controller/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -542,6 +542,9 @@ func createAPIServerConfig(kubeconfig string,
serverConfig.OpenAPIConfig = genericapiserver.DefaultOpenAPIConfig(
openapi.GetOpenAPIDefinitions,
genericopenapi.NewDefinitionNamer(apiserver.Scheme))
serverConfig.OpenAPIV3Config = genericapiserver.DefaultOpenAPIV3Config(
openapi.GetOpenAPIDefinitions,
genericopenapi.NewDefinitionNamer(apiserver.Scheme))
serverConfig.OpenAPIConfig.Info.Title = "Antrea"
serverConfig.EnableMetrics = enableMetrics
serverConfig.MinRequestTimeout = int(serverMinWatchTimeout.Seconds())
Expand Down
36 changes: 27 additions & 9 deletions docs/prometheus-integration.md
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,11 @@ updates received by AntreaProxy

### Common Metrics Provided by Infrastructure

#### Aggregator Metrics

- **aggregator_discovery_aggregation_count_total:** Counter of number of
times discovery was aggregated

#### Apiserver Metrics

- **apiserver_audit_event_total:** Counter of audit events generated and
Expand Down Expand Up @@ -253,11 +258,13 @@ scope and component.
- **apiserver_request_filter_duration_seconds:** Request filter latency
distribution in seconds, for each filter type
- **apiserver_request_sli_duration_seconds:** Response latency distribution
(not counting webhook duration) in seconds for each verb, group, version,
resource, subresource, scope and component.
(not counting webhook duration and priority & fairness queue wait times)
in seconds for each verb, group, version, resource, subresource, scope
and component.
- **apiserver_request_slo_duration_seconds:** Response latency distribution
(not counting webhook duration) in seconds for each verb, group, version,
resource, subresource, scope and component.
(not counting webhook duration and priority & fairness queue wait times)
in seconds for each verb, group, version, resource, subresource, scope
and component.
- **apiserver_request_total:** Counter of apiserver requests broken out
for each verb, dry run value, group, version, resource, scope, component,
and HTTP response code.
Expand Down Expand Up @@ -297,15 +304,26 @@ broken out by result.
- **authentication_token_cache_request_duration_seconds:**
- **authentication_token_cache_request_total:**

#### Authorization Metrics

- **authorization_attempts_total:** Counter of authorization attempts broken
down by result. It can be either 'allowed', 'denied', 'no-opinion' or 'error'.
- **authorization_duration_seconds:** Authorization duration in seconds
broken out by result.

#### Cardinality Metrics

- **cardinality_enforcement_unexpected_categorizations_total:** The count
of unexpected categorizations during cardinality enforcement.

#### Disabled Metrics

- **disabled_metric_total:** The count of disabled metrics.
- **disabled_metrics_total:** The count of disabled metrics.

#### Field Metrics

- **field_validation_request_duration_seconds:** Response latency distribution
in seconds for each field validation value and whether field validation is
enabled or not
in seconds for each field validation value

#### Go Metrics

Expand Down Expand Up @@ -576,7 +594,7 @@ contention data.

#### Hidden Metrics

- **hidden_metric_total:** The count of hidden metrics.
- **hidden_metrics_total:** The count of hidden metrics.

#### Process Metrics

Expand All @@ -593,7 +611,7 @@ available in bytes.

#### Registered Metrics

- **registered_metric_total:** The count of registered metrics broken by
- **registered_metrics_total:** The count of registered metrics broken by
stability level and deprecation version.

#### Workqueue Metrics
Expand Down
101 changes: 51 additions & 50 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -67,19 +67,19 @@ require (
gopkg.in/natefinch/lumberjack.v2 v2.2.1
gopkg.in/yaml.v2 v2.4.0
gopkg.in/yaml.v3 v3.0.1
k8s.io/api v0.26.4
k8s.io/apiextensions-apiserver v0.26.4
k8s.io/apimachinery v0.26.4
k8s.io/apiserver v0.26.4
k8s.io/client-go v0.26.4
k8s.io/component-base v0.26.4
k8s.io/klog/v2 v2.100.1
k8s.io/kube-aggregator v0.26.4
k8s.io/kube-openapi v0.0.0-20221012153701-172d655c2280
k8s.io/kubectl v0.26.4
k8s.io/kubelet v0.26.4
k8s.io/utils v0.0.0-20230209194617-a36077c30491
sigs.k8s.io/controller-runtime v0.14.6
k8s.io/api v0.29.2
k8s.io/apiextensions-apiserver v0.29.2
k8s.io/apimachinery v0.29.2
k8s.io/apiserver v0.29.2
k8s.io/client-go v0.29.2
k8s.io/component-base v0.29.2
k8s.io/klog/v2 v2.110.1
k8s.io/kube-aggregator v0.29.2
k8s.io/kube-openapi v0.0.0-20231010175941-2dd684a91f00
k8s.io/kubectl v0.29.2
k8s.io/kubelet v0.29.2
k8s.io/utils v0.0.0-20230726121419-3b25d923346b
sigs.k8s.io/controller-runtime v0.16.3
sigs.k8s.io/mcs-api v0.1.0
sigs.k8s.io/network-policy-api v0.1.1
sigs.k8s.io/yaml v1.3.0
Expand All @@ -93,8 +93,9 @@ require (
github.com/VividCortex/ewma v1.2.0 // indirect
github.com/alexflint/go-filemutex v1.2.0 // indirect
github.com/andybalholm/brotli v1.0.4 // indirect
github.com/antlr/antlr4/runtime/Go/antlr v1.4.10 // indirect
github.com/antlr/antlr4/runtime/Go/antlr/v4 v4.0.0-20230305170008-8188dc5388df // indirect
github.com/armon/go-metrics v0.0.0-20180917152333-f0300d1749da // indirect
github.com/asaskevich/govalidator v0.0.0-20190424111038-f61b66f89f4a // indirect
github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.4.4 // indirect
github.com/aws/aws-sdk-go-v2/credentials v1.12.12 // indirect
github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.12.11 // indirect
Expand All @@ -120,31 +121,31 @@ require (
github.com/containerd/cgroups v1.1.0 // indirect
github.com/containerd/containerd v1.6.26 // indirect
github.com/contiv/libovsdb v0.0.0-20170227191248-d0061a53e358 // indirect
github.com/coreos/go-semver v0.3.0 // indirect
github.com/coreos/go-systemd/v22 v22.3.2 // indirect
github.com/elazarl/goproxy v0.0.0-20190911111923-ecfe977594f1 // indirect
github.com/emicklei/go-restful/v3 v3.10.1 // indirect
github.com/evanphx/json-patch v4.12.0+incompatible // indirect
github.com/coreos/go-semver v0.3.1 // indirect
github.com/coreos/go-systemd/v22 v22.5.0 // indirect
github.com/emicklei/go-restful/v3 v3.11.0 // indirect
github.com/evanphx/json-patch v5.6.0+incompatible // indirect
github.com/evanphx/json-patch/v5 v5.6.0 // indirect
github.com/exponent-io/jsonpath v0.0.0-20151013193312-d6023ce2651d // indirect
github.com/fatih/color v1.15.0 // indirect
github.com/felixge/httpsnoop v1.0.4 // indirect
github.com/fvbommel/sortorder v1.0.1 // indirect
github.com/go-errors/errors v1.0.1 // indirect
github.com/felixge/httpsnoop v1.0.3 // indirect
github.com/fvbommel/sortorder v1.1.0 // indirect
github.com/go-errors/errors v1.4.2 // indirect
github.com/go-faster/city v1.0.1 // indirect
github.com/go-faster/errors v0.6.1 // indirect
github.com/go-logr/stdr v1.2.2 // indirect
github.com/go-openapi/jsonpointer v0.19.6 // indirect
github.com/go-openapi/jsonreference v0.20.1 // indirect
github.com/go-openapi/jsonreference v0.20.2 // indirect
github.com/go-openapi/swag v0.22.3 // indirect
github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572 // indirect
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
github.com/google/cel-go v0.12.6 // indirect
github.com/google/gnostic v0.5.7-v3refs // indirect
github.com/google/cel-go v0.17.7 // indirect
github.com/google/gnostic-models v0.6.8 // indirect
github.com/google/go-cmp v0.6.0 // indirect
github.com/google/gofuzz v1.2.0 // indirect
github.com/google/pprof v0.0.0-20210720184732-4bb14d4b1be1 // indirect
github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510 // indirect
github.com/gorilla/websocket v1.5.0 // indirect
github.com/gregjones/httpcache v0.0.0-20180305231024-9cad4c3443a7 // indirect
github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0 // indirect
github.com/grpc-ecosystem/grpc-gateway/v2 v2.16.0 // indirect
Expand All @@ -170,9 +171,9 @@ require (
github.com/mdlayher/genetlink v1.0.0 // indirect
github.com/mdlayher/netlink v1.7.2 // indirect
github.com/mdlayher/socket v0.4.1 // indirect
github.com/mitchellh/go-wordwrap v1.0.0 // indirect
github.com/mitchellh/go-wordwrap v1.0.1 // indirect
github.com/moby/spdystream v0.2.0 // indirect
github.com/moby/term v0.0.0-20220808134915-39b0c02b01ae // indirect
github.com/moby/term v0.0.0-20221205130635-1aeaba878587 // indirect
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.2 // indirect
github.com/monochromegane/go-gitignore v0.0.0-20200626010858-205db1a8cc00 // indirect
Expand All @@ -198,40 +199,40 @@ require (
github.com/stoewer/go-strcase v1.2.0 // indirect
github.com/ti-mo/netfilter v0.5.0 // indirect
github.com/vishvananda/netns v0.0.4 // indirect
github.com/xlab/treeprint v1.1.0 // indirect
github.com/xlab/treeprint v1.2.0 // indirect
gitlab.com/golang-commonmark/puny v0.0.0-20191124015043-9f83538fa04f // indirect
go.etcd.io/etcd/api/v3 v3.5.5 // indirect
go.etcd.io/etcd/client/pkg/v3 v3.5.5 // indirect
go.etcd.io/etcd/client/v3 v3.5.5 // indirect
go.etcd.io/etcd/api/v3 v3.5.10 // indirect
go.etcd.io/etcd/client/pkg/v3 v3.5.10 // indirect
go.etcd.io/etcd/client/v3 v3.5.10 // indirect
go.opencensus.io v0.24.0 // indirect
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.46.0 // indirect
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.46.0 // indirect
go.opentelemetry.io/otel v1.20.0 // indirect
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.20.0 // indirect
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.20.0 // indirect
go.opentelemetry.io/otel/metric v1.20.0 // indirect
go.opentelemetry.io/otel/sdk v1.20.0 // indirect
go.opentelemetry.io/otel/trace v1.20.0 // indirect
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.42.0 // indirect
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.44.0 // indirect
go.opentelemetry.io/otel v1.19.0 // indirect
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.19.0 // indirect
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.19.0 // indirect
go.opentelemetry.io/otel/metric v1.19.0 // indirect
go.opentelemetry.io/otel/sdk v1.19.0 // indirect
go.opentelemetry.io/otel/trace v1.19.0 // indirect
go.opentelemetry.io/proto/otlp v1.0.0 // indirect
go.starlark.net v0.0.0-20200306205701-8dd3e2ee1dd5 // indirect
go.uber.org/atomic v1.10.0 // indirect
go.uber.org/multierr v1.9.0 // indirect
go.uber.org/zap v1.24.0 // indirect
go.starlark.net v0.0.0-20230525235612-a134d8f9ddca // indirect
go.uber.org/multierr v1.11.0 // indirect
go.uber.org/zap v1.25.0 // indirect
golang.org/x/exp v0.0.0-20220722155223-a9213eeb770e // indirect
golang.org/x/oauth2 v0.16.0 // indirect
golang.org/x/term v0.18.0 // indirect
golang.org/x/text v0.14.0 // indirect
golang.zx2c4.com/wireguard v0.0.0-20210427022245-097af6e1351b // indirect
gomodules.xyz/jsonpatch/v2 v2.2.0 // indirect
gomodules.xyz/jsonpatch/v2 v2.4.0 // indirect
google.golang.org/appengine v1.6.8 // indirect
google.golang.org/genproto v0.0.0-20240123012728-ef4313101c80 // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20240123012728-ef4313101c80 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20240123012728-ef4313101c80 // indirect
gopkg.in/inf.v0 v0.9.1 // indirect
k8s.io/cli-runtime v0.26.4 // indirect
k8s.io/kms v0.26.4 // indirect
sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.0.36 // indirect
k8s.io/cli-runtime v0.29.2 // indirect
k8s.io/kms v0.29.2 // indirect
sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.28.0 // indirect
sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd // indirect
sigs.k8s.io/kustomize/api v0.12.1 // indirect
sigs.k8s.io/kustomize/kyaml v0.13.9 // indirect
sigs.k8s.io/structured-merge-diff/v4 v4.2.3 // indirect
sigs.k8s.io/kustomize/api v0.13.5-0.20230601165947-6ce0bf390ce3 // indirect
sigs.k8s.io/kustomize/kyaml v0.14.3-0.20230601165947-6ce0bf390ce3 // indirect
sigs.k8s.io/structured-merge-diff/v4 v4.4.1 // indirect
)
Loading

0 comments on commit 77a1eb9

Please sign in to comment.