Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove go-reap and use tini as process reaper #722

Merged
merged 1 commit into from
May 17, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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"]