-
Notifications
You must be signed in to change notification settings - Fork 40k
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
Kubelet: Start using the official docker engine-api #23506
Kubelet: Start using the official docker engine-api #23506
Conversation
Labelling this PR as size/XS |
} | ||
|
||
// redirectResponseToOutputStream redirect the response stream to stdout and stderr. When tty is true, all stream will | ||
// only be redirect to stdout. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
s/redirect/redirected
GCE e2e build/test passed for commit bd3df7a975ee617fff05156afcdabf37fbfe4b9d. |
bd3df7a
to
c8fa0ab
Compare
GCE e2e build/test passed for commit c8fa0ab13d8f15fc843dcc0f80a02aa86b05f7c7. |
return | ||
} | ||
|
||
func (d *KubeDockerClient) StartContainer(id string, _ *docker.HostConfig) (err error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: Why have an unused arg? Is it to avoid updating existing code?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice work @Random-Liu!!! |
@vishh Thanks for your review!!! |
// 3) Stabilize the DockerInterface. The engine-api is still under active development, the interface | ||
// is not stabilized yet. However, the DockerInterface is used in many files in Kubernetes, we may | ||
// not want to change the interface frequently. With this layer, we can port the engine api to the | ||
// DockerInterface to avoid changing DockerInterface as far as possible. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
s/as far as/as much as
BTW, we want a better interface. I assume this is just the first step to swap the client, and we'll get to fixing the DockerInterface soon? :-)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If that's the case, suggest adding TODOs
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@yujuhong Yeah, this is just the first step to make the following refactoring easier, I'll add a TODO here.
cc @kubernetes/rh-cluster-infra |
if len(dockerEndpoint) > 0 { | ||
glog.Infof("Connecting to docker on %s", dockerEndpoint) | ||
return docker.NewClient(dockerEndpoint) | ||
return dockerapi.NewClient(dockerEndpoint, "", nil, nil) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need to detect the API version here and pass the version string for initialization?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
From engine-api doc, looks like if the version number is empty string, the docker client assume you are talking to the latest API. In this case, do we have issues to talk to docker daemon 1.8.3 release?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@dchen1107 We didn't do that before https://github.com/fsouza/go-dockerclient/blob/master/client.go#L148, but I'm thinking whether we should do that now.
LGTM overall except one question related to compatibility issue. We need to validate that. |
I suggest keeping the |
@yujuhong SGTM, will do that soon. |
Just a suggestion/alternative:
I see pros and cons in both, so I'll leave the decision to you :-) |
Discussed with @Random-Liu offline. We've decided to move on with this PR first, and see if we need to make changes to the interface along the way. |
@dchen1107 I discussed with @caesarxuchao about the apiversion offline.
The statement is ambiguous. In fact, it means that for different docker version, there is a default apiversion (See here). If the client doesn't specify the apiversion, docker daemon will assume it is using the default apiversion. (See here) So as long as kubelet doesn't rely on functionalities which are not consistent in 1.8.x, 1.9.x and 1.10.x, there shouldn't be problem. :) |
GCE e2e build/test passed for commit a6b4378. |
@k8s-bot test this Tests are more than 48 hours old. Re-running tests. |
GCE e2e build/test failed for commit a6b4378. Please reference the list of currently known flakes when examining this failure. If you request a re-test, you must reference the issue describing the flake. |
GCE e2e build/test passed for commit a6b4378. |
@k8s-bot test this [submit-queue is verifying that this PR is safe to merge] |
GCE e2e build/test passed for commit a6b4378. |
@k8s-bot test this [submit-queue is verifying that this PR is safe to merge] |
GCE e2e build/test passed for commit a6b4378. |
Automatic merge from submit-queue |
@Random-Liu @dchen1107 @roberthbailey @fabioy @wonderfly our Jenkins auto test on trusty caught severe breakage caused by this PR. The symptom is: docker daemon is up but kubelet cannot talk with it. I see many occurrences of "Error response from daemon: 400 Bad Request: malformed Host header" error in kubelet.log. We are using docker 1.9.1 (docker API version 1.21) with k8s binary built from master branch HEAD. Is there anything needs to change to adapt to this PR, e.g., kubelet flag or manifest change? |
I know there was a simliar sounding issue when docker daemon was built with golang 1.6 and docker client was <1.10 and build with <1.6.... Let me find that bug. Do we have golang 1.6 in play somewhere? |
@andyzheng0831 Really? Our e2e cluster is just using docker 1.9.1. And we are using the default docker api version (see here) As @eparis mentioned, what is your golang version? |
what version of golang was used to build your 1.9.1. That could explain this issue. |
Our docker was built by golang 1.6 |
bing, there's our problem. moby/moby#20865 Seems like it would be better to just upgrade our client library to whatever version of client library is used by 1.10, which won't set and invalid Host header... |
(or temporary workaround, rebuild docker < 1.10 with golang < 1.6) |
@andyzheng0831 @eparis Thank you very much! It's really important to know this. I'll look into this issue more later today and see how we could solve this. BTW, Kubernetes doesn't support golang 1.6 now, but is trying to do that. (See #22149) |
@Random-Liu thanks for look into it! Please loop me in when you have new discovery. |
Automatic merge from submit-queue Kubelet: Remove nsinit related code and bump up minimum docker apiversion Docker has native exec support after 1.3.x. We never need this code now. As for the apiversion, because Kubernetes supports 1.8.x - 1.10.x now, we should bump up the minimum docker apiversion. @yujuhong I checked the [changes](https://github.com/docker/engine-api/blob/master/types/versions/v1p20/types.go), we are not relying on any of those changes. So #23506 should work with docker 1.8.x+
Automatic merge from submit-queue Kubelet: Refactor container related functions in DockerInterface For #23563. Based on #23506, will rebase after #23506 is merged. The last 4 commits of this PR are new. This PR refactors all container lifecycle related functions in DockerInterface, including: * ListContainers * InspectContainer * CreateContainer * StartContainer * StopContainer * RemoveContainer @kubernetes/sig-node
Automatic merge from submit-queue Fix PullImage and add corresponding node e2e test Fixes #24101. This is a bug introduced by #23506, since ref #23563. The root cause of #24101 is described [here](#24101 (comment)). This PR 1) Fixes #24101 by decoding the messages returned during pulling image, and return error if any of the messages contains error. 2) Add the node e2e test to detect this kind of failure. 3) Get present check out of `ConformanceImage.Remove()` and `ConformanceImage.Pull()`. Because sometimes we may expect error to occur in `PullImage()` and `RemoveImage()`, but even that doesn't happen, the `Present()` check will still return error and let the test pass. @yujuhong @freehan @liangchenye Also /cc @resouer, because he is doing the image related functions refactoring.
For #23563.
This is the first step in the roadmap of switching to docker engine-api.
In this PR, I keep the old
DockerInterface
and implement it with the new engine-api.With this approach, we could switch to engine-api with minimum change, so that we could:
DockerInterface
separately so as to avoid a huge change in one PR.I've tested this PR locally, it passed all the node conformance test:
And it also passed the jenkins gce e2e test:
I'm writing the design document, and will post the switching roadmap in an umbrella issue soon.
@kubernetes/sig-node