Fix golint issues for pkg/util/rlimit

pkg/util/rlimit/rlimit_linux.go:25:1: exported function RlimitNumFiles should have comment or be unexported
pkg/util/rlimit/rlimit_linux.go:25:6: func name will be used as rlimit.RlimitNumFiles by other packages, and that stutters; consider calling this NumFiles
pkg/util/rlimit/rlimit_unsupported.go:25:1: exported function RlimitNumFiles should have comment or be unexported
pkg/util/rlimit/rlimit_unsupported.go:25:6: func name will be used as rlimit.RlimitNumFiles by other packages, and that stutters; consider calling this NumFiles

Ref: https://github.com/kubernetes/kubernetes/issues/68026
This commit is contained in:
Steve Azzopardi 2020-02-25 06:58:28 +01:00
parent 105c0c6951
commit 4936cd476b
No known key found for this signature in database
GPG Key ID: 605BD4706E7DB47D
4 changed files with 5 additions and 4 deletions

View File

@ -1112,7 +1112,7 @@ func RunKubelet(kubeServer *options.KubeletServer, kubeDeps *kubelet.Dependencie
}
podCfg := kubeDeps.PodConfig
if err := rlimit.RlimitNumFiles(uint64(kubeServer.MaxOpenFiles)); err != nil {
if err := rlimit.SetNumFiles(uint64(kubeServer.MaxOpenFiles)); err != nil {
klog.Errorf("Failed to set rlimit on max file handles: %v", err)
}

View File

@ -193,7 +193,6 @@ pkg/util/labels # See previous effort in PR #80685
pkg/util/oom
pkg/util/procfs
pkg/util/removeall
pkg/util/rlimit
pkg/util/selinux
pkg/util/taints
pkg/volume

View File

@ -22,6 +22,7 @@ import (
"golang.org/x/sys/unix"
)
func RlimitNumFiles(maxOpenFiles uint64) error {
// SetNumFiles sets the linux rlimit for the maximum open files.
func SetNumFiles(maxOpenFiles uint64) error {
return unix.Setrlimit(unix.RLIMIT_NOFILE, &unix.Rlimit{Max: maxOpenFiles, Cur: maxOpenFiles})
}

View File

@ -22,6 +22,7 @@ import (
"errors"
)
func RlimitNumFiles(maxOpenFiles uint64) error {
// SetNumFiles sets the rlimit for the maximum open files.
func SetNumFiles(maxOpenFiles uint64) error {
return errors.New("SetRLimit unsupported in this platform")
}