Skip to content
Permalink
Browse files

Get file max from fs/file-max. (#2050)

  • Loading branch information...
gyliu513 authored and aledbf committed Feb 8, 2018
1 parent 1947f35 commit d8efd39694c028329ad4f9c7e27531518956df4c
Showing with 4 additions and 6 deletions.
  1. +4 −6 internal/ingress/controller/util.go
@@ -17,8 +17,6 @@ limitations under the License.
package controller

import (
"syscall"

"github.com/golang/glog"

api "k8s.io/api/core/v1"
@@ -57,12 +55,12 @@ func sysctlSomaxconn() int {
// sysctlFSFileMax returns the value of fs.file-max, i.e.
// maximum number of open file descriptors
func sysctlFSFileMax() int {
var rLimit syscall.Rlimit
err := syscall.Getrlimit(syscall.RLIMIT_NOFILE, &rLimit)
fileMax, err := sysctl.New().GetSysctl("fs/file-max")
if err != nil {
glog.Errorf("unexpected error reading system maximum number of open file descriptors (RLIMIT_NOFILE): %v", err)
glog.Errorf("unexpected error reading system maximum number of open file descriptors (fs.file-max): %v", err)
// returning 0 means don't render the value
return 0
}
return int(rLimit.Max)
glog.V(3).Infof("system fs.file-max=%v", fileMax)
return fileMax
}

0 comments on commit d8efd39

Please sign in to comment.
You can’t perform that action at this time.