Commit Graph

358 Commits

Author SHA1 Message Date
Mike Spreitzer
8454aaf1be Noted divergence between requestedResyncPeriod and resyncPeriod
Kubernetes-commit: eef49c965f471d575aef8de5f071ffc6fd31c44d
2020-01-06 01:56:52 -05:00
Mike Spreitzer
1f6e3b32af Started commenting processors
Kubernetes-commit: 5546d9f12f266a082805ad3a2293fe04e0029c78
2020-01-06 01:49:29 -05:00
Mike Spreitzer
2f9f325a3b Fix tests and improve comment on NewDeltaFIFO
Kubernetes-commit: 0eca8ae9cdbbbe0e5bf56f9931acdaa97cea91af
2020-01-03 01:01:05 -08:00
Mike Spreitzer
bad9a45b33 Fixed assignment statements
Kubernetes-commit: 1d65f1b5c3977362fb5a32b9cfe5b9930fabf16a
2020-01-03 00:47:19 -08:00
Mike Spreitzer
0421cde51b Revised comments about f.knownObjects and added tests for Replace
Kubernetes-commit: 89c615f9c448503b674a0d61bfa8e413cefa4104
2020-01-03 00:44:02 -08:00
Mike Spreitzer
c26559b124 Updated comments on internal abstractions in client-go/tools/cache
The comments on Store and Queue and the FIFOs ceased being accurate
long ago.

Kubernetes-commit: 7a7ccb797e0c977c8049c1490f5a1f92f0bfbbb2
2020-01-02 01:53:17 -08:00
matte21
7d44382a3c Reword modifications for clarity
Kubernetes-commit: 21f59c99232afeae05dcdb4f2d1d156cda6a8a77
2019-12-31 09:48:28 +01:00
matte21
ce6197e865 Fix error in periodic resyncs description
Make it clear that periodic resyncs fire update notifications, not
create notifications as the old comments incorrectly stated.

Kubernetes-commit: 3ae8c864de24a2ad42321c9cbd71099a2b6dcef3
2019-10-28 14:23:37 +01:00
matte21
85843e6e02 Clarify that OnUpdate can mask delete and recreate
Kubernetes-commit: ff543ddfc09adf3d0abdf42f9d9fbd57c3ab4b43
2019-10-28 14:12:22 +01:00
wojtekt
f229b70415 Don't paginate in listwatch
Kubernetes-commit: 51eb4b50a3a607ba15a215fdcaa50baea5777afb
2020-01-02 20:09:19 +01:00
danielqsj
f67770132d unify alias of api errors under pkg and staging
Kubernetes-commit: 5bc0e26c1902e7e28abfc828de19a2dbb3e492c2
2019-11-12 16:26:59 +08:00
Jordan Liggitt
f8772cd39b Retain objects for a limited lifetime in the mutation cache detector by default
Kubernetes-commit: 81d05e91b5b5e653e20cc6ab620de08abfd0cbc2
2019-11-15 13:59:58 -05:00
Mateusz Matejczyk
d7b4c23325 pager.go: Don't set ResourveVersion on subsequent List calls
Ref. https://github.com/kubernetes/kubernetes/issues/85221#issuecomment-553748143

Kubernetes-commit: 977ca43d640d2a85e199a8a282e2df8ebd88055a
2019-11-14 11:34:59 +01:00
Pete de Zwart
ab63be7642 - Delete backing string set from a threadSafeMap index when the string set length reaches 0.
- Added thread_safe_store_test exercising new index backing string set delete at 0 functionality.

- TestThreadSafeStoreDeleteRemovesEmptySetsFromIndex logic nesting inverted.

- Added test case for usage of an index where post element delete there is non-zero count of elements and expect the set to still exist.

- Fixed date.

- Fixed awprice nits.

- Fix bazel.

Kubernetes-commit: 29a051388a719e0359969b8431de8e38e955e2a6
2019-11-08 16:57:06 +11:00
Joe Betz
a3f022a93c Add HTTP 410 (Gone) status code checks to reflector and relist with RV=''
Kubernetes-commit: e2fe126d485af243d45f06bafd2ca83931881429
2019-10-09 16:45:32 -07:00
Joe Betz
54033229aa Handle expired errors with RV>0 in pager, don't full list if 1st page is expired
Kubernetes-commit: 1f3dc14eea231c90819cbba06f25cb4221236b3f
2019-10-04 17:08:22 -07:00
wojtekt
7d13a606b3 Avoid going back in time in reflector framework
Kubernetes-commit: b2b285a766540278a768dc9e6bd07a3a676ae543
2018-08-29 11:40:25 +02:00
sshukun
cd92d91e0f Fix typo in k8s.io/client-go/tools/cache/index.go
Kubernetes-commit: a0d3e6750ecbc67d017c2c67d0ff6f12e1b0c1f1
2019-10-21 13:30:45 +09:00
Bob Killen
dc265f33cf Prune inactive owners from staging/src/k8s.io/client-go/* OWNERS files.
Kubernetes-commit: 3dc01f32eacb4791b248c22f7db9d6dabbec7869
2019-10-12 19:44:19 -04:00
matte21
cc50c9b333 Remove check causing informers to miss notifications
Fix DeltaFIFO bug that caused the sync delta created by a relist
for object ID X to be dropped if the DeltaFIFO already stored a
Delete delta for X. This caused SharedIndexInformer to miss create
notifications. Also, add unit test to expose the bug.

Kubernetes-commit: 9e4be54895e8c0655408b4766cd78de17b6d5b7c
2019-10-14 18:19:05 +02:00
Maru Newby
ab4e4fccf4 Add support for type checking Unstructured via GVK in reflector
It was previously possible to instantiate `Reflector` with
`*unstructured.Unstructured` as the expected type but this did not
support checking that event objects were of the correct API
type (e.g. if event object was `v1.Pod` in `Unstructured` form but
`v1.Service` was expected). This commit adds support for providing a
GVK via an `Unstructured` expected type to compare with the GVK of
event objects. The GVK will also be used in reflector log output.

Kubernetes-commit: 237dbfd8ad322dfcad4bd4d5345368480c22d82f
2019-09-24 01:20:40 +00:00
RainbowMango
e990876d88 Cleanup staticcheck from staging/src/k8s.io/client-go/tools/cache.
Kubernetes-commit: 19e5c8565d444cbb81d554a69960d7144996b05a
2019-09-04 18:32:06 +08:00
Darren Shepherd
6d3b14b468 Check cache is synced first before sleeping
If a cache was already synced, cache.WaitForCacheSync would
always take 100ms to complete because the PollUntil method will
sleep first before checking the condition.  Switching to
PollImmediateUntil will ensure already synced caches will return
immediately.  For code that has, for example, 20 informers, the time
to check the cache was in sync would take at least 2 seconds, but with
this change it can be as fast as you can actually load the data.

Signed-off-by: Darren Shepherd <darren@rancher.com>

Kubernetes-commit: 8a58f332dd62b68ae22c67585002defe6aeb4b04
2019-09-06 16:30:04 -07:00
Yassine TIJANI
7ee6383729 move WaitForCacheSync to the sharedInformer package
Signed-off-by: Yassine TIJANI <ytijani@vmware.com>

Kubernetes-commit: 7e4c3096fe71afc6a23c273b3309ed5db7289d8c
2019-08-16 21:15:53 +02:00
Ted Yu
541253da74 Utilize reflectorMutex in LastSyncResourceVersion
Kubernetes-commit: 4f54538ae8ff7a4e6829bea1479194af87b7833c
2019-08-26 07:46:26 -07:00
likakuli
6a1fb71239 fixes a bug that connection refused error cannot be recognized correctly
Kubernetes-commit: 3cec9098020ecc168573c7ee658282954dac2a2e
2019-08-20 12:18:46 +08:00
Mike Spreitzer
0c0e2ef3a2 Added info requested in review of #77636, and more
Added definition of "collection states" and noted that informer cache
queries are answered against these.

Also added an explicit note that the concept of object identity used
in the contract here does _not_ include ObjectMeta.UID.

Also updated the description of the notifications received by a
client, to account for the fact that a client can be added after the
informer starts running.

Added references to `MetaNamespaceKeyFunc` and
`SplitMetaNamespaceKey`.

Noted that a client must process each notification promptly and added
a referral to workqueue.

Made a couple other minor clarifications and corrections.

Kubernetes-commit: 848301e11a8558f6a90e2fada870a91baace812a
2019-07-25 01:45:22 -04:00
Joe Betz
1522bb2fc6 Replace string concatination with trace fields
Kubernetes-commit: 46a04d50af78e01d06a9879d62cc71fbe892076f
2019-08-02 23:47:24 -07:00
Ted Yu
a865205fb0 Store key in TimestampedEntry
Kubernetes-commit: 69fb4e960f7359641b3503b734acc32af6b05e04
2019-07-29 14:53:49 -07:00
RainbowMango
2b8d87c082 1. Fix lint errors for the whole directory staging/src/k8s.io/client-go/tools/cache;
2. Remove staging/src/k8s.io/client-go/tools/cache from .golint_failures;
3. Fix some typo from comments.

Kubernetes-commit: 0e0e1f7daba0a6ae6dd59df0a1bb643c323ad8cb
2019-07-10 12:00:52 +08:00
wojtekt
a553c2c2cc Enable watch bookmarks in reflector
Kubernetes-commit: 175c07f4e6d3a59bb6d9870c4a4a78c41940b2dd
2019-07-04 13:12:08 +02:00
Odin Ugedal
2ee65257e5 Fix file permissions for non executable files
Normal files should have permissions 644 by default,
and does not require the last bit to be
executable

Signed-off-by: Odin Ugedal <odin@ugedal.com>

Kubernetes-commit: 35cb87f9cf71776e99a970dfff751cd29ba7ebfb
2019-06-14 21:04:39 +02:00
Mikhail Mazurskiy
458bdf6a67 Add missing TestMain() functions
Kubernetes-commit: ca38fba0af59e1193625a18002d0bf1408c4106c
2019-01-30 15:27:39 +11:00
Mikhail Mazurskiy
c90a87409a Cleanup math/rand package usage
Kubernetes-commit: 4ce1fb7d40beb9010e56d60792c4da25e8d86ed0
2018-11-17 16:45:36 +11:00
Haosdent Huang
465553e287 Fix typos.
Kubernetes-commit: 7ce6e7189166e8b284ab44ae1dccd4df1719ab3e
2019-06-09 15:34:53 +08:00
Mike Spreitzer
1ec4b74c7b Fixed and clarified comments and parameter names in index.go (#77633)
* Fixed and clarified comments and parameter names in index.go

Fixed the comment on IndexFunc to say that it returns multiple indexed values.

Clarified the comments and parameter names in the Indexer interface to
consistently use a dichotomy between "storage keys" and "indexed
values".

* Updated comments in index.go based on review by Liggitt

Kubernetes-commit: 4160909495626262ae514bab30fe81a3ff869d39
2019-06-26 04:54:20 +00:00
Sally O'Malley
23e6ea699e Modify klog Warning 'The resourceVersion for the provided watch is too old' to Info.
This warning comes from Reflector watchHandler, from the apiserver error that
indicates a watch was restarted.  This happens when etcd drops the connection
and resources are relisted.  This informs the user that the watchers are
operating properly, so should be logged as Info rather than Warning.

Kubernetes-commit: a953d1542c06456c6fe97121abd99acd352545df
2019-06-13 16:36:06 -04:00
Monis Khan
55984cdeff cache mutation detector: use correct diff function
The cache mutation detector must use a diff function that is
designed to show differences that cause reflect.DeepEqual to return
false.

Signed-off-by: Monis Khan <mkhan@redhat.com>

Kubernetes-commit: dd4f53cd45499687e768de46a15038d61935ab96
2019-06-10 15:47:51 -04:00
Shintaro Murakami
b37f4f2534 Change to use a constant
Kubernetes-commit: 2fcb248354ed5a3bf3154b1a8a0aafa237b2b37c
2019-05-17 18:40:03 +09:00
Mike Spreitzer
76ec0dac1e Fix comment on SharedInformer.Run
The old wording suggested that `Run` only gets the controller started.
Changed the wording to make it clear that `Run` only returns after the
controller is stopped.

Kubernetes-commit: fad9dec758be4dcc49735aea98ada2de46cff9fe
2019-05-04 23:27:42 -04:00
Mike Spreitzer
1dd778153e Made the comment on SharedInformer give a complete description
This comment formerly contained only a contrast with "standard
informer", but there is no longer such a thing so the comment lacked
much important information.

Kubernetes-commit: 121e4741463043eac188bb4eed51f07122262d69
2019-05-09 01:34:02 -04:00
Davanum Srinivas
2537fc5f76 remove unused code
Change-Id: If821920ec8872e326b7d85437ad8d2620807799d

Kubernetes-commit: 7b8c9acc09d51a8f6018eafc49490102ae7cb0c4
2019-04-18 17:22:45 -04:00
fansong.cfs
94d52886d7 add watch bookmark
Kubernetes-commit: d70edd3d39d4430d71c4b7c9adba8df5ba7f16c8
2019-03-19 18:16:23 +08:00
Joe Betz
d43f2ef228 Add resourceVersion=0 paginated list integration test for disabled and enabled watch cache
Kubernetes-commit: e5a4f09ab3ac15815ceb039fbc7f546266855fd6
2019-03-21 11:25:07 -07:00
Joe Betz
d858f18787 Paginate List call performed by Reflector's ListAndWatch call
Kubernetes-commit: 84723c2d3ef5ff5d30aadd1ad72068bf2254358c
2019-03-14 13:26:19 -07:00
wojtekt
49804083df Avoid allocations in ByIndex() function
Kubernetes-commit: 7d46e27db185e5281b718ad964e9c2f8777c2fc8
2019-03-26 14:14:42 +01:00
shinytang6
861da69465 replace time.Now().Sub with time.Since
Kubernetes-commit: 5c9f4d9dc67b28fb31fd95f88448c09150a4cbfb
2019-03-18 23:57:26 +08:00
Clayton Coleman
c48e0dd815 Avoid using %#v for errors when %T is more informative
`%#v` may have significant performance costs in frequently invoked code.

Kubernetes-commit: 435db312e1773d3ad506604219b9b1d00176d6fc
2019-03-21 22:54:06 -04:00
tiffany jernigan
9e76b965b3 Updated client-go expiration cache to take in expiration policies
Kubernetes-commit: bc226a2a899a6d7d85be3b589d20d22c4777f84e
2019-03-22 07:38:35 +00:00
Han Kang
a1320a3a47 Remove reflector metrics as they currently cause a memory leak
Kubernetes-commit: ca096f8069aff73b774c8ef38900dca898c61938
2019-02-26 16:22:24 -08:00