Skip to content

Commit

Permalink
Merge pull request #607 from aledbf/master
Browse files Browse the repository at this point in the history
Allow custom server_names_hash_max_size & server_names_hash_bucket_size
  • Loading branch information
aledbf authored Apr 15, 2017
2 parents 4817ddf + 9994365 commit cd6a212
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 11 deletions.
14 changes: 5 additions & 9 deletions controllers/nginx/pkg/cmd/controller/nginx.go
Original file line number Diff line number Diff line change
Expand Up @@ -341,9 +341,7 @@ func (n *NGINXController) SetListers(lister ingress.StoreLister) {
// if an error is returned means requeue the update
func (n *NGINXController) OnUpdate(ingressCfg ingress.Configuration) ([]byte, error) {
var longestName int
var serverNames int
for _, srv := range ingressCfg.Servers {
serverNames += len([]byte(srv.Hostname))
if longestName < len(srv.Hostname) {
longestName = len(srv.Hostname)
}
Expand All @@ -366,15 +364,13 @@ func (n *NGINXController) OnUpdate(ingressCfg ingress.Configuration) ([]byte, er
// https://trac.nginx.org/nginx/ticket/352
// https://trac.nginx.org/nginx/ticket/631
nameHashBucketSize := nextPowerOf2(longestName)
if nameHashBucketSize > cfg.ServerNameHashBucketSize {
glog.V(3).Infof("adjusting ServerNameHashBucketSize variable from %v to %v",
cfg.ServerNameHashBucketSize, nameHashBucketSize)
if cfg.ServerNameHashBucketSize == 0 {
glog.V(3).Infof("adjusting ServerNameHashBucketSize variable to %v", nameHashBucketSize)
cfg.ServerNameHashBucketSize = nameHashBucketSize
}
serverNameHashMaxSize := nextPowerOf2(serverNames)
if serverNameHashMaxSize > cfg.ServerNameHashMaxSize {
glog.V(3).Infof("adjusting ServerNameHashMaxSize variable from %v to %v",
cfg.ServerNameHashMaxSize, serverNameHashMaxSize)
serverNameHashMaxSize := nextPowerOf2(len(ingressCfg.Servers))
if cfg.ServerNameHashMaxSize == 0 {
glog.V(3).Infof("adjusting ServerNameHashMaxSize variable to %v", serverNameHashMaxSize)
cfg.ServerNameHashMaxSize = serverNameHashMaxSize
}

Expand Down
2 changes: 0 additions & 2 deletions controllers/nginx/pkg/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -283,8 +283,6 @@ func NewDefault() Configuration {
MaxWorkerConnections: 16384,
MapHashBucketSize: 64,
ProxyRealIPCIDR: defIPCIDR,
ServerNameHashMaxSize: 512,
ServerNameHashBucketSize: 64,
ShowServerTokens: true,
SSLBufferSize: sslBufferSize,
SSLCiphers: sslCiphers,
Expand Down

0 comments on commit cd6a212

Please sign in to comment.