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
be7f087a
Commit
be7f087a
authored
May 23, 2018
by
stewart-yu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
do some code clean for cloud-controller manager
parent
9c2e51f3
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
7 deletions
+11
-7
options.go
cmd/cloud-controller-manager/app/options/options.go
+9
-3
options_test.go
cmd/cloud-controller-manager/app/options/options_test.go
+2
-4
No files found.
cmd/cloud-controller-manager/app/options/options.go
View file @
be7f087a
...
...
@@ -45,6 +45,11 @@ import (
"github.com/spf13/pflag"
)
const
(
// CloudControllerManagerUserAgent is the userAgent name when starting cloud-controller managers.
CloudControllerManagerUserAgent
=
"cloud-controller-manager"
)
// CloudControllerManagerOptions is the main context object for the controller manager.
type
CloudControllerManagerOptions
struct
{
CloudProvider
*
cmoptions
.
CloudProviderOptions
...
...
@@ -165,7 +170,7 @@ func (o *CloudControllerManagerOptions) ApplyTo(c *cloudcontrollerconfig.Config,
}
// sync back to component config
// TODO: find more elegant way than sync
h
ing back the values.
// TODO: find more elegant way than syncing back the values.
c
.
ComponentConfig
.
KubeCloudShared
.
Port
=
int32
(
o
.
InsecureServing
.
BindPort
)
c
.
ComponentConfig
.
KubeCloudShared
.
Address
=
o
.
InsecureServing
.
BindAddress
.
String
()
...
...
@@ -213,13 +218,13 @@ func (o *CloudControllerManagerOptions) Validate() error {
}
// Config return a cloud controller manager config objective
func
(
o
CloudControllerManagerOptions
)
Config
()
(
*
cloudcontrollerconfig
.
Config
,
error
)
{
func
(
o
*
CloudControllerManagerOptions
)
Config
()
(
*
cloudcontrollerconfig
.
Config
,
error
)
{
if
err
:=
o
.
Validate
();
err
!=
nil
{
return
nil
,
err
}
c
:=
&
cloudcontrollerconfig
.
Config
{}
if
err
:=
o
.
ApplyTo
(
c
,
"cloud-controller-manager"
);
err
!=
nil
{
if
err
:=
o
.
ApplyTo
(
c
,
CloudControllerManagerUserAgent
);
err
!=
nil
{
return
nil
,
err
}
...
...
@@ -230,5 +235,6 @@ func createRecorder(kubeClient kubernetes.Interface, userAgent string) record.Ev
eventBroadcaster
:=
record
.
NewBroadcaster
()
eventBroadcaster
.
StartLogging
(
glog
.
Infof
)
eventBroadcaster
.
StartRecordingToSink
(
&
v1core
.
EventSinkImpl
{
Interface
:
kubeClient
.
CoreV1
()
.
Events
(
""
)})
// TODO: remove dependence on the legacyscheme
return
eventBroadcaster
.
NewRecorder
(
legacyscheme
.
Scheme
,
v1
.
EventSource
{
Component
:
userAgent
})
}
cmd/cloud-controller-manager/app/options/options_test.go
View file @
be7f087a
...
...
@@ -111,7 +111,6 @@ func TestAddFlags(t *testing.T) {
"--contention-profiling=true"
,
"--controller-start-interval=2m"
,
"--http2-max-streams-per-connection=47"
,
"--min-resync-period=5m"
,
"--kube-api-burst=100"
,
"--kube-api-content-type=application/vnd.kubernetes.protobuf"
,
"--kube-api-qps=50.0"
,
...
...
@@ -122,13 +121,12 @@ func TestAddFlags(t *testing.T) {
"--leader-elect-resource-lock=configmap"
,
"--leader-elect-retry-period=5s"
,
"--master=192.168.4.20"
,
"--min-resync-period=8h"
,
"--min-resync-period=100m"
,
"--node-status-update-frequency=10m"
,
"--port=10000"
,
"--profiling=false"
,
"--node-status-update-frequency=10m"
,
"--route-reconciliation-period=30s"
,
"--secure-port=10001"
,
"--min-resync-period=100m"
,
"--use-service-account-credentials=false"
,
}
f
.
Parse
(
args
)
...
...
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