Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
K
k3s
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jacklull
k3s
Commits
ec64aef2
Unverified
Commit
ec64aef2
authored
Mar 24, 2019
by
Kubernetes Prow Robot
Committed by
GitHub
Mar 24, 2019
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #74321 from yastij/signal-undecorated-storage-event
use cache size to signal undecorated storage
parents
9f15368c
8261d3d9
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
4 additions
and
6 deletions
+4
-6
cachesize.go
pkg/registry/cachesize/cachesize.go
+1
-0
storage.go
pkg/registry/core/event/storage/storage.go
+0
-4
storage_factory.go
...piserver/pkg/registry/generic/registry/storage_factory.go
+1
-1
etcd.go
staging/src/k8s.io/apiserver/pkg/server/options/etcd.go
+2
-1
No files found.
pkg/registry/cachesize/cachesize.go
View file @
ec64aef2
...
@@ -39,6 +39,7 @@ func NewHeuristicWatchCacheSizes(expectedRAMCapacityMB int) map[schema.GroupReso
...
@@ -39,6 +39,7 @@ func NewHeuristicWatchCacheSizes(expectedRAMCapacityMB int) map[schema.GroupReso
watchCacheSizes
[
schema
.
GroupResource
{
Resource
:
"nodes"
}]
=
maxInt
(
5
*
clusterSize
,
1000
)
watchCacheSizes
[
schema
.
GroupResource
{
Resource
:
"nodes"
}]
=
maxInt
(
5
*
clusterSize
,
1000
)
watchCacheSizes
[
schema
.
GroupResource
{
Resource
:
"pods"
}]
=
maxInt
(
50
*
clusterSize
,
1000
)
watchCacheSizes
[
schema
.
GroupResource
{
Resource
:
"pods"
}]
=
maxInt
(
50
*
clusterSize
,
1000
)
watchCacheSizes
[
schema
.
GroupResource
{
Resource
:
"services"
}]
=
maxInt
(
5
*
clusterSize
,
1000
)
watchCacheSizes
[
schema
.
GroupResource
{
Resource
:
"services"
}]
=
maxInt
(
5
*
clusterSize
,
1000
)
watchCacheSizes
[
schema
.
GroupResource
{
Resource
:
"events"
}]
=
0
watchCacheSizes
[
schema
.
GroupResource
{
Resource
:
"apiservices"
,
Group
:
"apiregistration.k8s.io"
}]
=
maxInt
(
5
*
clusterSize
,
1000
)
watchCacheSizes
[
schema
.
GroupResource
{
Resource
:
"apiservices"
,
Group
:
"apiregistration.k8s.io"
}]
=
maxInt
(
5
*
clusterSize
,
1000
)
return
watchCacheSizes
return
watchCacheSizes
}
}
...
...
pkg/registry/core/event/storage/storage.go
View file @
ec64aef2
...
@@ -40,10 +40,6 @@ func NewREST(optsGetter generic.RESTOptionsGetter, ttl uint64) *REST {
...
@@ -40,10 +40,6 @@ func NewREST(optsGetter generic.RESTOptionsGetter, ttl uint64) *REST {
panic
(
err
)
// TODO: Propagate error up
panic
(
err
)
// TODO: Propagate error up
}
}
// We explicitly do NOT do any decoration here - switching on Cacher
// for events will lead to too high memory consumption.
opts
.
Decorator
=
generic
.
UndecoratedStorage
// TODO use watchCacheSize=-1 to signal UndecoratedStorage
store
:=
&
genericregistry
.
Store
{
store
:=
&
genericregistry
.
Store
{
NewFunc
:
func
()
runtime
.
Object
{
return
&
api
.
Event
{}
},
NewFunc
:
func
()
runtime
.
Object
{
return
&
api
.
Event
{}
},
NewListFunc
:
func
()
runtime
.
Object
{
return
&
api
.
EventList
{}
},
NewListFunc
:
func
()
runtime
.
Object
{
return
&
api
.
EventList
{}
},
...
...
staging/src/k8s.io/apiserver/pkg/registry/generic/registry/storage_factory.go
View file @
ec64aef2
...
@@ -42,7 +42,7 @@ func StorageWithCacher(capacity int) generic.StorageDecorator {
...
@@ -42,7 +42,7 @@ func StorageWithCacher(capacity int) generic.StorageDecorator {
triggerFunc
storage
.
TriggerPublisherFunc
)
(
storage
.
Interface
,
factory
.
DestroyFunc
)
{
triggerFunc
storage
.
TriggerPublisherFunc
)
(
storage
.
Interface
,
factory
.
DestroyFunc
)
{
s
,
d
:=
generic
.
NewRawStorage
(
storageConfig
)
s
,
d
:=
generic
.
NewRawStorage
(
storageConfig
)
if
capacity
=
=
0
{
if
capacity
<
=
0
{
klog
.
V
(
5
)
.
Infof
(
"Storage caching is disabled for %T"
,
objectType
)
klog
.
V
(
5
)
.
Infof
(
"Storage caching is disabled for %T"
,
objectType
)
return
s
,
d
return
s
,
d
}
}
...
...
staging/src/k8s.io/apiserver/pkg/server/options/etcd.go
View file @
ec64aef2
...
@@ -229,6 +229,7 @@ func (f *SimpleRestOptionsFactory) GetRESTOptions(resource schema.GroupResource)
...
@@ -229,6 +229,7 @@ func (f *SimpleRestOptionsFactory) GetRESTOptions(resource schema.GroupResource)
if
!
ok
{
if
!
ok
{
cacheSize
=
f
.
Options
.
DefaultWatchCacheSize
cacheSize
=
f
.
Options
.
DefaultWatchCacheSize
}
}
// depending on cache size this might return an undecorated storage
ret
.
Decorator
=
genericregistry
.
StorageWithCacher
(
cacheSize
)
ret
.
Decorator
=
genericregistry
.
StorageWithCacher
(
cacheSize
)
}
}
return
ret
,
nil
return
ret
,
nil
...
@@ -262,6 +263,7 @@ func (f *StorageFactoryRestOptionsFactory) GetRESTOptions(resource schema.GroupR
...
@@ -262,6 +263,7 @@ func (f *StorageFactoryRestOptionsFactory) GetRESTOptions(resource schema.GroupR
if
!
ok
{
if
!
ok
{
cacheSize
=
f
.
Options
.
DefaultWatchCacheSize
cacheSize
=
f
.
Options
.
DefaultWatchCacheSize
}
}
// depending on cache size this might return an undecorated storage
ret
.
Decorator
=
genericregistry
.
StorageWithCacher
(
cacheSize
)
ret
.
Decorator
=
genericregistry
.
StorageWithCacher
(
cacheSize
)
}
}
...
@@ -285,7 +287,6 @@ func ParseWatchCacheSizes(cacheSizes []string) (map[schema.GroupResource]int, er
...
@@ -285,7 +287,6 @@ func ParseWatchCacheSizes(cacheSizes []string) (map[schema.GroupResource]int, er
if
size
<
0
{
if
size
<
0
{
return
nil
,
fmt
.
Errorf
(
"watch cache size cannot be negative: %s"
,
c
)
return
nil
,
fmt
.
Errorf
(
"watch cache size cannot be negative: %s"
,
c
)
}
}
watchCacheSizes
[
schema
.
ParseGroupResource
(
tokens
[
0
])]
=
size
watchCacheSizes
[
schema
.
ParseGroupResource
(
tokens
[
0
])]
=
size
}
}
return
watchCacheSizes
,
nil
return
watchCacheSizes
,
nil
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment