Commit Graph

4702 Commits

Author SHA1 Message Date
Kubernetes Publisher
f2030849e1 Merge pull request #129330 from pohly/log-client-go-transport
client-go/transport: structured, contextual logging

Kubernetes-commit: e07aeb7c8b52a486518f2f55ea58595ae007f3b0
2025-01-27 20:23:51 +00:00
Kubernetes Publisher
ce24f3c462 Merge pull request #129815 from dims/linter-to-ensure-go-cmp/cmp-is-used-only-in-tests
Linter to ensure go-cmp/cmp is used ONLY in tests

Kubernetes-commit: d36322f8d76c8e2a456e381bcc6bb43e4bbe602c
2025-01-26 00:23:39 +00:00
Davanum Srinivas
de67e026ad Linter to ensure go-cmp/cmp is used ONLY in tests
Signed-off-by: Davanum Srinivas <davanum@gmail.com>

Kubernetes-commit: 4e05bc20db99ff89b2d2205218d24b9935a7fdd7
2025-01-24 17:03:29 -05:00
Kubernetes Publisher
97f3d2697c Merge pull request #128546 from atiratree/pod-replacement-policy-terminating-pods
add PodReplacementPolicy for Deployments: terminating pods

Kubernetes-commit: 5aeea45357176e7224f908329fb7958d88a7eeac
2025-01-24 04:23:58 +00:00
Patrick Ohly
82fcce0646 client-go/transport: structured, contextual logging
The revised logging emits one log entry at the start of
round-tripping ("Request") and another at the end ("Response"). This avoids the
risk that related output gets interleaved by other output.

No API changes are necessary. A contextual logger is picked up from the context
of the request that is being handled. The verbosity level of that logger is
checked to determine what is supposed to be logged. This enables reducing log
details on a by-request basis by storing a `logger.V(1)` in the context of the
request.

As before, logging only gets injected into request processing at -v6 or higher,
so normally there is no additional overhead.

Kubernetes-commit: a85f489b28d3b0ef82dffb267b6145c73c2d0e33
2024-12-04 15:09:37 +01:00
Filip Křepinský
df7621a0b4 update generated files and feature gates
Kubernetes-commit: 28437797b525b17a5a20b8e6c7daf30046a3864c
2024-11-04 19:52:30 +01:00
Tiago Silva
9f1cce41d5 client-go: transform watchErrorStream to wrap the underlying error (#129765)
* `client-go`: transform `watchErrorStream` to wrap the underlying error

This PR transforms the `client-go`'s `watchErrorStream` to wrap the error instead of transforming it into a single string. This enables clients to use `errors.Is/As/Unwrap` with the errors that come out of `StreamWithContext`

Fixes https://github.com/kubernetes/kubernetes/issues/129763

* adjust unit tests

Kubernetes-commit: 067012f5844b7390e7279f575342ae0536f80520
2025-01-23 20:07:37 +00:00
Kubernetes Publisher
3b09c13448 Merge pull request #128971 from aojea/servicecidr_ga
KEP-1880 Multiple Service CIDRs: Graduate to GA

Kubernetes-commit: 45d0fddaf1f24f7b559eb936308ce2aeb9871850
2025-01-22 20:27:05 +00:00
Kubernetes Publisher
3617101e66 Merge pull request #127709 from pohly/log-client-go-rest
client-go/rest: finish context support

Kubernetes-commit: 427cd18f726be3e3c4f657258dc17a97beca92d5
2025-01-22 20:27:02 +00:00
Patrick Ohly
be86cb59f1 client-go rest: store logger in Result
Storing a context and making sure that it never gets canceled also has
overhead. We might as well just do the klog.FromContext when constructing
the Result and store the logger for later use.

Kubernetes-commit: b7386467c8df686e935c477eac26049a80de789b
2024-11-27 13:19:47 +01:00
Antonio Ojea
a9177f9ca1 make update
Kubernetes-commit: 3606d52cd6de7366ca855d571b27193c32b029fb
2024-11-26 03:52:02 +00:00
Patrick Ohly
5d128adc87 client-go/rest: finish conversion to contextual logging
The remaining calls can be converted without API changes.

Kubernetes-commit: 7821abf2ae289673bbfa3b9a6b8b34f5196c7c7e
2024-09-02 17:55:12 +02:00
Patrick Ohly
7aa9904196 client-go/rest: backoff with context support
The BackoffManager interface sleeps without considering the caller's context,
i.e. cancellation is not supported. This alone is reason enough to deprecate it
and to replace it with an interface that supports a context parameter.

The other reason is that contextual logging needs that parameter.

Kubernetes-commit: b15a1943d51adfb8c5e0185d58d25e038c3d6ade
2024-09-02 20:18:47 +02:00
Patrick Ohly
2b2015d460 client-go/test: warning handler with contextual logging
The default handler now uses contextual logging. Instead of

     warnings.go:106] warning 1

it now logs the caller of client-go and uses structured, contextual
logging

     main.go:100] "Warning" message="warning 1"

Users of client-go have the choice whether the handler that they provide uses
the traditional API (no API break!) or contextual logging.

Kubernetes-commit: 48fb886325fce4b16e4067caadb7bcd3044d460f
2024-09-02 17:51:01 +02:00
Kubernetes Publisher
9897373fe6 Merge pull request #129631 from kishen-v/update-client-go-docs
Update compatibility matrix and maintenance status upto release-1.32

Kubernetes-commit: d06398aac3e378da0c95472cd39713998206e9ff
2025-01-16 20:23:32 +00:00
Kubernetes Publisher
49eb6dc066 Merge pull request #129633 from skitt/revert-go-difflib-go-spew
Revert to go-difflib and go-spew releases

Kubernetes-commit: 6d570c923f66a1f214d0c3ba3eddd9a0cd0fae68
2025-01-15 20:23:22 +00:00
Stephen Kitt
2d999b8c6e Revert to go-difflib and go-spew releases
The last dependency pulling in the tips of go-difflib and go-spew has
reverted to the last release of both projects, so k/k can revert to
the releases too. As can be seen from the contents of vendor, this
doesn't result in any actual change in the code.

Signed-off-by: Stephen Kitt <skitt@redhat.com>

Kubernetes-commit: 3986472b3c7202716f92e586ccfaa4b4fe573dc5
2025-01-15 09:07:27 +01:00
Kishen Viswanathan
ea0b82ef07 Update compatibility matrix and maintenance status upto release-1.32
Kubernetes-commit: fef67f64c7bdb3a44fccfb1b84805c8c52c290c9
2025-01-15 12:16:25 +05:30
Kubernetes Publisher
151d631605 Merge pull request #129615 from pohly/log-client-go-tools-cache-apis-fix
client-go/tools/cache: fix TestAddWhileActive

Kubernetes-commit: 1a9feed0cd89f3299ddb6f5eaa5663496c59342c
2025-01-14 20:40:51 +00:00
Patrick Ohly
40cace856c client-go/tools/cache: fix TestAddWhileActive
4638ba971661497b147906b8977ae206c9dd6e44 added tracking of the goroutine which
executes informer.Run. In the TestAddWhileActive the original `go
informer.Run()` was left in place, causing a data race between the two
`informer.Run` instances:

==================
WARNING: DATA RACE
Read at 0x00c000262398 by goroutine 5302:
  k8s.io/client-go/tools/cache.(*controller).RunWithContext()
      /home/prow/go/src/k8s.io/kubernetes/staging/src/k8s.io/client-go/tools/cache/controller.go:162 +0x1ad
  k8s.io/client-go/tools/cache.(*sharedIndexInformer).RunWithContext()
      /home/prow/go/src/k8s.io/kubernetes/staging/src/k8s.io/client-go/tools/cache/shared_informer.go:584 +0x6c5
  k8s.io/client-go/tools/cache.(*sharedIndexInformer).Run()
      /home/prow/go/src/k8s.io/kubernetes/staging/src/k8s.io/client-go/tools/cache/shared_informer.go:527 +0x48
  k8s.io/client-go/tools/cache.TestAddWhileActive.gowrap1()
      /home/prow/go/src/k8s.io/kubernetes/staging/src/k8s.io/client-go/tools/cache/shared_informer_test.go:1080 +0x17

Previous write at 0x00c000262398 by goroutine 5301:
  k8s.io/client-go/tools/cache.New()
      /home/prow/go/src/k8s.io/kubernetes/staging/src/k8s.io/client-go/tools/cache/controller.go:142 +0x9de
  k8s.io/client-go/tools/cache.(*sharedIndexInformer).RunWithContext.func1()
      /home/prow/go/src/k8s.io/kubernetes/staging/src/k8s.io/client-go/tools/cache/shared_informer.go:562 +0xa78
  k8s.io/client-go/tools/cache.(*sharedIndexInformer).RunWithContext()
      /home/prow/go/src/k8s.io/kubernetes/staging/src/k8s.io/client-go/tools/cache/shared_informer.go:565 +0x119
  k8s.io/client-go/tools/cache.(*sharedIndexInformer).Run()
      /home/prow/go/src/k8s.io/kubernetes/staging/src/k8s.io/client-go/tools/cache/shared_informer.go:527 +0x44
  k8s.io/client-go/tools/cache.(*sharedIndexInformer).Run-fm()
      <autogenerated>:1 +0x17
  k8s.io/client-go/tools/cache.TestAddWhileActive.(*Group).StartWithChannel.func2()
      /home/prow/go/src/k8s.io/kubernetes/staging/src/k8s.io/apimachinery/pkg/util/wait/wait.go:55 +0x38
  k8s.io/apimachinery/pkg/util/wait.(*Group).Start.func1()
      /home/prow/go/src/k8s.io/kubernetes/staging/src/k8s.io/apimachinery/pkg/util/wait/wait.go:72 +0x86

Goroutine 5302 (running) created at:
  k8s.io/client-go/tools/cache.TestAddWhileActive()
      /home/prow/go/src/k8s.io/kubernetes/staging/src/k8s.io/client-go/tools/cache/shared_informer_test.go:1080 +0x93e
  testing.tRunner()
      /usr/local/go/src/testing/testing.go:1690 +0x226
  testing.(*T).Run.gowrap1()
      /usr/local/go/src/testing/testing.go:1743 +0x44

Goroutine 5301 (running) created at:
  k8s.io/apimachinery/pkg/util/wait.(*Group).Start()
      /home/prow/go/src/k8s.io/kubernetes/staging/src/k8s.io/apimachinery/pkg/util/wait/wait.go:70 +0xe4
  k8s.io/apimachinery/pkg/util/wait.(*Group).StartWithChannel()
      /home/prow/go/src/k8s.io/kubernetes/staging/src/k8s.io/apimachinery/pkg/util/wait/wait.go:54 +0x7e6
  k8s.io/client-go/tools/cache.TestAddWhileActive()
      /home/prow/go/src/k8s.io/kubernetes/staging/src/k8s.io/client-go/tools/cache/shared_informer_test.go:1074 +0x6a1
  testing.tRunner()
      /usr/local/go/src/testing/testing.go:1690 +0x226
  testing.(*T).Run.gowrap1()
      /usr/local/go/src/testing/testing.go:1743 +0x44
==================

Kubernetes-commit: d66ced5730fa60c04b0a39df58a156b7045585f6
2025-01-14 14:06:31 +01:00
Kubernetes Publisher
e421aed7f1 Merge pull request #129139 from tklauser/client-setconfigdefaults-noerror
Remove always-`nil` `setConfigDefaults` error return value in generated clients

Kubernetes-commit: 2331c028c2000f7d31efeeb405d8151a78a9de9c
2025-01-09 16:30:42 +00:00
Kubernetes Publisher
26c6fd655e Merge pull request #129343 from pohly/log-client-go-v1-event
client-go event: add WithContext expansion methods

Kubernetes-commit: 2832f70801fc7c505a2b90c236dcb24fb59cb9d9
2025-01-08 16:22:50 +00:00
Kubernetes Publisher
ca1e525bb4 Merge pull request #129349 from dims/bump-x/net-to-v0.33.0
Bump x/net to v0.33.0

Kubernetes-commit: b7ef173c59065f9a5f68eb514ef0483c6f3887ae
2025-01-06 20:23:09 +00:00
Kubernetes Publisher
2ad95cfec9 Merge pull request #128872 from alvaroaleman/generics
Use generic btree in watchcache

Kubernetes-commit: 8f8c94a04d00e59d286fe4387197bc62c6a4f374
2025-01-03 16:22:09 +00:00
Alvaro Aleman
91ed5e1d2b Update github.com/google/btree
Kubernetes-commit: a97ed3c98bcd2c520260aa04c516a24e975e7d69
2025-01-02 19:44:07 -05:00
Kubernetes Publisher
da6e2946e5 Merge pull request #129420 from pohly/client-go-tools-cache-testhammercontroller-fix
client-go cache: fix TestHammerController

Kubernetes-commit: 8f330c63688ab920ea8d864d9a3193da535018e5
2024-12-29 16:21:56 +00:00
Patrick Ohly
498e3efe74 client-go cache: fix TestHammerController
The test relied on a 100ms sleep to ensure that controller was done.  If that
race was lost, one goroutine was intentionally prevented from completing by
locking a mutex permanently. A TODO was left about detecting that.

Adding goroutine leak checking in
https://github.com/kubernetes/kubernetes/pull/126387 revealed that this race
indeed sometimes is lost because the goroutine
leaked (https://github.com/kubernetes/kubernetes/issues/129400).

Waiting for controller shutdown instead of relying on timing should fix this.

Kubernetes-commit: 8e1403563a60f3b7a258e3bbb64b5c3a7f6548fb
2024-12-29 12:18:50 +01:00
Davanum Srinivas
6584190087 Bump x/net to v0.33.0
Signed-off-by: Davanum Srinivas <davanum@gmail.com>

Kubernetes-commit: 0b6e3718340fa7e3846cf9b7d5a0f7a684a6fa5a
2024-12-20 14:30:57 -05:00
Kubernetes Publisher
ea791f2501 Merge pull request #126387 from pohly/log-client-go-tools-cache-apis
client-go/tools/cache: add APIs with context parameter

Kubernetes-commit: e305c3398896b04c0d3b58d64531f8a87f685f68
2024-12-18 21:52:29 +00:00
Tobias Klauser
9f31100789 Update generated clients after removing always-nil setConfigDefaults error return value
Kubernetes-commit: 2c24a12804ca0020e57592a6844f7c5874dffcfe
2024-12-15 23:19:18 +01:00
Kubernetes Publisher
67da6d1a41 Merge pull request #129212 from Jefftree/add-clientgo-readme
Add client-go README

Kubernetes-commit: cb93d6ee69b8d4ca8701336e4f7cb278751f34e4
2024-12-15 01:51:03 +00:00
Kubernetes Prow Robot
d5ac3dbddc
Merge pull request #1394 from Jefftree/patch-1
Delete README.md
2024-12-14 15:58:43 +01:00
Kubernetes Publisher
61ee2c5802 Merge pull request #129213 from Jefftree/k-openapi
Bump kube-openapi

Kubernetes-commit: 13eb074ddd231d127709f0410185eeca68a69c8a
2024-12-14 01:51:28 +00:00
Jefftree
540fb4f698 bump kube-openapi
Kubernetes-commit: 3269f4bb94c58dfe577621c42f88ea06fbdd79a7
2024-12-13 20:50:49 +00:00
Jeffrey Ying
a6e6f66ef7
Delete README.md 2024-12-13 15:32:23 -05:00
Jefftree
ec0ec91b19 Add client-go README
Kubernetes-commit: 8f782fea93023a3faa43ad0c22f8c295f732a65b
2024-12-13 20:30:13 +00:00
Kubernetes Publisher
ab443a50c6 Merge pull request #128659 from saschagrunert/google-go-protobuf
Replace `github.com/golang/protobuf` with `google.golang.org/protobuf`

Kubernetes-commit: b1f2af04328936c2fa79db4af14f5c6ad9160748
2024-12-13 17:52:36 +00:00
Kubernetes Publisher
fae881e13f Merge pull request #129041 from aojea/flowcontrol
flowcontrol: remove test dependencies from go binaries

Kubernetes-commit: e8312395f09619d4808d6e4a78d85dc500a6ea15
2024-12-13 13:51:28 +00:00
Kubernetes Publisher
633c24cce5 Merge pull request #129195 from dims/update-x/crypto/ssh-dependency
Update x/crypto/ssh dependency to v0.31.0

Kubernetes-commit: b21ab179c74a270cd276d2dbb5f4b55730838096
2024-12-13 09:51:37 +00:00
Davanum Srinivas
e82d0c2ac7 Update x/crypto/ssh dependency
Signed-off-by: Davanum Srinivas <davanum@gmail.com>

Kubernetes-commit: 80735180ab2c61232dcc4646e693ddcaeaf96ca3
2024-12-12 20:46:15 -05:00
Antonio Ojea
92b4ec71fb flowcontrol: remove testing dependencies
The methods NewFakeClock were using a testing dependency as a parameter,
to avoid breaking compatibility and to remove this dependency, just use
the clock.Clock interface.

If we have to do it again most probable we have chosen other pattern and
for sure other names, but now is too late.

Kubernetes-commit: 5c283cbb453acac9869b49020f6f999796360729
2024-12-12 17:42:41 +00:00
Kubernetes Publisher
1df7a02c72 Merge pull request #129054 from pohly/remove-import-name
remove import doc comments

Kubernetes-commit: e8615e27125518f0ed0ba06244b7ecee21451bb0
2024-12-12 09:50:39 +00:00
Kubernetes Publisher
706280d1e7 Merge pull request #128753 from skitt/skitt-reviewer-client-go
Add myself to client-go reviewers

Kubernetes-commit: b50043e3123cdcb0f5912972a918bf476f1d295d
2024-12-12 05:51:54 +00:00
Patrick Ohly
1047529e64 client-go event: add WithContext expansion methods
Only the v1 API should be in use. The v1beta1 API therefore doesn't get updated
and doesn't need the context.TODO anymore.

Kubernetes-commit: f1834f06f4f7de8c6a5a70138cf08f8ca804f5c2
2024-12-09 17:41:14 +01:00
Kubernetes Publisher
8e21410d16 Merge pull request #129103 from liggitt/drop-winreadlinkvolume
Drop use of winreadlinkvolume godebug option

Kubernetes-commit: bfe431b53e600c9a36c46eef0f6ecfcf37265d60
2024-12-06 18:26:37 +00:00
Jordan Liggitt
e95e61cd4f Drop use of winreadlinkvolume godebug option
Kubernetes-commit: 3046fe23d4fe4ba86713ffd61bf0e07156b2b7c3
2024-12-06 02:40:53 -05:00
Kubernetes Publisher
f118320d13 Merge pull request #129083 from liggitt/go1.23windows
Revert to go1.22 windows filesystem stdlib behavior

Kubernetes-commit: 6fc64a261c1dca857a5a7fd1bc87fae38dbe1c8a
2024-12-04 22:23:15 +00:00
Jordan Liggitt
06af948aa5 Revert to go1.22 windows filesystem stdlib behavior
Kubernetes-commit: 3878a3a6de64660e356a35f70471c27a09698090
2024-12-04 09:52:56 -05:00
Patrick Ohly
70a4950f35 remove import doc comments
The "// import <path>" comment has been superseded by Go modules.
We don't have to remove them, but doing so has some advantages:

- They are used inconsistently, which is confusing.
- We can then also remove the (currently broken) hack/update-vanity-imports.sh.
- Last but not least, it would be a first step towards avoiding the k8s.io domain.

This commit was generated with
   sed -i -e 's;^package \(.*\) // import.*;package \1;' $(git grep -l '^package.*// import' | grep -v 'vendor/')

Everything was included, except for
   package labels // import k8s.io/kubernetes/pkg/util/labels
because that package is marked as "read-only".

Kubernetes-commit: 8a908e0c0bd96a3455edf7e3b5f5af90564e65b0
2024-12-02 14:43:58 +01:00
Stephen Kitt
111d4bc2cc Add myself to client-go reviewers
Given the ongoing work on generifying client-go, it might make sense
for me to be a reviewer (at least to keep better track of changes
being made before they go in).

Signed-off-by: Stephen Kitt <skitt@redhat.com>

Kubernetes-commit: 3d069b2a8a6a635434331f96b79e44bc7c98f29c
2024-11-11 15:03:14 -07:00