-
Notifications
You must be signed in to change notification settings - Fork 575
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
add kubelet client for Pod resource info #231
add kubelet client for Pod resource info #231
Conversation
Pull Request Test Coverage Report for Build 729
💛 - Coveralls |
1ba9062
to
cc5c0f5
Compare
This brings in a ton of vendored deps, +2million lines. Are we really sure we need all those deps? |
7304cfa
to
32a3a7c
Compare
This PR has following dependencies:
So, I've added only these sub-packages in glide.yaml with correct version then run |
Hi @ahalim-intel , How about to use '--skip-test' option in glide? It may reduce dependent packages. |
Actually glide '--skip-test' is counter-intuitive. It does the opposite. From 'glide up --help':
I've tried it anyway and it didn't change the vendor/ at all. |
Folks, what is the status of this PR? |
32a3a7c
to
b18c5c4
Compare
/lgtm, as long as we get the backwards compat questions answered. |
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.
@ahalim-intel
|
@s1061123 |
Tomo, just want to mention that checkpoint file is a temporary solution for getting device information from kubelet and it will be deprecated in future kube releases. we'd like to switch to kubelet endpoint with kube-1.13 and 1.13+. This feature is mainly used for passing device info to SR-IOV CNI, I dont' know if any other CNI use this feature. I understand that Multus needs maintain backward compatibility, do you know how we can deprecate a feature like checkpoint file in Multus? Like how many kube releases Multus need to maintain backward compat with? |
b18c5c4
to
38c0aae
Compare
adding new imported package dependencies in vendor which is required for Kubelet Pod Resource api client. Change-Id: If6c74598e12af5f8659df69371e72dd064823f49
38c0aae
to
957de54
Compare
957de54
to
032237a
Compare
@zshi-redhat Could you please test this PR ? |
I'm bit confused with the travis test output there. Output from travisci:
If you see the closure variable And running test.sh locally with same file(kubeletclient/kubeletclient_test.go):
|
032237a
to
78db614
Compare
Ok, nevermind it. I've move the variable from there and updated the PR. |
1b0b39d
to
c319f6b
Compare
I ran the following tests with this PR applied to multus master branch, all passed:
|
kubeletclient/kubeletclient.go
Outdated
// Check for kubelet resource API socket file | ||
kubeletSocket = filepath.Join(defaultPodResourcesPath, defaultKubeletSocketFile) | ||
if _, err := os.Stat(kubeletSocket); err != nil { | ||
logging.Errorf("hasKubeletAPIEndpoint(): error looking up kubelet resource api socket file: %q", err) |
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.
Might be good to have a warning message instead of 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.
Might be good to have a warning message instead of error.
Agree! I will change this to Printf() as the logging has no Warningf()
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.
+1, Printf() shall be fine.
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.
It looks like the CI failure is due to that kubeletSocket
is overwritten in hasKubeletAPIEndpoint
to the value of defaultPodResourcesPath
+ defaultKubeletSocketFile
, perhaps we can just set socketDir
and socketName
to the same value of defaultPodResourcesPath
and defaultKubeletSocketFile
.
|
||
func getKubeletClient() (types.ResourceClient, error) { | ||
newClient := &kubeletClient{} | ||
if kubeletSocket == "" { |
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.
This will always be false as kubeletSocket
is set in hasKubeletAPIEndpoint
.
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.
This will always be false as
kubeletSocket
is set inhasKubeletAPIEndpoint
.
Good catch! I've corrected the variable in hasKubeletAPIEndpoint
which should be only local.
kubeletclient/kubeletclient.go
Outdated
|
||
func hasKubeletAPIEndpoint() bool { | ||
// Check for kubelet resource API socket file | ||
kubeletSocket = filepath.Join(defaultPodResourcesPath, defaultKubeletSocketFile) |
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.
why not use the same as util.LocalEndpoint(defaultPodResourcesPath, podresources.Socket)
?
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.
why not use the same as
util.LocalEndpoint(defaultPodResourcesPath, podresources.Socket)
?
util.LocalEndpoint(defaultPodResourcesPath, podresources.Socket)
returns path with unix:// URL scheme prefix. All we need here simple path string.
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.
gotcha, thanks!
kubeletclient/kubeletclient.go
Outdated
) | ||
|
||
var ( | ||
kubeletSocket string |
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.
why this is a global var?
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.
Need this global here for unit-tests to override it.
78db614
to
f92f2da
Compare
This change introduces kubelet client to get allocated device information of a Pod from newly added Kubelet grpc service. For more information please see: [kubernetes/kubernetes#70508](kubernetes/kubernetes#70508) Change-Id: I11e58ccdd52662601f445fa24c7d55c225441efc Signed-off-by: Abdul Halim <abdul.halim@intel.com>
f92f2da
to
97c195b
Compare
@s1061123 @zshi-redhat @dougbtv I've addressed pretty much all the comments and feedback. Also fixed the travis-ci tests. All checks now pass. It's ready to be merged! Thanks everyone for help reviewing/improving this PR... much appreciated! |
/lgtm |
This change introduces kubelet client to get allocated device
information of a Pod from newly added Kubelet grpc service.
For more information please see:
kubernetes/kubernetes#70508
With this kubelet service we no longer need to rely on kubelet
checkpoint file to get device information.
Change-Id: I3ba098cfea9a0e798f065a4d9b39d0085e125407
Signed-off-by: Abdul Halim abdul.halim@intel.com