Commit Graph

4717 Commits

Author SHA1 Message Date
Sean Sullivan
3ead27a3a2 Update websocket logging levels for better debuggability
Kubernetes-commit: d3feb5080c18fa73aa87c81a78d5cac82c6ed06d
2025-02-11 20:20:23 +00:00
Kubernetes Publisher
bf05f9c594 Merge pull request #130039 from p0lyn0mial/upstream-fake-client-improve-unit-test
fake/clientset: improve TestNewSimpleClientset

Kubernetes-commit: d7db75ce91f74dc560115c9f485032701e913c84
2025-02-12 23:51:42 +00:00
Kubernetes Publisher
8683d2da3b Merge pull request #130049 from aojea/avoid_ginkgo_dep
reduce dependencies in apimachinery net testing utils

Kubernetes-commit: 670b98bf9229bb1f193571949871f794f7b11ec3
2025-02-11 11:52:16 +00:00
Antonio Ojea
fb7de29368 reduce dependencies in apimachinery net testing utils
Consumers of the kubernetes golang API and clients must use
k8s.io/api,apimachinery,client-go. This is also require to download all
the necessary dependencies.

The apimachinery code contains a testing util for proxies that is used
in client-go and in the kubectl e2e. Since the tests on e2e require
ginkgo and we want to ensure this testing library is not used in
production, we cast the interface to match one of those libraries, but
the problem is that this forces consumers of apimachinery to also
download the ginkgo library.

Since NewHTTPProxyHandler receives a testing.TB interface, there is no
need to cast the interface, if someone wants to use it by implementing a
testing interface it is already aware of the risks.

Kubernetes-commit: af3b9e613d3b76b826369153760a069aabb4cf7f
2025-02-08 15:27:20 +00:00
Lukasz Szaszkiewicz
2b1c073f58 fake/clientset: improve TestNewSimpleClientset
Kubernetes-commit: d195ea8756d7a0babae1e052d17ad891cd3312d2
2025-02-07 14:39:15 +01:00
Kubernetes Publisher
07d61b66a6 Merge pull request #129341 from pohly/log-client-go-watch
client-go watch: context support

Kubernetes-commit: a02fe24385a36f43e96844e19c438cc4097704ef
2025-02-07 12:55:24 +00:00
Patrick Ohly
57bc261e52 client-go watch: NewIndexerInformerWatcherWithContext -> WithLogger
The ability to automatically stop on context cancellation was new functionality
that adds complexity and wasn't really used in Kubernetes. If someone wants
this, they can add it outside of the function.

A *WithLogger variant avoids the complexity and is consistent with
NewStreamWatcherWithLogger over in apimachinery.

Kubernetes-commit: 1a8d8c9b4a33daf9330434e1ad544ef3571722a3
2025-01-31 10:18:04 +01:00
Kubernetes Publisher
362c5e8de9 Merge pull request #129568 from deads2k/tighten-fifo-interface
create RealFIFO implementation

Kubernetes-commit: a8ef3639f9db66d8c894a880fd35a9cd011b2cb9
2025-01-30 00:24:47 +00:00
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
David Eads
f2d9cfb8c8 switch to using the real FIFO
Kubernetes-commit: a9aab298b4738f4ea9111131cdf193a3b1ba14e5
2025-01-10 16:23:23 -05:00
David Eads
43bf1a1b0a make a real FIFO implementation
Kubernetes-commit: 24b43ea96ec60ca2c574ccc6b51c989488ca3210
2025-01-10 16:23:07 -05:00
David Eads
52af3bdc0f Remove cache.ErrRequeue
cache.ErrRequeue advertised itself as a way to requeue failures on a
FIFO, but it suffers the same problems as AddIfNotPresent.  If we do
requeue an item at the end, we'll move the informer back in time.  If we
requeue at the beginning we'll simply wedge FIFO.

We didn't find examples in the wild, but by removing the error type
those impacted will get a compile error and get to decide what action is
most appropriate for their failure.  Most of the time, proceeding to the
next item is best.

Kubernetes-commit: 238c32a1d9b2c72d648193fa8642a53a2884975f
2025-01-20 13:59:43 -05:00
David Eads
d853ccf18c Remove Queue.AddIfNotPresent
Logically a cache.Queue.AddIfNotPresent means that the informer can move
back in time since an older item is placed after newer items.  The
alternative of placing errors at the head of the queue leads to
indefinite memory growth and repeated failures on retry.

Luckily this behavior was behind RetryOnError, which was always set to
false and impossible for normal users to set to true.  By removing the
function and setting, impacted users (none found in a github search)
will get a compile failure.

Kubernetes-commit: 8e77ac000131019d5aa49c19aa1f477f6dac4d59
2025-01-20 13:54:32 -05:00
David Eads
f29637f7f2 shrink the cache.Queue interface to what is actually used
Kubernetes-commit: 0ddab1694579d523e3865c75ca44d6cdf1b0ef93
2025-01-08 15:31:47 -05:00
Patrick Ohly
e8a7cb0e18 client-go informers: provide ListWatch *WithContext variants
For compatibility reasons, the old functions without the ctx parameter still
get generated, now with context.Background instead of context.TODO. In practice
that code won't be used by the client-go reflector code because it prefers
the *WithContext functions, but it cannot be ruled out that some other code
only supports the old fields.

Kubernetes-commit: 8cc74e8a266e1042be1c60adfa3091852036f48a
2024-12-09 16:04:52 +01:00
Patrick Ohly
bad1caabde client-go + apimachinery watch: context support
The Lister and Watcher interfaces only supported methods without context, but
were typically implemented with client-go API calls which need a context. New
interfaces get added using the same approach as in
https://github.com/kubernetes/kubernetes/pull/129109.

Kubernetes-commit: 6688adae142e37114d9dfa8d94cd1d8a91fbcc13
2024-12-20 13:55:47 +01: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