Merge pull request #722 from aledbf/remove-go-reaper

Remove go-reap and use tini as process reaper
This commit is contained in:
Manuel Alejandro de Brito Fontes 2017-05-17 07:37:23 -04:00 committed by GitHub
commit b4032f0648
4 changed files with 8 additions and 13 deletions

View file

@ -23,14 +23,10 @@ import (
"time" "time"
"github.com/golang/glog" "github.com/golang/glog"
go_reap "github.com/hashicorp/go-reap"
"k8s.io/ingress/core/pkg/ingress/controller" "k8s.io/ingress/core/pkg/ingress/controller"
) )
func main() { func main() {
go go_reap.ReapChildren(nil, nil, nil, nil)
// start a new nginx controller // start a new nginx controller
ngx := newNGINXController() ngx := newNGINXController()
// create a custom Ingress controller using NGINX as backend // create a custom Ingress controller using NGINX as backend

View file

@ -53,8 +53,6 @@ const (
defaultStatusModule statusModule = "default" defaultStatusModule statusModule = "default"
vtsStatusModule statusModule = "vts" vtsStatusModule statusModule = "vts"
errNoChild = "wait: no child processes"
) )
var ( var (
@ -354,7 +352,7 @@ func (n NGINXController) testTemplate(cfg []byte) error {
return err return err
} }
out, err := exec.Command(n.binary, "-t", "-c", tmpfile.Name()).CombinedOutput() out, err := exec.Command(n.binary, "-t", "-c", tmpfile.Name()).CombinedOutput()
if err != nil && err.Error() != errNoChild { if err != nil {
// this error is different from the rest because it must be clear why nginx is not working // this error is different from the rest because it must be clear why nginx is not working
oe := fmt.Sprintf(` oe := fmt.Sprintf(`
------------------------------------------------------------------------------- -------------------------------------------------------------------------------

View file

@ -40,7 +40,6 @@ import (
const ( const (
slash = "/" slash = "/"
defBufferSize = 65535 defBufferSize = 65535
errNoChild = "wait: no child processes"
) )
// Template ... // Template ...
@ -102,7 +101,7 @@ func (t *Template) Write(conf config.TemplateConfig) ([]byte, error) {
} }
err := t.tmpl.Execute(t.tmplBuf, conf) err := t.tmpl.Execute(t.tmplBuf, conf)
if err != nil && err.Error() != errNoChild { if err != nil {
return nil, err return nil, err
} }
@ -112,10 +111,7 @@ func (t *Template) Write(conf config.TemplateConfig) ([]byte, error) {
cmd.Stdin = t.tmplBuf cmd.Stdin = t.tmplBuf
cmd.Stdout = t.outCmdBuf cmd.Stdout = t.outCmdBuf
if err := cmd.Run(); err != nil { if err := cmd.Run(); err != nil {
if err.Error() != errNoChild { glog.Warningf("unexpected error cleaning template: %v", err)
glog.Warningf("unexpected error cleaning template: %v", err)
}
return t.tmplBuf.Bytes(), nil return t.tmplBuf.Bytes(), nil
} }

View file

@ -19,6 +19,11 @@ RUN DEBIAN_FRONTEND=noninteractive apt-get update && apt-get install -y \
--no-install-recommends \ --no-install-recommends \
&& rm -rf /var/lib/apt/lists/* && rm -rf /var/lib/apt/lists/*
RUN curl -sSL -o /sbin/tini https://github.com/krallin/tini/releases/download/v0.14.0/tini-amd64 && \
chmod +x /sbin/tini
ENTRYPOINT ["/sbin/tini", "--"]
COPY . / COPY . /
CMD ["/nginx-ingress-controller"] CMD ["/nginx-ingress-controller"]