Update sysctl method
This commit is contained in:
parent
28db8fb16d
commit
3c3880d28f
2 changed files with 1 additions and 29 deletions
|
@ -19,7 +19,6 @@ package main
|
|||
import (
|
||||
"flag"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"net/http"
|
||||
"net/http/pprof"
|
||||
"os"
|
||||
|
@ -120,8 +119,6 @@ func main() {
|
|||
}
|
||||
}
|
||||
|
||||
checkTemplate()
|
||||
|
||||
lbc, err := newLoadBalancerController(kubeClient, *resyncPeriod,
|
||||
*defaultSvc, *watchNamespace, *nxgConfigMap, *tcpConfigMapName,
|
||||
*udpConfigMapName, *defSSLCertificate, runtimePodInfo)
|
||||
|
@ -188,28 +185,3 @@ func handleSigterm(lbc *loadBalancerController) {
|
|||
glog.Infof("Exiting with %v", exitCode)
|
||||
os.Exit(exitCode)
|
||||
}
|
||||
|
||||
const (
|
||||
defTmpl = "/etc/nginx/template/nginx.tmpl"
|
||||
fallbackTmpl = "/etc/nginx/nginx.tmpl"
|
||||
)
|
||||
|
||||
// checkTemplate verifies the NGINX template exists (file /etc/nginx/template/nginx.tmpl)
|
||||
// If the file does not exists it means:
|
||||
// a. custom docker image
|
||||
// b. standard image using watch-resource sidecar with emptyDir volume
|
||||
// If the file /etc/nginx/nginx.tmpl exists copy the file to /etc/nginx/template/nginx.tmpl
|
||||
// or terminate the execution (It is not possible to start NGINX without a template)
|
||||
func checkTemplate() {
|
||||
_, err := os.Stat(defTmpl)
|
||||
if err != nil {
|
||||
glog.Warningf("error checking template %v: %v", defTmpl, err)
|
||||
data, err := ioutil.ReadFile(fallbackTmpl)
|
||||
if err != nil {
|
||||
glog.Fatalf("error reading template %v: %v", fallbackTmpl, err)
|
||||
}
|
||||
if err = ioutil.WriteFile(defTmpl, data, 0644); err != nil {
|
||||
glog.Fatalf("error copying %v to %v: %v", fallbackTmpl, defTmpl, err)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -271,7 +271,7 @@ func buildRateLimit(input interface{}) []string {
|
|||
// maximum number of connections that can be queued for acceptance
|
||||
// http://nginx.org/en/docs/http/ngx_http_core_module.html#listen
|
||||
func sysctlSomaxconn() int {
|
||||
maxConns, err := sysctl.GetSysctl("net/core/somaxconn")
|
||||
maxConns, err := sysctl.New().GetSysctl("net/core/somaxconn")
|
||||
if err != nil || maxConns < 512 {
|
||||
glog.Warningf("system net.core.somaxconn=%v. Using NGINX default (511)", maxConns)
|
||||
return 511
|
||||
|
|
Loading…
Reference in a new issue