-
Notifications
You must be signed in to change notification settings - Fork 4.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Backport upstream changes to watch cache enablement #16398
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -80,8 +80,6 @@ import ( | |
"github.com/openshift/origin/pkg/version" | ||
) | ||
|
||
const DefaultWatchCacheSize = 1000 | ||
|
||
// request paths that match this regular expression will be treated as long running | ||
// and not subjected to the default server timeout. | ||
const originLongRunningEndpointsRE = "(/|^)(buildconfigs/.*/instantiatebinary|imagestreamimports)$" | ||
|
@@ -150,7 +148,7 @@ func BuildKubeAPIserverOptions(masterConfig configapi.MasterConfig) (*kapiserver | |
server.Etcd.StorageConfig.KeyFile = masterConfig.EtcdClientInfo.ClientCert.KeyFile | ||
server.Etcd.StorageConfig.CertFile = masterConfig.EtcdClientInfo.ClientCert.CertFile | ||
server.Etcd.StorageConfig.CAFile = masterConfig.EtcdClientInfo.CA | ||
server.Etcd.DefaultWatchCacheSize = DefaultWatchCacheSize | ||
server.Etcd.DefaultWatchCacheSize = 0 | ||
|
||
server.GenericServerRunOptions.CorsAllowedOriginList = masterConfig.CORSAllowedOrigins | ||
server.GenericServerRunOptions.MaxRequestsInFlight = masterConfig.ServingInfo.MaxRequestsInFlight | ||
|
@@ -507,6 +505,20 @@ func buildKubeApiserverConfig( | |
return originLongRunningRequestRE.MatchString(r.URL.Path) || kubeLongRunningFunc(r, requestInfo) | ||
} | ||
|
||
if apiserverOptions.Etcd.EnableWatchCache { | ||
glog.V(2).Infof("Initializing cache sizes based on %dMB limit", apiserverOptions.GenericServerRunOptions.TargetRAMMB) | ||
sizes := cachesize.NewHeuristicWatchCacheSizes(apiserverOptions.GenericServerRunOptions.TargetRAMMB) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. do we set this target RAMMB to anything by default? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
I'm not seeing where we write a default here, which would set all the heuristic ones to zero by default, right? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There's a "min" function on the heuristic so we always get something even at 0 |
||
if userSpecified, err := genericoptions.ParseWatchCacheSizes(apiserverOptions.Etcd.WatchCacheSizes); err == nil { | ||
for resource, size := range userSpecified { | ||
sizes[resource] = size | ||
} | ||
} | ||
apiserverOptions.Etcd.WatchCacheSizes, err = genericoptions.WriteWatchCacheSizes(sizes) | ||
if err != nil { | ||
return nil, err | ||
} | ||
} | ||
|
||
if err := apiserverOptions.Etcd.ApplyWithStorageFactoryTo(storageFactory, genericConfig); err != nil { | ||
return nil, err | ||
} | ||
|
@@ -566,12 +578,6 @@ func buildKubeApiserverConfig( | |
EnableCoreControllers: true, | ||
} | ||
|
||
if apiserverOptions.Etcd.EnableWatchCache { | ||
// TODO(rebase): upstream also does the following: | ||
// cachesize.InitializeWatchCacheSizes(s.GenericServerRunOptions.TargetRAMMB) | ||
cachesize.SetWatchCacheSizes(apiserverOptions.GenericServerRunOptions.WatchCacheSizes) | ||
} | ||
|
||
if kubeApiserverConfig.EnableCoreControllers { | ||
ttl := masterConfig.KubernetesMasterConfig.MasterEndpointReconcileTTL | ||
interval := ttl * 2 / 3 | ||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is what is setting us to "off by default", right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Correct