change nginx process pgid

put restarted nginx process in another process group, just like the normal nginx start did in https://github.com/kubernetes/ingress-nginx/blob/master/internal/ingress/controller/nginx.go#L289
This commit is contained in:
oilbeater 2018-03-07 22:45:15 +08:00
parent 31306658f1
commit 2e1f0b29ea

View file

@ -320,8 +320,12 @@ func (n *NGINXController) Start() {
process.WaitUntilPortIsAvailable(n.cfg.ListenPorts.HTTP)
// release command resources
cmd.Process.Release()
cmd = exec.Command(n.binary, "-c", cfgPath)
// start a new nginx master process if the controller is not being stopped
cmd = exec.Command(n.binary, "-c", cfgPath)
cmd.SysProcAttr = &syscall.SysProcAttr{
Setpgid: true,
Pgid: 0,
}
n.start(cmd)
}
case event := <-n.updateCh.Out():