Commit Graph

543 Commits

Author SHA1 Message Date
Uwe Krueger
90c6a46b32 active remove/add tests for event handlers
Kubernetes-commit: e9cd17170b1646672796e713dee6c4fb0e6693bb
2021-10-06 12:40:46 +02:00
Uwe Krueger
de4dd3aaf3 tests for invalid registration removals
Kubernetes-commit: 152b6e11af4c8c50b768630bf7724e0bb3414e9c
2021-08-22 13:27:36 +02:00
Uwe Krueger
33eff64a05 apply desired changes for handler registration
Kubernetes-commit: 92f04baac98186673c684bba419087d6285807b1
2021-08-22 13:03:18 +02:00
Uwe Krueger
d73e40f207 rename handle to registration
Kubernetes-commit: 7054ac16d43a4a55d6e7b69943eb209f6495c4ce
2021-08-04 21:54:32 +02:00
Alexander Zielenski
b3a61c6731 remove informational informer methods again
Kubernetes-commit: f52f4a8e3045fd3eeba0315a347ed653012cd5c5
2022-06-16 00:09:20 -07:00
Alexander Zielenski
ecdc8bf729 support removal of event handlers from SharedIndexInformers
To be able to implement controllers that are dynamically deciding
on which resources to watch, it is required to get rid of
dedicated watches and event handlers again. This requires the
possibility to remove event handlers from SharedIndexInformers again.
Stopping an informer is not sufficient, because there might
be multiple controllers in a controller manager that independently
decide which resources to watch.

Unfortunately the ResourceEventHandler interface encourages to use
value objects for handlers (like the ResourceEventHandlerFuncs
struct, that uses value receivers to implement the interface).
Go does not support comparison of function pointers and therefore
the comparison of such structs is not possible, also. To be able
to remove all kinds of handlers and to solve the problem of
multi-registrations of handlers a registration handle is introduced.
It is returned when adding a handler and can later be used to remove
the registration again. This handle directly stores the created
listener to simplify the deletion.

Kubernetes-commit: 7436af3302088c979b431856c432b95dd230f847
2022-06-16 00:07:54 -07:00
jackzhang
d04c2ced1c update lock getter of leaderelection
The lock acquired by tryAcquireOrRenew is released when the leader ends
leadership. However, due to the cancellation of the context, the lock may
be set as an empty lock, so the Update cannot be run normally, resulting
in a failure to release the lock.

Signed-off-by: jackzhang <x_jackzhang@qq.com>

Kubernetes-commit: 8690ff6264cceb38bd81dec99bb8affcc40286a9
2022-08-29 09:58:13 +08:00
Abirdcfly
9b300defa3 make TestListPager_EachListItem rework
Signed-off-by: Abirdcfly <fp544037857@gmail.com>

Kubernetes-commit: 5e84f6b6d7cd39b785eaca404c3f7e460f80f71b
2022-07-19 15:34:23 +08:00
inosato
27de641f75 Remove ioutil from client-go
Signed-off-by: inosato <si17_21@yahoo.co.jp>

Kubernetes-commit: 88dfa51b6003c90e8f0a0508939a1d79950a40df
2022-07-30 20:54:41 +09:00
Marcel Zięba
ff6bf679aa Add option to retry internal api error in reflector.
Kubernetes-commit: 0b2b6489de8f75d5299f54180617601126bb8878
2022-07-25 08:02:54 +00:00
Davanum Srinivas
2a6c116e40 Generate and format files
- Run hack/update-codegen.sh
- Run hack/update-generated-device-plugin.sh
- Run hack/update-generated-protobuf.sh
- Run hack/update-generated-runtime.sh
- Run hack/update-generated-swagger-docs.sh
- Run hack/update-openapi-spec.sh
- Run hack/update-gofmt.sh

Signed-off-by: Davanum Srinivas <davanum@gmail.com>

Kubernetes-commit: a9593d634c6a053848413e600dadbf974627515f
2022-07-19 20:54:13 -04:00
Abirdcfly
ca60e0ea14 fix a possible panic because of taking the address of nil
Signed-off-by: Abirdcfly <fp544037857@gmail.com>

Kubernetes-commit: c8c2819a4d7327f33a143f65c6af2bff5ef49735
2022-07-19 10:39:08 +08:00
Lukasz Szaszkiewicz
441e2c8c97 reflector: simplify reading the resourceVersion
Kubernetes-commit: 63b125d4061d267ad8998ea30e054bb1445b1a5a
2022-07-15 10:14:26 +02:00
Lukasz Szaszkiewicz
04f67d5d4f reflector: move LIST to its own method
Kubernetes-commit: 6fc09008def0b63fdd31bd26a14f7fcd3ed63c7e
2022-06-24 16:25:08 +02:00
Lukasz Szaszkiewicz
4e28921c86 reflector: refactor watchHandler
Kubernetes-commit: e9e26068b746315b616a26b91ff2613f98e934bc
2022-06-24 13:44:32 +02:00
weilaaa
64585cf823 correct input params and add godoc
Kubernetes-commit: 9847b2eeb43e3fd13581dfdb4eeb288139ea7f3b
2022-06-22 11:26:07 +08:00
Nick Santos
5ce7078061 client-go: fix panic in ConfirmUsable validation
Fixes https://github.com/kubernetes/client-go/issues/1108

Kubernetes-commit: 7d2c6096c212d9c31e7cd0bccb6dc2dec9a4ef6a
2022-06-07 15:53:16 -04:00
bells17
21f4308ca2 Fix typo: type -> eventtype
Kubernetes-commit: 53083ea6aa9817f130b15efaf8ccc2d0c59c4be3
2019-10-21 17:15:44 +09:00
Karl Isenberg
876406445a fix: reflector to return wrapped list errors
This fix allows Reflector/Informer callers to detect API errors using the standard Go errors.As unwrapping methods used by the apimachinery helper methods. Combined with a custom WatchErrorHandler, this can be used to stop an informer that encounters specific errors, like resource not found or forbidden.

Kubernetes-commit: 9ace604b63045ebbb066cab5e8508b51d0900a05
2022-05-16 16:33:30 -07:00
Andrew Stoycos
f19a514ff5 Fix Panic Condition
Currenlty an event recorder can send an event to a
broadcaster that is already stopped, resulting
in a panic.  This ensures the broadcaster holds
a lock while it is shutting down and then forces
any senders to drop queued events following
broadcaster shutdown.

It also updates the Action, ActionOrDrop,  Watch,
and WatchWithPrefix functions to return an error
in the case where data is sent on the closed bradcaster
channel rather than panicing.

Lastly it updates unit tests to ensure the fix works correctly

fixes: https://github.com/kubernetes/kubernetes/issues/108518

Signed-off-by: Andrew Stoycos <astoycos@redhat.com>

Kubernetes-commit: 6aa779f4ed3d3acdad2f2bf17fb27e11e23aabe4
2022-02-11 14:50:19 -05:00
Michael Bolot
e540ebe994 Addresses the issue which caused #109115
Kubernetes-commit: cbbb5f70a47644f9830073d9d0329bf247a328a1
2022-03-29 12:35:13 -05:00
Wojciech Tyczyński
1cab68940f Add test for indexer with multiple values
Kubernetes-commit: 56159f258ca380600b0bc08b2e99cbc745db3560
2022-03-30 08:52:10 +02:00
Jian Li
6b59aa0b4a make comments of updateIndices optimization code more accurate
Kubernetes-commit: 0eae1f3addbd044793dac89f9e097e5f4c6fb2aa
2022-03-14 13:56:17 +08:00
Margo Crawford
28b9e26d5f Remove v1alpha1 of the execcredential
Signed-off-by: Margo Crawford <margaretc@vmware.com>

Kubernetes-commit: 5b690b44d08807c6434a421b0041ef685482d337
2022-03-18 10:16:11 -07:00
Antonio Ojea
e2c62ff0c0 client-go: add request and response size metrics
Get metrics for the request and response  size, so we can correlate latency
and size on a request, otherwise we could get confused because we don't know if the
network is slow or just the request size huge.

Kubernetes-commit: 64d9d0585f6dbc9266f31b6d0f795d6c0421495e
2021-12-09 12:11:01 +01:00
Di Yi
5b56e4a504 resolve casing issue
Kubernetes-commit: 9996c154cba000346db940c90e234265d67dd8a9
2022-01-28 15:50:43 +08:00
Di Yi
93a63158d4 add fieldPath back to event logs
Kubernetes-commit: 94245af8f4a144e0aceb5a4be0d3ae4993e19be7
2022-01-27 14:28:26 +08:00
Alexander Zielenski
54928eef9f modify SharedIndexInformer to use newInformer constructor which supports transformers
avoids code duplication, allows transformer to be used with SharedIndexInformer

Kubernetes-commit: 754bf3b3d02c66d1dd030460b03dddd3d6c7196d
2022-01-19 11:40:42 -08:00
Ismayil Mirzali
664b1a6c8c client-go: refactor: Fix styling issues (#107248)
* client-go: Remove unreachable return

Due to the way the switch statement is done,
the return at the end of the function will neverbe reached.

Signed-off-by: Ismayil Mirzali <ismayilmirzeli@gmail.com>

* client-go: Refactor for clarity

Fixed one instance where the error message should be lowercase.
Made the fields in the struct literal more explicit

Signed-off-by: Ismayil Mirzali <ismayilmirzeli@gmail.com>

Kubernetes-commit: 75c0987de3cb9a0380873745f68dea2f0835a7a2
2022-01-18 12:03:08 +02:00
Wojciech Tyczyński
a806c6e4fd Remove selflink references in different testing-related files
Kubernetes-commit: 551790729f1d26d75c1d3fa1411e341eb367f9f3
2022-01-13 11:33:26 +01:00
Davanum Srinivas
3bf0eac274 OWNERS cleanup - Jan 2021 Week 1
Signed-off-by: Davanum Srinivas <davanum@gmail.com>

Kubernetes-commit: 9682b7248fb69733c2a0ee53618856e87b067f16
2022-01-03 10:59:47 -05:00
wq
3480737c9e fix typos in comment
Kubernetes-commit: 3e2932179084fa322ba1bc53997d44e1d383db00
2022-01-08 23:39:23 +09:00
Mikhail Mazurskiy
7a08020ed2 Make sleep interruptible
Kubernetes-commit: b705a521d8814b38faabea218097cac65d6ab5c5
2021-08-21 12:20:30 +10:00
astraw99
a8ff96d887 fix log typo
Kubernetes-commit: abce7ab534d0c667dd1438ff24bb3130d17d3f6e
2021-11-19 11:06:14 +08:00
Shaun Crampton
5754d8fddf client-go: Clear the ResourceVersionMatch on paged list calls
API server rejects continuations with ResourceVersionMatch set.

Kubernetes-commit: 8ac5e9b065cd9aef1543080cce1cf99cc8bb4ce9
2022-01-04 16:05:32 +00:00
Arda Güçlü
a6257fdee4 Enable setting proxyurl in kubeconfig via kubectl config (#105566)
* Enable setting proxyurl in kubeconfig via kubectl config

This PR enables setting `proxy-url` in kubeconfig via kubectl config.

* Add godoc for proxy-url unit tests

Kubernetes-commit: afdde383210294c3da573decc44b5ce55cffcb94
2021-12-20 21:21:02 +00:00
Davanum Srinivas
73f2731e23 Cleanup OWNERS files (No Activity in the last year)
Signed-off-by: Davanum Srinivas <davanum@gmail.com>

Kubernetes-commit: 497e9c1971c9e7d0193bc6d11503ec4ad527f1d5
2021-12-10 15:18:50 -05:00
Davanum Srinivas
70f09c4943 Check in OWNERS modified by update-yamlfmt.sh
Signed-off-by: Davanum Srinivas <davanum@gmail.com>

Kubernetes-commit: 9405e9b55ebcd461f161859a698b949ea3bde31d
2021-12-09 21:31:26 -05:00
Wojciech Tyczyński
276ea3ed97 Remove support for Endpoints and ConfigMaps lock from leader election
Kubernetes-commit: 29d9683cd0fb3cc81810a8b39715e5eb4c68b00e
2021-12-07 16:38:32 +01:00
hyschumi
547d6c809a refactor: remove dup code
Signed-off-by: hyschumi<msliudongsheng@gmail.com>

Kubernetes-commit: da5d0a72d9d2a0948e21b746a8c6951dc40c0ce9
2021-11-04 21:11:53 +08:00
Antonio Ojea
2e69bf9be0 fix unassigned error on client-go test
Kubernetes-commit: 01a0fba3620c433f49120d82f908069281482a17
2021-11-16 16:58:52 +01:00
brianpursley
f5d063cf7a close streamConn and stop listening when an error occurs while port forwarding
Kubernetes-commit: 4a35e6c5641ee36291548c9c24b5b85663d5cd07
2021-11-16 21:05:43 -05:00
Justin SB
ecfd45a4d9 leaderelection: populate the apiVersion/kind when reporting events
This avoids the assumption that the kinds are populated in the schema,
and is arguably a little more efficient also.

Kubernetes-commit: 3bf06ff3a15a2f1fefeb7a70373a92cb4b94818f
2021-11-13 11:14:02 -05:00
Margo Crawford
5fca705b7d --as-uid flag in kubectl and kubeconfigs.
This corresponds to previous work to allow impersonating UIDs:
* Introduce Impersonate-UID header: #99961
* Add UID to client-go impersonation config #104483

Signed-off-by: Margo Crawford <margaretc@vmware.com>

Kubernetes-commit: 7e079f5144474cae05802771f604df2b748d781f
2021-10-19 16:12:31 -07:00
Antoni Zawodny
9af7db3c25 Add more info to the ListAndWatch trace
Kubernetes-commit: 093aa210be67f45efb1005f273d8d68444156473
2021-10-21 14:33:57 +02:00
shawnhanx
93595145a2 Support SetStructuredLogging with the new events library
Kubernetes-commit: 230cb00ddd989ae2359696f6aa09a71253936a49
2021-10-11 16:16:46 +08:00
astraw99
1816a40bbb fix word comment to common
Kubernetes-commit: 3e31933471e015a860e1967acfe730bb35422f17
2021-08-29 19:06:04 +08:00
wojtekt
c702a411d1 Create TransformingIndexerInformer
Kubernetes-commit: 56ffb4e2b056622210bbf5ce845cf63ca18e85ce
2021-09-23 09:09:59 +02:00
wojtekt
b100ecfc06 Create TransformingInformer
TransformingInfomer is like a regular Informer, but allows for applying
custom transform functions on the objects received via list/watch API calls.

Kubernetes-commit: efd3490076c391823095b4c8bd6e847ae18eb012
2020-09-29 15:06:33 +02:00
wojtekt
e61d0d5d52 Optimize index updating
Kubernetes-commit: 75273a0689250f4861ea41405e6402c6191563a8
2021-09-24 15:24:01 +02:00