Merge pull request #3666 from Shopify/change-legacy-func-name

rename sysctlFSFileMax to rlimitMaxNumFiles to reflect what it actually does
This commit is contained in:
Kubernetes Prow Robot 2019-01-16 02:41:03 -08:00 committed by GitHub
commit d968ee9cfd
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 5 additions and 6 deletions

View file

@ -527,7 +527,7 @@ func (n *NGINXController) OnUpdate(ingressCfg ingress.Configuration) error {
if err != nil {
wp = 1
}
maxOpenFiles := (sysctlFSFileMax() / wp) - 1024
maxOpenFiles := (rlimitMaxNumFiles() / wp) - 1024
klog.V(3).Infof("Maximum number of open file descriptors: %d", maxOpenFiles)
if maxOpenFiles < 1024 {
// this means the value of RLIMIT_NOFILE is too low.

View file

@ -64,9 +64,8 @@ func sysctlSomaxconn() int {
return maxConns
}
// sysctlFSFileMax returns the maximum number of open file descriptors (value
// of fs.file-max) or 0 in case of error.
func sysctlFSFileMax() int {
// rlimitMaxNumFiles returns hard limit for RLIMIT_NOFILE
func rlimitMaxNumFiles() int {
var rLimit syscall.Rlimit
err := syscall.Getrlimit(syscall.RLIMIT_NOFILE, &rLimit)
if err != nil {

View file

@ -20,8 +20,8 @@ import (
"testing"
)
func TestSysctlFSFileMax(t *testing.T) {
i := sysctlFSFileMax()
func TestRlimitMaxNumFiles(t *testing.T) {
i := rlimitMaxNumFiles()
if i < 1 {
t.Errorf("returned %v but expected > 0", i)
}