Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
K
k3s
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jacklull
k3s
Commits
91f8c784
Commit
91f8c784
authored
May 27, 2016
by
Alex Robinson
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #21373 from enoodle/read_cadvisor_cloudinfo_in_kubelet
kubelet: reading cloudinfo from cadvisor
parents
782ac14f
7fb82d54
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
0 deletions
+17
-0
kubelet.go
pkg/kubelet/kubelet.go
+17
-0
No files found.
pkg/kubelet/kubelet.go
View file @
91f8c784
...
@@ -1071,6 +1071,11 @@ func (kl *Kubelet) initialNodeStatus() (*api.Node, error) {
...
@@ -1071,6 +1071,11 @@ func (kl *Kubelet) initialNodeStatus() (*api.Node, error) {
}
}
}
else
{
}
else
{
node
.
Spec
.
ExternalID
=
kl
.
hostname
node
.
Spec
.
ExternalID
=
kl
.
hostname
// If no cloud provider is defined - use the one detected by cadvisor
info
,
err
:=
kl
.
GetCachedMachineInfo
()
if
err
==
nil
{
kl
.
updateCloudProviderFromMachineInfo
(
node
,
info
)
}
}
}
if
err
:=
kl
.
setNodeStatus
(
node
);
err
!=
nil
{
if
err
:=
kl
.
setNodeStatus
(
node
);
err
!=
nil
{
return
nil
,
err
return
nil
,
err
...
@@ -3030,6 +3035,18 @@ func (kl *Kubelet) setNodeAddress(node *api.Node) error {
...
@@ -3030,6 +3035,18 @@ func (kl *Kubelet) setNodeAddress(node *api.Node) error {
return
nil
return
nil
}
}
func
(
kl
*
Kubelet
)
updateCloudProviderFromMachineInfo
(
node
*
api
.
Node
,
info
*
cadvisorapi
.
MachineInfo
)
{
if
info
.
CloudProvider
!=
cadvisorapi
.
UnknownProvider
&&
info
.
CloudProvider
!=
cadvisorapi
.
Baremetal
{
// The cloud providers from pkg/cloudprovider/providers/* that update ProviderID
// will use the format of cloudprovider://project/availability_zone/instance_name
// here we only have the cloudprovider and the instance name so we leave project
// and availability zone empty for compatibility.
node
.
Spec
.
ProviderID
=
strings
.
ToLower
(
string
(
info
.
CloudProvider
))
+
":////"
+
string
(
info
.
InstanceID
)
}
}
func
(
kl
*
Kubelet
)
setNodeStatusMachineInfo
(
node
*
api
.
Node
)
{
func
(
kl
*
Kubelet
)
setNodeStatusMachineInfo
(
node
*
api
.
Node
)
{
// TODO: Post NotReady if we cannot get MachineInfo from cAdvisor. This needs to start
// TODO: Post NotReady if we cannot get MachineInfo from cAdvisor. This needs to start
// cAdvisor locally, e.g. for test-cmd.sh, and in integration test.
// cAdvisor locally, e.g. for test-cmd.sh, and in integration test.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment