pkg/genericapiserver: cut off pkg/registry/cachesize dependency

This commit is contained in:
Dr. Stefan Schimanski
2017-02-02 13:14:30 +01:00
parent bfe0d50ce8
commit b8142896a7
38 changed files with 89 additions and 8 deletions

View File

@@ -23,6 +23,8 @@ import (
"strings"
"github.com/golang/glog"
"k8s.io/kubernetes/pkg/genericapiserver/registry/generic/registry"
)
type Resource string
@@ -60,9 +62,6 @@ const (
ServiceAccounts Resource = "serviceaccounts"
Services Resource = "services"
StorageClasses Resource = "storageclasses"
// Default value of watch cache size for a resource if not specified.
defaultWatchCacheSize = 100
)
// TODO: This shouldn't be a global variable.
@@ -112,11 +111,11 @@ func SetWatchCacheSizes(cacheSizes []string) {
}
}
func GetWatchCacheSizeByResource(resource Resource) int { // TODO this should use schema.GroupResource for lookups
if value, found := watchCacheSizes[resource]; found {
func GetWatchCacheSizeByResource(resource string) int { // TODO this should use schema.GroupResource for lookups
if value, found := watchCacheSizes[Resource(resource)]; found {
return value
}
return defaultWatchCacheSize
return registry.DefaultWatchCacheSize
}
func maxInt(a, b int) int {