Merge pull request #1879 from r2d4/map_hash_bucket_size

Automatic merge from submit-queue

Make map_hash_bucket_size configurable

I was getting an error while trying to run the nginx controller in minikube.  This allows this nginx configuration option to be passed in through a configmap.  

The default value depends on the processor's cache line size (32 | 64 | 128), however ServerNameHashBucketSize is determined similarly, so I've set it to the same default (64).

Fixes #1817

ref https://github.com/kubernetes/minikube/issues/611

cc @bprashanth
This commit is contained in:
Kubernetes Submit Queue 2016-11-03 09:39:47 -07:00 committed by GitHub
commit bff5d0e5a2
2 changed files with 7 additions and 0 deletions

View file

@ -59,6 +59,7 @@ http {
types_hash_max_size 2048; types_hash_max_size 2048;
server_names_hash_max_size {{ $cfg.serverNameHashMaxSize }}; server_names_hash_max_size {{ $cfg.serverNameHashMaxSize }};
server_names_hash_bucket_size {{ $cfg.serverNameHashBucketSize }}; server_names_hash_bucket_size {{ $cfg.serverNameHashBucketSize }};
map_hash_bucket_size {{ $cfg.mapHashBucketSize }};
include /etc/nginx/mime.types; include /etc/nginx/mime.types;
default_type text/html; default_type text/html;

View file

@ -141,6 +141,11 @@ type Configuration struct {
// http://nginx.org/en/docs/ngx_core_module.html#worker_connections // http://nginx.org/en/docs/ngx_core_module.html#worker_connections
MaxWorkerConnections int `structs:"max-worker-connections,omitempty"` MaxWorkerConnections int `structs:"max-worker-connections,omitempty"`
// Sets the bucket size for the map variables hash tables.
// Default value depends on the processors cache line size.
// http://nginx.org/en/docs/http/ngx_http_map_module.html#map_hash_bucket_size
MapHashBucketSize int `structs:"map-hash-bucket-size,omitempty"`
// Defines a timeout for establishing a connection with a proxied server. // Defines a timeout for establishing a connection with a proxied server.
// It should be noted that this timeout cannot usually exceed 75 seconds. // It should be noted that this timeout cannot usually exceed 75 seconds.
// http://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_connect_timeout // http://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_connect_timeout
@ -279,6 +284,7 @@ func NewDefault() Configuration {
GzipTypes: gzipTypes, GzipTypes: gzipTypes,
KeepAlive: 75, KeepAlive: 75,
MaxWorkerConnections: 16384, MaxWorkerConnections: 16384,
MapHashBucketSize: 64,
ProxyConnectTimeout: 5, ProxyConnectTimeout: 5,
ProxyRealIPCIDR: defIPCIDR, ProxyRealIPCIDR: defIPCIDR,
ProxyReadTimeout: 60, ProxyReadTimeout: 60,