Commit Graph

4671 Commits

Author SHA1 Message Date
Patrick Ohly
5d289bc44c client-go/tools/cache: add APIs with context parameter
The context is used for cancellation and to support contextual logging.

In most cases, alternative *WithContext APIs get added, except for
NewIntegerResourceVersionMutationCache where code searches indicate that the
API is not used downstream.

An API break around SharedInformer couldn't be avoided because the
alternative (keeping the interface unchanged and adding a second one with
the new method) would have been worse. controller-runtime needs to be updated
because it implements that interface in a test package. Downstream consumers of
controller-runtime will work unless they use those test package.

Converting Kubernetes to use the other new alternatives will follow. In the
meantime, usage of the new alternatives cannot be enforced via logcheck
yet (see https://github.com/kubernetes/kubernetes/issues/126379 for the
process).

Passing context through and checking it for cancellation is tricky for event
handlers. A better approach is to map the context cancellation to the normal
removal of an event handler via a helper goroutine. Thanks to the new
HandleErrorWithLogr and HandleCrashWithLogr, remembering the logger is
sufficient for handling problems at runtime.

Kubernetes-commit: 4638ba971661497b147906b8977ae206c9dd6e44
2024-07-26 15:26:00 +02:00
Patrick Ohly
b836a27b07 client-go/tools/cache: goroutine leak checking
Several tests leaked goroutines. All of those get fixed where possible
without API changes. Goleak is used to prevent regressions.

One new test specifically covers shutdown of an informer and its event
handlers.

Kubernetes-commit: 0ba43734b4c8998b4aaeb1fa2bec8dee609fa50a
2024-11-28 17:59:36 +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
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
Kubernetes Publisher
37045084c2 Merge pull request #126503 from skitt/generic-fake-client
Use generics to share code in fake client-go implementations

Kubernetes-commit: 31970d418ccae80c9c7e25e8c503035a79a53763
2024-11-08 17:54:43 +00:00
Stephen Kitt
eb282ed4ca Align fake client-go clients with the main interface
"Real" clients use objectWithMeta to enforce support for meta.Object;
strictly speaking, fakes don't need this, but it's best to align them
with the real clients to ensure that fakes don't end up allowing types
that can't be used with the real clients.

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

Kubernetes-commit: 736e5560ba6b21247c21f8ed12007e1d6d5fec1a
2024-11-08 10:42:12 +01:00
Sascha Grunert
be40e97e1a Replace github.com/golang/protobuf with google.golang.org/protobuf
Signed-off-by: Sascha Grunert <sgrunert@redhat.com>

Kubernetes-commit: c1d0e870f4f45548c0d5b2bf83f36fb208252978
2024-11-07 12:47:08 +01:00
Stephen Kitt
646e79b061 Run codegen
Signed-off-by: Stephen Kitt <skitt@redhat.com>

Kubernetes-commit: be03bcf3244e6c280b8aaf7a638d1926f0960eab
2024-08-01 12:10:10 +02:00
Stephen Kitt
c475fe0910 Generify fake clientsets
This adds a generic implementation of a fake clientset, and uses it to
replace the template code in generated fake clientsets for the default
methods. The templates are preserved as-is (or as close as they can
be) for use in extensions, whether for resources or subresources.

Fake clientsets with no extensions are reduced to their main getter,
their specific struct, and their constructor. All method
implementations are provided by the generic implementation. The
dedicated struct is preserved to allow extensions and expansions to be
defined where necessary.

Instead of handling the variants (with/without list, apply) with a
complex sequence of if statements, build up an index into an array
containing the various declarations.

Similarly, instead of calling different action constructors for
namespaced and non-namespaced clientsets, assume the current behaviour
of non-namespaced action creation (equivalent to creating a namespaced
action with an empty namespace) and document that assumption in the
action implementation.

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

Kubernetes-commit: b0ce65df9b74d4dc72050840d5ad067596d7b822
2024-07-30 15:47:02 +02:00
Kubernetes Publisher
955401ca9a Merge pull request #128407 from ndixita/pod-level-resources
[PodLevelResources] Pod Level Resources Feature Alpha

Kubernetes-commit: c25f5eefe4efda4c0d9561d06942cd3de3dfe2e4
2024-11-08 11:58:33 +00:00
Kubernetes Publisher
eddb107938 Merge pull request #127857 from Jefftree/cle-v1alpha2
Coordinated Leader Election add v1alpha2

Kubernetes-commit: 45260fd76aa7b2ceed16aea173ccb3f81e3ab98b
2024-11-08 11:58:30 +00:00
ndixita
77d9809f89 Generated files and compatability data from API changes
Kubernetes-commit: 85488b5f10bc6128dab69e4bdd94cec2c005c7f5
2024-10-16 20:34:52 +00:00
Jefftree
ef8b7aa53e generated
Kubernetes-commit: e86c38b249bb614c13210f1fe34fb92247641ef9
2024-10-04 15:53:28 +00:00
Jefftree
bf1a6eed35 v1alpha2 LeaseCandidate API
Kubernetes-commit: 0ce7b688a65a65031c6ee8c616989e4b0be4ce9f
2024-10-04 14:43:11 +00:00
Kubernetes Publisher
ec126553e2 Merge pull request #128240 from LionelJouin/KEP-4817
DRA: Implementation of ResourceClaim.Status.Devices (KEP-4817)

Kubernetes-commit: 4cf2818f964d8862db4399cb548060f72bea4ded
2024-11-08 11:58:27 +00:00
Kubernetes Publisher
fcfb2ba016 Merge pull request #127513 from tkashem/delete-undecryptable
KEP-3926: unsafe deletion of corrupt objects

Kubernetes-commit: 4d10ae8fdc579e2bb09789507cae7b8d32cbd306
2024-11-08 11:58:24 +00:00
Kubernetes Publisher
fe3db7fea6 Merge pull request #128681 from soltysh/client-go_port_forward_reset
Client go port forward reset, error handling and tests

Kubernetes-commit: 210deea063a5a778e8c3a8e32b8bc4c808b87835
2024-11-08 11:58:21 +00:00
Kubernetes Publisher
2d3b1e2feb Merge pull request #128356 from lauralorenz/crashloopbackoff-maintain10minuterecoverythreshold
KEP-4603: Maintain current 10 minute recovery threshold for container backoff regardless of changes to the maximum duration

Kubernetes-commit: ab30adcbae57fc498cb876979e232b422468af9a
2024-11-08 11:58:20 +00:00
Kubernetes Publisher
c57e0a82c3 Merge pull request #128641 from benluddy/e2e-cbor-client-compat
KEP-4222: Fix JSON fallback for clients using default content-type and add E2E client test.

Kubernetes-commit: 7243fa60e1c85d85bf5c129d09b7bd9bdfe24ccc
2024-11-08 11:58:17 +00:00
Lionel Jouin
fba42f0ac4 [KEP-4817] make update
Kubernetes-commit: d84c8d2a647aee3a7b0ac499a55e5f630c71d2a9
2024-11-07 22:19:09 +01:00
Lionel Jouin
bfbe175263 [KEP-4817] make update
Signed-off-by: Lionel Jouin <lionel.jouin@est.tech>

Kubernetes-commit: d28b50e0a04a4c5bbf494a423ad7851f0393467c
2024-11-07 10:36:09 +01:00
Ben Luddy
49537610e8 Fix content type fallback when a client defaults to CBOR.
With the ClientsAllowCBOR client-go feature gate enabled, a 415 response to a CBOR-encoded REST
causes all subsequent requests from the client to fall back to a JSON request encoding. This
mechanism had only worked as intended when CBOR was explicitly configured in the
ClientContentConfig. When both ClientsAllowCBOR and ClientsPreferCBOR are enabled, an
unconfigured (empty) content type defaults to CBOR instead of JSON. Both ways of configuring a
client to use the CBOR request encoding are now subject to the same fallback mechanism.

Kubernetes-commit: a77f4c7ba2e761461daaf115a38903fc91916dd6
2024-11-07 00:05:03 -05:00
Kubernetes Publisher
c57dbd8dec Merge pull request #128503 from benluddy/cbor-codecs-featuregate
KEP-4222: Wire serving codecs to CBOR feature gate.

Kubernetes-commit: 6399c32669c62cfbf7c33b14b77d6781ce1cce27
2024-11-07 03:06:07 +00:00
Abu Kashem
e132ac21c9 handle watch for unsafe delete
Kubernetes-commit: 25efc8f2d136a9574166be02789ac727c5b4a3fd
2024-11-05 20:36:56 -05:00
Ben Luddy
334e30739d Wire serving codecs to CBOR feature gate.
Integration testing has to this point relied on patching serving codecs for built-in APIs. The
test-only patching is removed and replaced by feature gated checks at runtime.

Kubernetes-commit: 439d2f7b4028638b3d8d9261bb046c3ba8d9bfcb
2024-11-01 16:05:32 -04:00
Kubernetes Publisher
2d5ed6fa11 Merge pull request #128501 from benluddy/watch-cbor-seq
KEP-4222: Use cbor-seq content-type for CBOR watch responses.

Kubernetes-commit: a885e446d6f6f5530da4923a3872eb27ca47bdc0
2024-11-06 23:06:15 +00:00
Ben Luddy
10c2fdb7f4 Use application/cbor-seq media type in streaming CBOR responses.
The media type application/cbor describes exactly one encoded item. As a new (to Kubernetes) format
with no existing clients, streaming/watch responses will use the application/cbor-seq media
type. CBOR watch responses conform to the specification of CBOR Sequences and are encoded as the
concatenation of zero or more items with no additional framing.

Kubernetes-commit: 504f14998e920ca8837b3310094b3da11c62a070
2024-11-01 13:14:06 -04:00
Kubernetes Publisher
ae04abdbe9 Merge pull request #127511 from pohly/dra-1.32-api
DRA 1.32 API: promotion to beta

Kubernetes-commit: e273349f3a2fde9a2499902645e8f10001c899bf
2024-11-06 15:06:18 +00:00
Patrick Ohly
4e05c623ae DRA API: rename DeviceCapacity.Quantity to DeviceCapacity.Value
Based on review
feedback (https://github.com/kubernetes/kubernetes/pull/127511#discussion_r1823521172).

Kubernetes-commit: 30f52826560129839922e1756730b02f184f0ef9
2024-10-31 21:30:28 +01:00
Laura Lorenz
ab2cdceca1 Maintain 10 minute recovery threshold for container backoff
Signed-off-by: Laura Lorenz <lauralorenz@google.com>

Kubernetes-commit: a0b83a774102a6d8ce03ce03c9d0431b44559019
2024-10-26 02:17:23 +00:00
Maciej Szulik
bf414551df Clean error handling in port-forward
This commit introduces:
1. Cleanups in port-forwarding error handling code, which ensures that
   we only compare lowercased text always.
2. E2E verifying that when a pod is removed a port-forward is stopped.

Signed-off-by: Maciej Szulik <soltysh@gmail.com>

Kubernetes-commit: 0b1617ccefbc6ea61c0e7c2b0b4052703f11c51c
2024-10-16 14:02:01 +02:00
Nic
d6404c8d76 fix: draining remote stream after port-forward connection broken
Signed-off-by: Nic <qianyong@api7.ai>

Kubernetes-commit: dbe6b6657bacc846656f4009ee869ca996dde1da
2024-10-04 14:48:15 +08:00
Patrick Ohly
f65974c297 DRA API: use DeviceCapacity struct instead of plain Quantity
This enables a future extension where capacity of a single device gets consumed
by different claims. The semantic without any additional fields is the same as
before: a capacity cannot be split up and is only an attribute of a device.

Because its semantically the same as before, two-way conversion to v1alpha3 is
possible.

Kubernetes-commit: 81fd64256c9cfca47385997e06a694bf98bfb799
2024-09-26 16:56:48 +02:00