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:
commit
d968ee9cfd
3 changed files with 5 additions and 6 deletions
|
@ -527,7 +527,7 @@ func (n *NGINXController) OnUpdate(ingressCfg ingress.Configuration) error {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
wp = 1
|
wp = 1
|
||||||
}
|
}
|
||||||
maxOpenFiles := (sysctlFSFileMax() / wp) - 1024
|
maxOpenFiles := (rlimitMaxNumFiles() / wp) - 1024
|
||||||
klog.V(3).Infof("Maximum number of open file descriptors: %d", maxOpenFiles)
|
klog.V(3).Infof("Maximum number of open file descriptors: %d", maxOpenFiles)
|
||||||
if maxOpenFiles < 1024 {
|
if maxOpenFiles < 1024 {
|
||||||
// this means the value of RLIMIT_NOFILE is too low.
|
// this means the value of RLIMIT_NOFILE is too low.
|
||||||
|
|
|
@ -64,9 +64,8 @@ func sysctlSomaxconn() int {
|
||||||
return maxConns
|
return maxConns
|
||||||
}
|
}
|
||||||
|
|
||||||
// sysctlFSFileMax returns the maximum number of open file descriptors (value
|
// rlimitMaxNumFiles returns hard limit for RLIMIT_NOFILE
|
||||||
// of fs.file-max) or 0 in case of error.
|
func rlimitMaxNumFiles() int {
|
||||||
func sysctlFSFileMax() int {
|
|
||||||
var rLimit syscall.Rlimit
|
var rLimit syscall.Rlimit
|
||||||
err := syscall.Getrlimit(syscall.RLIMIT_NOFILE, &rLimit)
|
err := syscall.Getrlimit(syscall.RLIMIT_NOFILE, &rLimit)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
@ -20,8 +20,8 @@ import (
|
||||||
"testing"
|
"testing"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestSysctlFSFileMax(t *testing.T) {
|
func TestRlimitMaxNumFiles(t *testing.T) {
|
||||||
i := sysctlFSFileMax()
|
i := rlimitMaxNumFiles()
|
||||||
if i < 1 {
|
if i < 1 {
|
||||||
t.Errorf("returned %v but expected > 0", i)
|
t.Errorf("returned %v but expected > 0", i)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue