mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-28 14:07:14 +00:00
Merge pull request #13308 from timothysc/watch-cache-disable
Plumb through configuration option to disable watch cache
This commit is contained in:
commit
48b9c365c7
@ -107,6 +107,7 @@ type APIServer struct {
|
|||||||
KubeletConfig client.KubeletConfig
|
KubeletConfig client.KubeletConfig
|
||||||
ClusterName string
|
ClusterName string
|
||||||
EnableProfiling bool
|
EnableProfiling bool
|
||||||
|
EnableWatchCache bool
|
||||||
MaxRequestsInFlight int
|
MaxRequestsInFlight int
|
||||||
MinRequestTimeout int
|
MinRequestTimeout int
|
||||||
LongRunningRequestRE string
|
LongRunningRequestRE string
|
||||||
@ -222,6 +223,8 @@ func (s *APIServer) AddFlags(fs *pflag.FlagSet) {
|
|||||||
fs.Var(&s.RuntimeConfig, "runtime-config", "A set of key=value pairs that describe runtime configuration that may be passed to the apiserver. api/<version> key can be used to turn on/off specific api versions. api/all and api/legacy are special keys to control all and legacy api versions respectively.")
|
fs.Var(&s.RuntimeConfig, "runtime-config", "A set of key=value pairs that describe runtime configuration that may be passed to the apiserver. api/<version> key can be used to turn on/off specific api versions. api/all and api/legacy are special keys to control all and legacy api versions respectively.")
|
||||||
fs.StringVar(&s.ClusterName, "cluster-name", s.ClusterName, "The instance prefix for the cluster")
|
fs.StringVar(&s.ClusterName, "cluster-name", s.ClusterName, "The instance prefix for the cluster")
|
||||||
fs.BoolVar(&s.EnableProfiling, "profiling", true, "Enable profiling via web interface host:port/debug/pprof/")
|
fs.BoolVar(&s.EnableProfiling, "profiling", true, "Enable profiling via web interface host:port/debug/pprof/")
|
||||||
|
// TODO: enable cache in integration tests.
|
||||||
|
fs.BoolVar(&s.EnableWatchCache, "watch-cache", true, "Enable watch caching in the apiserver")
|
||||||
fs.StringVar(&s.ExternalHost, "external-hostname", "", "The hostname to use when generating externalized URLs for this master (e.g. Swagger API Docs.)")
|
fs.StringVar(&s.ExternalHost, "external-hostname", "", "The hostname to use when generating externalized URLs for this master (e.g. Swagger API Docs.)")
|
||||||
fs.IntVar(&s.MaxRequestsInFlight, "max-requests-inflight", 400, "The maximum number of requests in flight at a given time. When the server exceeds this, it rejects requests. Zero for no limit.")
|
fs.IntVar(&s.MaxRequestsInFlight, "max-requests-inflight", 400, "The maximum number of requests in flight at a given time. When the server exceeds this, it rejects requests. Zero for no limit.")
|
||||||
fs.IntVar(&s.MinRequestTimeout, "min-request-timeout", 1800, "An optional field indicating the minimum number of seconds a handler must keep a request open before timing it out. Currently only honored by the watch request handler, which picks a randomized value above this number as the connection timeout, to spread out load.")
|
fs.IntVar(&s.MinRequestTimeout, "min-request-timeout", 1800, "An optional field indicating the minimum number of seconds a handler must keep a request open before timing it out. Currently only honored by the watch request handler, which picks a randomized value above this number as the connection timeout, to spread out load.")
|
||||||
@ -429,6 +432,7 @@ func (s *APIServer) Run(_ []string) error {
|
|||||||
EnableUISupport: true,
|
EnableUISupport: true,
|
||||||
EnableSwaggerSupport: true,
|
EnableSwaggerSupport: true,
|
||||||
EnableProfiling: s.EnableProfiling,
|
EnableProfiling: s.EnableProfiling,
|
||||||
|
EnableWatchCache: s.EnableWatchCache,
|
||||||
EnableIndex: true,
|
EnableIndex: true,
|
||||||
APIPrefix: s.APIPrefix,
|
APIPrefix: s.APIPrefix,
|
||||||
ExpAPIPrefix: s.ExpAPIPrefix,
|
ExpAPIPrefix: s.ExpAPIPrefix,
|
||||||
|
@ -258,6 +258,7 @@ update-period
|
|||||||
upgrade-target
|
upgrade-target
|
||||||
use-kubernetes-cluster-service
|
use-kubernetes-cluster-service
|
||||||
user-whitelist
|
user-whitelist
|
||||||
|
watch-cache
|
||||||
watch-only
|
watch-only
|
||||||
whitelist-override-label
|
whitelist-override-label
|
||||||
www-prefix
|
www-prefix
|
||||||
|
@ -114,6 +114,7 @@ type Config struct {
|
|||||||
// allow downstream consumers to disable the index route
|
// allow downstream consumers to disable the index route
|
||||||
EnableIndex bool
|
EnableIndex bool
|
||||||
EnableProfiling bool
|
EnableProfiling bool
|
||||||
|
EnableWatchCache bool
|
||||||
APIPrefix string
|
APIPrefix string
|
||||||
ExpAPIPrefix string
|
ExpAPIPrefix string
|
||||||
CorsAllowedOriginList []string
|
CorsAllowedOriginList []string
|
||||||
@ -191,6 +192,7 @@ type Master struct {
|
|||||||
enableUISupport bool
|
enableUISupport bool
|
||||||
enableSwaggerSupport bool
|
enableSwaggerSupport bool
|
||||||
enableProfiling bool
|
enableProfiling bool
|
||||||
|
enableWatchCache bool
|
||||||
apiPrefix string
|
apiPrefix string
|
||||||
expAPIPrefix string
|
expAPIPrefix string
|
||||||
corsAllowedOriginList []string
|
corsAllowedOriginList []string
|
||||||
@ -349,6 +351,7 @@ func New(c *Config) *Master {
|
|||||||
enableUISupport: c.EnableUISupport,
|
enableUISupport: c.EnableUISupport,
|
||||||
enableSwaggerSupport: c.EnableSwaggerSupport,
|
enableSwaggerSupport: c.EnableSwaggerSupport,
|
||||||
enableProfiling: c.EnableProfiling,
|
enableProfiling: c.EnableProfiling,
|
||||||
|
enableWatchCache: c.EnableWatchCache,
|
||||||
apiPrefix: c.APIPrefix,
|
apiPrefix: c.APIPrefix,
|
||||||
expAPIPrefix: c.ExpAPIPrefix,
|
expAPIPrefix: c.ExpAPIPrefix,
|
||||||
corsAllowedOriginList: c.CorsAllowedOriginList,
|
corsAllowedOriginList: c.CorsAllowedOriginList,
|
||||||
@ -421,10 +424,9 @@ func NewHandlerContainer(mux *http.ServeMux) *restful.Container {
|
|||||||
|
|
||||||
// init initializes master.
|
// init initializes master.
|
||||||
func (m *Master) init(c *Config) {
|
func (m *Master) init(c *Config) {
|
||||||
enableCacher := true
|
|
||||||
healthzChecks := []healthz.HealthzChecker{}
|
healthzChecks := []healthz.HealthzChecker{}
|
||||||
m.clock = util.RealClock{}
|
m.clock = util.RealClock{}
|
||||||
podStorage := podetcd.NewStorage(c.DatabaseStorage, enableCacher, c.KubeletClient)
|
podStorage := podetcd.NewStorage(c.DatabaseStorage, c.EnableWatchCache, c.KubeletClient)
|
||||||
|
|
||||||
podTemplateStorage := podtemplateetcd.NewREST(c.DatabaseStorage)
|
podTemplateStorage := podtemplateetcd.NewREST(c.DatabaseStorage)
|
||||||
|
|
||||||
@ -440,10 +442,10 @@ func (m *Master) init(c *Config) {
|
|||||||
namespaceStorage, namespaceStatusStorage, namespaceFinalizeStorage := namespaceetcd.NewREST(c.DatabaseStorage)
|
namespaceStorage, namespaceStatusStorage, namespaceFinalizeStorage := namespaceetcd.NewREST(c.DatabaseStorage)
|
||||||
m.namespaceRegistry = namespace.NewRegistry(namespaceStorage)
|
m.namespaceRegistry = namespace.NewRegistry(namespaceStorage)
|
||||||
|
|
||||||
endpointsStorage := endpointsetcd.NewREST(c.DatabaseStorage, enableCacher)
|
endpointsStorage := endpointsetcd.NewREST(c.DatabaseStorage, c.EnableWatchCache)
|
||||||
m.endpointRegistry = endpoint.NewRegistry(endpointsStorage)
|
m.endpointRegistry = endpoint.NewRegistry(endpointsStorage)
|
||||||
|
|
||||||
nodeStorage, nodeStatusStorage := nodeetcd.NewREST(c.DatabaseStorage, enableCacher, c.KubeletClient)
|
nodeStorage, nodeStatusStorage := nodeetcd.NewREST(c.DatabaseStorage, c.EnableWatchCache, c.KubeletClient)
|
||||||
m.nodeRegistry = minion.NewRegistry(nodeStorage)
|
m.nodeRegistry = minion.NewRegistry(nodeStorage)
|
||||||
|
|
||||||
serviceStorage := serviceetcd.NewREST(c.DatabaseStorage)
|
serviceStorage := serviceetcd.NewREST(c.DatabaseStorage)
|
||||||
|
Loading…
Reference in New Issue
Block a user