mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-21 19:01:49 +00:00
Merge pull request #96052 from wojtek-t/fix_watchcache_size
Disable watchcache for events
This commit is contained in:
commit
d16112f76c
@ -677,8 +677,17 @@ func Complete(s *options.ServerRunOptions) (completedServerRunOptions, error) {
|
||||
}
|
||||
|
||||
if s.Etcd.EnableWatchCache {
|
||||
sizes := kubeapiserver.DefaultWatchCacheSizes()
|
||||
// Ensure that overrides parse correctly.
|
||||
if _, err := serveroptions.ParseWatchCacheSizes(s.Etcd.WatchCacheSizes); err != nil {
|
||||
userSpecified, err := serveroptions.ParseWatchCacheSizes(s.Etcd.WatchCacheSizes)
|
||||
if err != nil {
|
||||
return options, err
|
||||
}
|
||||
for resource, size := range userSpecified {
|
||||
sizes[resource] = size
|
||||
}
|
||||
s.Etcd.WatchCacheSizes, err = serveroptions.WriteWatchCacheSizes(sizes)
|
||||
if err != nil {
|
||||
return options, err
|
||||
}
|
||||
}
|
||||
|
@ -49,6 +49,15 @@ var SpecialDefaultResourcePrefixes = map[schema.GroupResource]string{
|
||||
{Group: "policy", Resource: "podsecuritypolicies"}: "podsecuritypolicy",
|
||||
}
|
||||
|
||||
// DefaultWatchCacheSizes defines default resources for which watchcache
|
||||
// should be disabled.
|
||||
func DefaultWatchCacheSizes() map[schema.GroupResource]int {
|
||||
return map[schema.GroupResource]int{
|
||||
{Resource: "events"}: 0,
|
||||
{Group: "events.k8s.io", Resource: "events"}: 0,
|
||||
}
|
||||
}
|
||||
|
||||
// NewStorageFactoryConfig returns a new StorageFactoryConfig set up with necessary resource overrides.
|
||||
func NewStorageFactoryConfig() *StorageFactoryConfig {
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user