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

Replace docker check #3270

Closed
wants to merge 3 commits into from
Closed

Replace docker check #3270

wants to merge 3 commits into from

Conversation

magiconair
Copy link
Contributor

@magiconair magiconair commented Jul 14, 2017

This PR drops unused dependencies and rewrites the Docker health check without using the docker client. This removes about 1/3rd of our code base.

See #3254 #3257

magiconair added a commit that referenced this pull request Jul 14, 2017
This patch replaces the Docker client which is used
for health checks with a simplified version tailored
for that purpose.

See #3254
See #3257
Fixes #3270
magiconair added a commit that referenced this pull request Jul 16, 2017
This patch replaces the Docker client which is used
for health checks with a simplified version tailored
for that purpose.

See #3254
See #3257
Fixes #3270
This patch replaces the Docker client which is used
for health checks with a simplified version tailored
for that purpose.

See #3254
See #3257
Fixes #3270
Copy link
Contributor

@slackpad slackpad left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM - noted a few tiny things but I think this is ready to go after those are addressed.

},
"POST /exec/456/start": func(w http.ResponseWriter, r *http.Request) {
w.WriteHeader(200)
fmt.Fprint(w, "01234567890123456789OK") // more than 10 bytes
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You probably meant "20 bytes" here, since that's the output buffer size for this test.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, was playing with 10 bytes but that bit me somewhere else. will fix.

agent/docker.go Outdated
host = DefaultDockerHost
}
p := strings.SplitN(host, "://", 2)
if len(p) == 1 {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since this can come from the outside I'd assert that it's equal to 2. If we have no split (len(p) == 0) this will panic down below.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think that len(p) can ever be zero unless you specify 0 as the last argument. If the split string isn't found you get host back.

agent/docker.go Outdated
Cmd: cmd,
}

uri := fmt.Sprintf("/containers/%s/exec", containerID)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe URL encode the containerID to prevent shenanigans?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sure.

@magiconair magiconair deleted the replace-docker-check branch August 3, 2017 08:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants