From b71beb7ad042795612b78b9419e98369d27105cb Mon Sep 17 00:00:00 2001 From: Madhu Rajanna Date: Tue, 25 Apr 2023 09:38:03 +0200 Subject: [PATCH] util: set pid limit only for nodeserver setting pod limit only for nodeserver for below reasons * We dont execute any commands with CLI anymore in controller service * Controller deployment is not privileged enough to set the pid limits. Signed-off-by: Madhu Rajanna --- cmd/cephcsi.go | 41 +++++++++++++++++++++++------------------ 1 file changed, 23 insertions(+), 18 deletions(-) diff --git a/cmd/cephcsi.go b/cmd/cephcsi.go index 12a09259a..2c57fdd6a 100644 --- a/cmd/cephcsi.go +++ b/cmd/cephcsi.go @@ -208,24 +208,7 @@ func main() { logAndExit(err.Error()) } - // the driver may need a higher PID limit for handling all concurrent requests - if conf.PidLimit != 0 { - currentLimit, pidErr := util.GetPIDLimit() - if pidErr != nil { - klog.Errorf("Failed to get the PID limit, can not reconfigure: %v", pidErr) - } else { - log.DefaultLog("Initial PID limit is set to %d", currentLimit) - err = util.SetPIDLimit(conf.PidLimit) - switch { - case err != nil: - klog.Errorf("Failed to set new PID limit to %d: %v", conf.PidLimit, err) - case conf.PidLimit == -1: - log.DefaultLog("Reconfigured PID limit to %d (max)", conf.PidLimit) - default: - log.DefaultLog("Reconfigured PID limit to %d", conf.PidLimit) - } - } - } + setPIDLimit(&conf) if conf.EnableGRPCMetrics || conf.Vtype == livenessType { // validate metrics endpoint @@ -282,6 +265,28 @@ func main() { os.Exit(0) } +func setPIDLimit(conf *util.Config) { + // set pidLimit only for NodeServer + // the driver may need a higher PID limit for handling all concurrent requests + if conf.IsNodeServer && conf.PidLimit != 0 { + currentLimit, pidErr := util.GetPIDLimit() + if pidErr != nil { + klog.Errorf("Failed to get the PID limit, can not reconfigure: %v", pidErr) + } else { + log.DefaultLog("Initial PID limit is set to %d", currentLimit) + err := util.SetPIDLimit(conf.PidLimit) + switch { + case err != nil: + klog.Errorf("Failed to set new PID limit to %d: %v", conf.PidLimit, err) + case conf.PidLimit == -1: + log.DefaultLog("Reconfigured PID limit to %d (max)", conf.PidLimit) + default: + log.DefaultLog("Reconfigured PID limit to %d", conf.PidLimit) + } + } + } +} + // initControllers will initialize all the controllers. func initControllers() { // Add list of controller here.