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
98756203
Commit
98756203
authored
Mar 01, 2017
by
wlan0
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add external cloudprovider to clerly denote the offloading off cloudprovider tasks
parent
61e7d1eb
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
1 deletion
+13
-1
server.go
cmd/kubelet/app/server.go
+1
-1
plugins.go
pkg/cloudprovider/plugins.go
+12
-0
No files found.
cmd/kubelet/app/server.go
View file @
98756203
...
@@ -420,7 +420,7 @@ func run(s *options.KubeletServer, kubeDeps *kubelet.KubeletDeps) (err error) {
...
@@ -420,7 +420,7 @@ func run(s *options.KubeletServer, kubeDeps *kubelet.KubeletDeps) (err error) {
var
externalKubeClient
clientgoclientset
.
Interface
var
externalKubeClient
clientgoclientset
.
Interface
var
cloud
cloudprovider
.
Interface
var
cloud
cloudprovider
.
Interface
if
s
.
CloudProvider
!=
componentconfigv1alpha1
.
AutoDetectCloudProvider
{
if
!
cloudprovider
.
IsExternal
(
s
.
CloudProvider
)
&&
s
.
CloudProvider
!=
componentconfigv1alpha1
.
AutoDetectCloudProvider
{
cloud
,
err
=
cloudprovider
.
InitCloudProvider
(
s
.
CloudProvider
,
s
.
CloudConfigFile
)
cloud
,
err
=
cloudprovider
.
InitCloudProvider
(
s
.
CloudProvider
,
s
.
CloudConfigFile
)
if
err
!=
nil
{
if
err
!=
nil
{
return
err
return
err
...
...
pkg/cloudprovider/plugins.go
View file @
98756203
...
@@ -37,6 +37,8 @@ var (
...
@@ -37,6 +37,8 @@ var (
providers
=
make
(
map
[
string
]
Factory
)
providers
=
make
(
map
[
string
]
Factory
)
)
)
const
externalCloudProvider
=
"external"
// RegisterCloudProvider registers a cloudprovider.Factory by name. This
// RegisterCloudProvider registers a cloudprovider.Factory by name. This
// is expected to happen during app startup.
// is expected to happen during app startup.
func
RegisterCloudProvider
(
name
string
,
cloud
Factory
)
{
func
RegisterCloudProvider
(
name
string
,
cloud
Factory
)
{
...
@@ -85,6 +87,11 @@ func GetCloudProvider(name string, config io.Reader) (Interface, error) {
...
@@ -85,6 +87,11 @@ func GetCloudProvider(name string, config io.Reader) (Interface, error) {
return
f
(
config
)
return
f
(
config
)
}
}
// Detects if the string is an external cloud provider
func
IsExternal
(
name
string
)
bool
{
return
name
==
externalCloudProvider
}
// InitCloudProvider creates an instance of the named cloud provider.
// InitCloudProvider creates an instance of the named cloud provider.
func
InitCloudProvider
(
name
string
,
configFilePath
string
)
(
Interface
,
error
)
{
func
InitCloudProvider
(
name
string
,
configFilePath
string
)
(
Interface
,
error
)
{
var
cloud
Interface
var
cloud
Interface
...
@@ -95,6 +102,11 @@ func InitCloudProvider(name string, configFilePath string) (Interface, error) {
...
@@ -95,6 +102,11 @@ func InitCloudProvider(name string, configFilePath string) (Interface, error) {
return
nil
,
nil
return
nil
,
nil
}
}
if
IsExternal
(
name
)
{
glog
.
Info
(
"External cloud provider specified"
)
return
nil
,
nil
}
if
configFilePath
!=
""
{
if
configFilePath
!=
""
{
var
config
*
os
.
File
var
config
*
os
.
File
config
,
err
=
os
.
Open
(
configFilePath
)
config
,
err
=
os
.
Open
(
configFilePath
)
...
...
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