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
956bbfd1
Commit
956bbfd1
authored
May 18, 2018
by
stewart-yu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
should not ignore err when convert controllermanagerconfiguration api
parent
190ef1e0
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
36 additions
and
17 deletions
+36
-17
controllermanager.go
cmd/cloud-controller-manager/app/controllermanager.go
+5
-1
options.go
cmd/cloud-controller-manager/app/options/options.go
+11
-6
options_test.go
cmd/cloud-controller-manager/app/options/options_test.go
+2
-2
controllermanager.go
cmd/kube-controller-manager/app/controllermanager.go
+5
-1
options.go
cmd/kube-controller-manager/app/options/options.go
+12
-6
options_test.go
cmd/kube-controller-manager/app/options/options_test.go
+1
-1
No files found.
cmd/cloud-controller-manager/app/controllermanager.go
View file @
956bbfd1
...
@@ -54,7 +54,11 @@ const (
...
@@ -54,7 +54,11 @@ const (
// NewCloudControllerManagerCommand creates a *cobra.Command object with default parameters
// NewCloudControllerManagerCommand creates a *cobra.Command object with default parameters
func
NewCloudControllerManagerCommand
()
*
cobra
.
Command
{
func
NewCloudControllerManagerCommand
()
*
cobra
.
Command
{
s
:=
options
.
NewCloudControllerManagerOptions
()
s
,
err
:=
options
.
NewCloudControllerManagerOptions
()
if
err
!=
nil
{
glog
.
Fatalf
(
"unable to initialize command options: %v"
,
err
)
}
cmd
:=
&
cobra
.
Command
{
cmd
:=
&
cobra
.
Command
{
Use
:
"cloud-controller-manager"
,
Use
:
"cloud-controller-manager"
,
Long
:
`The Cloud controller manager is a daemon that embeds
Long
:
`The Cloud controller manager is a daemon that embeds
...
...
cmd/cloud-controller-manager/app/options/options.go
View file @
956bbfd1
...
@@ -67,8 +67,11 @@ type CloudControllerManagerOptions struct {
...
@@ -67,8 +67,11 @@ type CloudControllerManagerOptions struct {
}
}
// NewCloudControllerManagerOptions creates a new ExternalCMServer with a default config.
// NewCloudControllerManagerOptions creates a new ExternalCMServer with a default config.
func
NewCloudControllerManagerOptions
()
*
CloudControllerManagerOptions
{
func
NewCloudControllerManagerOptions
()
(
*
CloudControllerManagerOptions
,
error
)
{
componentConfig
:=
NewDefaultComponentConfig
(
ports
.
InsecureCloudControllerManagerPort
)
componentConfig
,
err
:=
NewDefaultComponentConfig
(
ports
.
InsecureCloudControllerManagerPort
)
if
err
!=
nil
{
return
nil
,
err
}
s
:=
CloudControllerManagerOptions
{
s
:=
CloudControllerManagerOptions
{
CloudProvider
:
&
cmoptions
.
CloudProviderOptions
{},
CloudProvider
:
&
cmoptions
.
CloudProviderOptions
{},
...
@@ -96,11 +99,11 @@ func NewCloudControllerManagerOptions() *CloudControllerManagerOptions {
...
@@ -96,11 +99,11 @@ func NewCloudControllerManagerOptions() *CloudControllerManagerOptions {
// TODO: enable HTTPS by default
// TODO: enable HTTPS by default
s
.
SecureServing
.
BindPort
=
0
s
.
SecureServing
.
BindPort
=
0
return
&
s
return
&
s
,
nil
}
}
// NewDefaultComponentConfig returns cloud-controller manager configuration object.
// NewDefaultComponentConfig returns cloud-controller manager configuration object.
func
NewDefaultComponentConfig
(
insecurePort
int32
)
componentconfig
.
CloudControllerManagerConfiguration
{
func
NewDefaultComponentConfig
(
insecurePort
int32
)
(
componentconfig
.
CloudControllerManagerConfiguration
,
error
)
{
scheme
:=
runtime
.
NewScheme
()
scheme
:=
runtime
.
NewScheme
()
componentconfigv1alpha1
.
AddToScheme
(
scheme
)
componentconfigv1alpha1
.
AddToScheme
(
scheme
)
componentconfig
.
AddToScheme
(
scheme
)
componentconfig
.
AddToScheme
(
scheme
)
...
@@ -109,9 +112,11 @@ func NewDefaultComponentConfig(insecurePort int32) componentconfig.CloudControll
...
@@ -109,9 +112,11 @@ func NewDefaultComponentConfig(insecurePort int32) componentconfig.CloudControll
scheme
.
Default
(
&
versioned
)
scheme
.
Default
(
&
versioned
)
internal
:=
componentconfig
.
CloudControllerManagerConfiguration
{}
internal
:=
componentconfig
.
CloudControllerManagerConfiguration
{}
scheme
.
Convert
(
&
versioned
,
&
internal
,
nil
)
if
err
:=
scheme
.
Convert
(
&
versioned
,
&
internal
,
nil
);
err
!=
nil
{
return
internal
,
err
}
internal
.
KubeCloudShared
.
Port
=
insecurePort
internal
.
KubeCloudShared
.
Port
=
insecurePort
return
internal
return
internal
,
nil
}
}
// AddFlags adds flags for a specific ExternalCMServer to the specified FlagSet
// AddFlags adds flags for a specific ExternalCMServer to the specified FlagSet
...
...
cmd/cloud-controller-manager/app/options/options_test.go
View file @
956bbfd1
...
@@ -32,7 +32,7 @@ import (
...
@@ -32,7 +32,7 @@ import (
)
)
func
TestDefaultFlags
(
t
*
testing
.
T
)
{
func
TestDefaultFlags
(
t
*
testing
.
T
)
{
s
:=
NewCloudControllerManagerOptions
()
s
,
_
:=
NewCloudControllerManagerOptions
()
expected
:=
&
CloudControllerManagerOptions
{
expected
:=
&
CloudControllerManagerOptions
{
CloudProvider
:
&
cmoptions
.
CloudProviderOptions
{
CloudProvider
:
&
cmoptions
.
CloudProviderOptions
{
...
@@ -95,7 +95,7 @@ func TestDefaultFlags(t *testing.T) {
...
@@ -95,7 +95,7 @@ func TestDefaultFlags(t *testing.T) {
func
TestAddFlags
(
t
*
testing
.
T
)
{
func
TestAddFlags
(
t
*
testing
.
T
)
{
f
:=
pflag
.
NewFlagSet
(
"addflagstest"
,
pflag
.
ContinueOnError
)
f
:=
pflag
.
NewFlagSet
(
"addflagstest"
,
pflag
.
ContinueOnError
)
s
:=
NewCloudControllerManagerOptions
()
s
,
_
:=
NewCloudControllerManagerOptions
()
s
.
AddFlags
(
f
)
s
.
AddFlags
(
f
)
args
:=
[]
string
{
args
:=
[]
string
{
...
...
cmd/kube-controller-manager/app/controllermanager.go
View file @
956bbfd1
...
@@ -70,7 +70,11 @@ const (
...
@@ -70,7 +70,11 @@ const (
// NewControllerManagerCommand creates a *cobra.Command object with default parameters
// NewControllerManagerCommand creates a *cobra.Command object with default parameters
func
NewControllerManagerCommand
()
*
cobra
.
Command
{
func
NewControllerManagerCommand
()
*
cobra
.
Command
{
s
:=
options
.
NewKubeControllerManagerOptions
()
s
,
err
:=
options
.
NewKubeControllerManagerOptions
()
if
err
!=
nil
{
glog
.
Fatalf
(
"unable to initialize command options: %v"
,
err
)
}
cmd
:=
&
cobra
.
Command
{
cmd
:=
&
cobra
.
Command
{
Use
:
"kube-controller-manager"
,
Use
:
"kube-controller-manager"
,
Long
:
`The Kubernetes controller manager is a daemon that embeds
Long
:
`The Kubernetes controller manager is a daemon that embeds
...
...
cmd/kube-controller-manager/app/options/options.go
View file @
956bbfd1
...
@@ -90,8 +90,12 @@ type KubeControllerManagerOptions struct {
...
@@ -90,8 +90,12 @@ type KubeControllerManagerOptions struct {
}
}
// NewKubeControllerManagerOptions creates a new KubeControllerManagerOptions with a default config.
// NewKubeControllerManagerOptions creates a new KubeControllerManagerOptions with a default config.
func
NewKubeControllerManagerOptions
()
*
KubeControllerManagerOptions
{
func
NewKubeControllerManagerOptions
()
(
*
KubeControllerManagerOptions
,
error
)
{
componentConfig
:=
NewDefaultComponentConfig
(
ports
.
InsecureKubeControllerManagerPort
)
componentConfig
,
err
:=
NewDefaultComponentConfig
(
ports
.
InsecureKubeControllerManagerPort
)
if
err
!=
nil
{
return
nil
,
err
}
s
:=
KubeControllerManagerOptions
{
s
:=
KubeControllerManagerOptions
{
CloudProvider
:
&
cmoptions
.
CloudProviderOptions
{},
CloudProvider
:
&
cmoptions
.
CloudProviderOptions
{},
Debugging
:
&
cmoptions
.
DebuggingOptions
{},
Debugging
:
&
cmoptions
.
DebuggingOptions
{},
...
@@ -193,11 +197,11 @@ func NewKubeControllerManagerOptions() *KubeControllerManagerOptions {
...
@@ -193,11 +197,11 @@ func NewKubeControllerManagerOptions() *KubeControllerManagerOptions {
s
.
GarbageCollectorController
.
GCIgnoredResources
=
gcIgnoredResources
s
.
GarbageCollectorController
.
GCIgnoredResources
=
gcIgnoredResources
return
&
s
return
&
s
,
nil
}
}
// NewDefaultComponentConfig returns kube-controller manager configuration object.
// NewDefaultComponentConfig returns kube-controller manager configuration object.
func
NewDefaultComponentConfig
(
insecurePort
int32
)
componentconfig
.
KubeControllerManagerConfiguration
{
func
NewDefaultComponentConfig
(
insecurePort
int32
)
(
componentconfig
.
KubeControllerManagerConfiguration
,
error
)
{
scheme
:=
runtime
.
NewScheme
()
scheme
:=
runtime
.
NewScheme
()
componentconfigv1alpha1
.
AddToScheme
(
scheme
)
componentconfigv1alpha1
.
AddToScheme
(
scheme
)
componentconfig
.
AddToScheme
(
scheme
)
componentconfig
.
AddToScheme
(
scheme
)
...
@@ -206,9 +210,11 @@ func NewDefaultComponentConfig(insecurePort int32) componentconfig.KubeControlle
...
@@ -206,9 +210,11 @@ func NewDefaultComponentConfig(insecurePort int32) componentconfig.KubeControlle
scheme
.
Default
(
&
versioned
)
scheme
.
Default
(
&
versioned
)
internal
:=
componentconfig
.
KubeControllerManagerConfiguration
{}
internal
:=
componentconfig
.
KubeControllerManagerConfiguration
{}
scheme
.
Convert
(
&
versioned
,
&
internal
,
nil
)
if
err
:=
scheme
.
Convert
(
&
versioned
,
&
internal
,
nil
);
err
!=
nil
{
return
internal
,
err
}
internal
.
KubeCloudShared
.
Port
=
insecurePort
internal
.
KubeCloudShared
.
Port
=
insecurePort
return
internal
return
internal
,
nil
}
}
// AddFlags adds flags for a specific KubeControllerManagerOptions to the specified FlagSet
// AddFlags adds flags for a specific KubeControllerManagerOptions to the specified FlagSet
...
...
cmd/kube-controller-manager/app/options/options_test.go
View file @
956bbfd1
...
@@ -34,7 +34,7 @@ import (
...
@@ -34,7 +34,7 @@ import (
func
TestAddFlags
(
t
*
testing
.
T
)
{
func
TestAddFlags
(
t
*
testing
.
T
)
{
f
:=
pflag
.
NewFlagSet
(
"addflagstest"
,
pflag
.
ContinueOnError
)
f
:=
pflag
.
NewFlagSet
(
"addflagstest"
,
pflag
.
ContinueOnError
)
s
:=
NewKubeControllerManagerOptions
()
s
,
_
:=
NewKubeControllerManagerOptions
()
s
.
AddFlags
(
f
,
[]
string
{
""
},
[]
string
{
""
})
s
.
AddFlags
(
f
,
[]
string
{
""
},
[]
string
{
""
})
args
:=
[]
string
{
args
:=
[]
string
{
...
...
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