mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-24 20:24:09 +00:00
build util function for write sys file
Change-Id: I8f122b4314c1d983e7ba1ce1d66ce876bef0dca9
This commit is contained in:
parent
6306ab00d2
commit
ad89825065
@ -55,7 +55,7 @@ func (realConntracker) SetMax(max int) error {
|
|||||||
}
|
}
|
||||||
// TODO: generify this and sysctl to a new sysfs.WriteInt()
|
// TODO: generify this and sysctl to a new sysfs.WriteInt()
|
||||||
glog.Infof("Setting conntrack hashsize to %d", max/4)
|
glog.Infof("Setting conntrack hashsize to %d", max/4)
|
||||||
return ioutil.WriteFile("/sys/module/nf_conntrack/parameters/hashsize", []byte(strconv.Itoa(max/4)), 0640)
|
return writeIntStringFile("/sys/module/nf_conntrack/parameters/hashsize", max/4)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (realConntracker) SetTCPEstablishedTimeout(seconds int) error {
|
func (realConntracker) SetTCPEstablishedTimeout(seconds int) error {
|
||||||
@ -86,3 +86,7 @@ func isSysFSWritable() (bool, error) {
|
|||||||
}
|
}
|
||||||
return false, nil
|
return false, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func writeIntStringFile(filename string, value int) error {
|
||||||
|
return ioutil.WriteFile(filename, []byte(strconv.Itoa(value)), 0640)
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user