Skip to content

Commit

Permalink
Merge pull request #722 from aledbf/remove-go-reaper
Browse files Browse the repository at this point in the history
Remove go-reap and use tini as process reaper
  • Loading branch information
aledbf authored May 17, 2017
2 parents bc6112b + 22d63d0 commit b4032f0
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 13 deletions.
4 changes: 0 additions & 4 deletions controllers/nginx/pkg/cmd/controller/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,10 @@ import (
"time"

"github.com/golang/glog"
go_reap "github.com/hashicorp/go-reap"

"k8s.io/ingress/core/pkg/ingress/controller"
)

func main() {
go go_reap.ReapChildren(nil, nil, nil, nil)

// start a new nginx controller
ngx := newNGINXController()
// create a custom Ingress controller using NGINX as backend
Expand Down
4 changes: 1 addition & 3 deletions controllers/nginx/pkg/cmd/controller/nginx.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,6 @@ const (

defaultStatusModule statusModule = "default"
vtsStatusModule statusModule = "vts"

errNoChild = "wait: no child processes"
)

var (
Expand Down Expand Up @@ -354,7 +352,7 @@ func (n NGINXController) testTemplate(cfg []byte) error {
return err
}
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
oe := fmt.Sprintf(`
-------------------------------------------------------------------------------
Expand Down
8 changes: 2 additions & 6 deletions controllers/nginx/pkg/template/template.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ import (
const (
slash = "/"
defBufferSize = 65535
errNoChild = "wait: no child processes"
)

// Template ...
Expand Down Expand Up @@ -102,7 +101,7 @@ func (t *Template) Write(conf config.TemplateConfig) ([]byte, error) {
}

err := t.tmpl.Execute(t.tmplBuf, conf)
if err != nil && err.Error() != errNoChild {
if err != nil {
return nil, err
}

Expand All @@ -112,10 +111,7 @@ func (t *Template) Write(conf config.TemplateConfig) ([]byte, error) {
cmd.Stdin = t.tmplBuf
cmd.Stdout = t.outCmdBuf
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
}

Expand Down
5 changes: 5 additions & 0 deletions controllers/nginx/rootfs/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,11 @@ RUN DEBIAN_FRONTEND=noninteractive apt-get update && apt-get install -y \
--no-install-recommends \
&& 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 . /

CMD ["/nginx-ingress-controller"]

0 comments on commit b4032f0

Please sign in to comment.