-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
update docker client method #2714
Conversation
update dockerclient.NewClient to dockerclient.NewClientWithOpts and enable client negotiate down to a lower version server version
Thanks for your pull request. It looks like this may be your first contribution to a Google open source project (if not, look below for help). Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). 📝 Please visit https://cla.developers.google.com/ to sign. Once you've signed (or fixed any issues), please reply here with What to do if you already signed the CLAIndividual signers
Corporate signers
ℹ️ Googlers: Go here for more info. |
Hi @JornShen. Thanks for your PR. I'm waiting for a google member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
cc @dims |
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.
cc @bobbypage
LGTM!
@googlebot I signed it! |
Thanks for the fix, LGTM! |
/ok-to-test |
What type of PR is this?
/kind bug
/kind cleanup
What this PR does / why we need it:
dockerclient.NewClient
has been deprecated. And change to recommended public methodsdockerclient.NewClientWithOpts
.using WithAPIVersionNegotiation() makes the Docker client negotiate down to a lower version if Docker's current API version is newer than the server version.
ref: kubelet: pod metrics not visible with Docker 18 (19.03 works)
After kubernetes/kubernetes#89687 merged(docker client dependency update to newer), We find that kubelet failed to register cadvisor docker factory when we use k8s v1.19 with docker 18.X. And info as fellow:
The error
Registration of the docker container factory
is fromcadvisor/container/factory.go
Lines 160 to 163 in 0f8972f
the error
failed to validate
is fromcadvisor/container/docker/docker.go
Lines 124 to 127 in 0f8972f
we find in advisor, docker client is created by
Client()
. And it seems no negotiating to old server version if we use deprecatedNewClient
with higher docker client version.cadvisor/container/docker/client.go
Lines 55 to 58 in 0f8972f
what does this PR do:
update dockerclient.NewClient to dockerclient.NewClientWithOpts
and enable client negotiate down to a lower version server version.