Documentation ¶
Index ¶
- func CheckDataConsistency[T runtime.Object, U any](ctx context.Context, identity string, lastSyncedResourceVersion string, ...)
- func CheckListFromCacheDataConsistencyIfRequested[T runtime.Object](ctx context.Context, identity string, listItemsFn ListFunc[T], ...)
- func CheckWatchListFromCacheDataConsistencyIfRequested[T runtime.Object](ctx context.Context, identity string, listItemsFn ListFunc[T], ...)
- func IsDataConsistencyDetectionForListEnabled() bool
- func IsDataConsistencyDetectionForWatchListEnabled() bool
- type ListFunc
- type RetrieveItemsFunc
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CheckDataConsistency ¶
func CheckDataConsistency[T runtime.Object, U any](ctx context.Context, identity string, lastSyncedResourceVersion string, listFn ListFunc[T], listOptions metav1.ListOptions, retrieveItemsFn RetrieveItemsFunc[U])
CheckDataConsistency exists solely for testing purposes. we cannot use checkWatchListDataConsistencyIfRequested because it is guarded by an environmental variable. we cannot manipulate the environmental variable because it will affect other tests in this package.
func CheckListFromCacheDataConsistencyIfRequested ¶
func CheckListFromCacheDataConsistencyIfRequested[T runtime.Object](ctx context.Context, identity string, listItemsFn ListFunc[T], optionsUsedToReceiveList metav1.ListOptions, receivedList runtime.Object)
CheckListFromCacheDataConsistencyIfRequested performs a data consistency check only when the KUBE_LIST_FROM_CACHE_INCONSISTENCY_DETECTOR environment variable was set during a binary startup for requests that have a high chance of being served from the watch-cache.
The consistency check is meant to be enforced only in the CI, not in production. The check ensures that data retrieved by a list api call from the watch-cache is exactly the same as data received by the list api call from etcd.
Note that this function will panic when data inconsistency is detected. This is intentional because we want to catch it in the CI.
Note that this function doesn't examine the ListOptions to determine if the original request has hit the cache because it would be challenging to maintain consistency with the server-side implementation. For simplicity, we assume that the first request retrieved data from the cache (even though this might not be true for some requests) and issue the second call to get data from etcd for comparison.
func CheckWatchListFromCacheDataConsistencyIfRequested ¶
func CheckWatchListFromCacheDataConsistencyIfRequested[T runtime.Object](ctx context.Context, identity string, listItemsFn ListFunc[T], optionsUsedToReceiveList metav1.ListOptions, receivedList runtime.Object)
CheckWatchListFromCacheDataConsistencyIfRequested performs a data consistency check only when the KUBE_WATCHLIST_INCONSISTENCY_DETECTOR environment variable was set during a binary startup.
The consistency check is meant to be enforced only in the CI, not in production. The check ensures that data retrieved by the watch-list api call is exactly the same as data received by the standard list api call against etcd.
Note that this function will panic when data inconsistency is detected. This is intentional because we want to catch it in the CI.
func IsDataConsistencyDetectionForListEnabled ¶ added in v0.32.0
func IsDataConsistencyDetectionForListEnabled() bool
IsDataConsistencyDetectionForListEnabled returns true when the KUBE_LIST_FROM_CACHE_INCONSISTENCY_DETECTOR environment variable was set during a binary startup.
func IsDataConsistencyDetectionForWatchListEnabled ¶
func IsDataConsistencyDetectionForWatchListEnabled() bool
IsDataConsistencyDetectionForWatchListEnabled returns true when the KUBE_WATCHLIST_INCONSISTENCY_DETECTOR environment variable was set during a binary startup.
Types ¶
type RetrieveItemsFunc ¶
type RetrieveItemsFunc[U any] func() []U