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
3f1d7669
Commit
3f1d7669
authored
Apr 23, 2018
by
andrewsykim
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
renable nodeipam in kube-controller-manager
parent
c29aa3d2
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
8 additions
and
16 deletions
+8
-16
controllermanager.go
cmd/kube-controller-manager/app/controllermanager.go
+1
-1
core.go
cmd/kube-controller-manager/app/core.go
+5
-3
node_ipam_controller.go
pkg/controller/nodeipam/node_ipam_controller.go
+2
-12
No files found.
cmd/kube-controller-manager/app/controllermanager.go
View file @
3f1d7669
...
@@ -326,9 +326,9 @@ func NewControllerInitializers(loopMode ControllerLoopMode) map[string]InitFunc
...
@@ -326,9 +326,9 @@ func NewControllerInitializers(loopMode ControllerLoopMode) map[string]InitFunc
controllers
[
"ttl"
]
=
startTTLController
controllers
[
"ttl"
]
=
startTTLController
controllers
[
"bootstrapsigner"
]
=
startBootstrapSignerController
controllers
[
"bootstrapsigner"
]
=
startBootstrapSignerController
controllers
[
"tokencleaner"
]
=
startTokenCleanerController
controllers
[
"tokencleaner"
]
=
startTokenCleanerController
controllers
[
"nodeipam"
]
=
startNodeIpamController
if
loopMode
==
IncludeCloudLoops
{
if
loopMode
==
IncludeCloudLoops
{
controllers
[
"service"
]
=
startServiceController
controllers
[
"service"
]
=
startServiceController
controllers
[
"nodeipam"
]
=
startNodeIpamController
controllers
[
"route"
]
=
startRouteController
controllers
[
"route"
]
=
startRouteController
// TODO: volume controller into the IncludeCloudLoops only set.
// TODO: volume controller into the IncludeCloudLoops only set.
// TODO: Separate cluster in cloud check from node lifecycle controller.
// TODO: Separate cluster in cloud check from node lifecycle controller.
...
...
cmd/kube-controller-manager/app/core.go
View file @
3f1d7669
...
@@ -82,7 +82,11 @@ func startServiceController(ctx ControllerContext) (bool, error) {
...
@@ -82,7 +82,11 @@ func startServiceController(ctx ControllerContext) (bool, error) {
func
startNodeIpamController
(
ctx
ControllerContext
)
(
bool
,
error
)
{
func
startNodeIpamController
(
ctx
ControllerContext
)
(
bool
,
error
)
{
var
clusterCIDR
*
net
.
IPNet
=
nil
var
clusterCIDR
*
net
.
IPNet
=
nil
var
serviceCIDR
*
net
.
IPNet
=
nil
var
serviceCIDR
*
net
.
IPNet
=
nil
if
ctx
.
ComponentConfig
.
AllocateNodeCIDRs
{
if
!
ctx
.
ComponentConfig
.
AllocateNodeCIDRs
{
return
false
,
nil
}
var
err
error
var
err
error
if
len
(
strings
.
TrimSpace
(
ctx
.
ComponentConfig
.
ClusterCIDR
))
!=
0
{
if
len
(
strings
.
TrimSpace
(
ctx
.
ComponentConfig
.
ClusterCIDR
))
!=
0
{
_
,
clusterCIDR
,
err
=
net
.
ParseCIDR
(
ctx
.
ComponentConfig
.
ClusterCIDR
)
_
,
clusterCIDR
,
err
=
net
.
ParseCIDR
(
ctx
.
ComponentConfig
.
ClusterCIDR
)
...
@@ -97,7 +101,6 @@ func startNodeIpamController(ctx ControllerContext) (bool, error) {
...
@@ -97,7 +101,6 @@ func startNodeIpamController(ctx ControllerContext) (bool, error) {
glog
.
Warningf
(
"Unsuccessful parsing of service CIDR %v: %v"
,
ctx
.
ComponentConfig
.
ServiceCIDR
,
err
)
glog
.
Warningf
(
"Unsuccessful parsing of service CIDR %v: %v"
,
ctx
.
ComponentConfig
.
ServiceCIDR
,
err
)
}
}
}
}
}
nodeIpamController
,
err
:=
nodeipamcontroller
.
NewNodeIpamController
(
nodeIpamController
,
err
:=
nodeipamcontroller
.
NewNodeIpamController
(
ctx
.
InformerFactory
.
Core
()
.
V1
()
.
Nodes
(),
ctx
.
InformerFactory
.
Core
()
.
V1
()
.
Nodes
(),
...
@@ -106,7 +109,6 @@ func startNodeIpamController(ctx ControllerContext) (bool, error) {
...
@@ -106,7 +109,6 @@ func startNodeIpamController(ctx ControllerContext) (bool, error) {
clusterCIDR
,
clusterCIDR
,
serviceCIDR
,
serviceCIDR
,
int
(
ctx
.
ComponentConfig
.
NodeCIDRMaskSize
),
int
(
ctx
.
ComponentConfig
.
NodeCIDRMaskSize
),
ctx
.
ComponentConfig
.
AllocateNodeCIDRs
,
ipam
.
CIDRAllocatorType
(
ctx
.
ComponentConfig
.
CIDRAllocatorType
),
ipam
.
CIDRAllocatorType
(
ctx
.
ComponentConfig
.
CIDRAllocatorType
),
)
)
if
err
!=
nil
{
if
err
!=
nil
{
...
...
pkg/controller/nodeipam/node_ipam_controller.go
View file @
3f1d7669
...
@@ -58,7 +58,6 @@ const (
...
@@ -58,7 +58,6 @@ const (
// Controller is the controller that manages node ipam state.
// Controller is the controller that manages node ipam state.
type
Controller
struct
{
type
Controller
struct
{
allocateNodeCIDRs
bool
allocatorType
ipam
.
CIDRAllocatorType
allocatorType
ipam
.
CIDRAllocatorType
cloud
cloudprovider
.
Interface
cloud
cloudprovider
.
Interface
...
@@ -88,7 +87,6 @@ func NewNodeIpamController(
...
@@ -88,7 +87,6 @@ func NewNodeIpamController(
clusterCIDR
*
net
.
IPNet
,
clusterCIDR
*
net
.
IPNet
,
serviceCIDR
*
net
.
IPNet
,
serviceCIDR
*
net
.
IPNet
,
nodeCIDRMaskSize
int
,
nodeCIDRMaskSize
int
,
allocateNodeCIDRs
bool
,
allocatorType
ipam
.
CIDRAllocatorType
)
(
*
Controller
,
error
)
{
allocatorType
ipam
.
CIDRAllocatorType
)
(
*
Controller
,
error
)
{
if
kubeClient
==
nil
{
if
kubeClient
==
nil
{
...
@@ -108,14 +106,12 @@ func NewNodeIpamController(
...
@@ -108,14 +106,12 @@ func NewNodeIpamController(
metrics
.
RegisterMetricAndTrackRateLimiterUsage
(
"node_ipam_controller"
,
kubeClient
.
CoreV1
()
.
RESTClient
()
.
GetRateLimiter
())
metrics
.
RegisterMetricAndTrackRateLimiterUsage
(
"node_ipam_controller"
,
kubeClient
.
CoreV1
()
.
RESTClient
()
.
GetRateLimiter
())
}
}
if
allocateNodeCIDRs
{
if
clusterCIDR
==
nil
{
if
clusterCIDR
==
nil
{
glog
.
Fatal
(
"Controller: Must specify clusterCIDR if allocateNodeCIDRs == true.
"
)
glog
.
Fatal
(
"Controller: Must specify --cluster-cidr if --allocate-node-cidrs is set
"
)
}
}
mask
:=
clusterCIDR
.
Mask
mask
:=
clusterCIDR
.
Mask
if
maskSize
,
_
:=
mask
.
Size
();
maskSize
>
nodeCIDRMaskSize
{
if
maskSize
,
_
:=
mask
.
Size
();
maskSize
>
nodeCIDRMaskSize
{
glog
.
Fatal
(
"Controller: Invalid clusterCIDR, mask size of clusterCIDR must be less than nodeCIDRMaskSize."
)
glog
.
Fatal
(
"Controller: Invalid --cluster-cidr, mask size of cluster CIDR must be less than --node-cidr-mask-size"
)
}
}
}
ic
:=
&
Controller
{
ic
:=
&
Controller
{
...
@@ -124,12 +120,10 @@ func NewNodeIpamController(
...
@@ -124,12 +120,10 @@ func NewNodeIpamController(
lookupIP
:
net
.
LookupIP
,
lookupIP
:
net
.
LookupIP
,
clusterCIDR
:
clusterCIDR
,
clusterCIDR
:
clusterCIDR
,
serviceCIDR
:
serviceCIDR
,
serviceCIDR
:
serviceCIDR
,
allocateNodeCIDRs
:
allocateNodeCIDRs
,
allocatorType
:
allocatorType
,
allocatorType
:
allocatorType
,
}
}
// TODO: Abstract this check into a generic controller manager should run method.
// TODO: Abstract this check into a generic controller manager should run method.
if
ic
.
allocateNodeCIDRs
{
if
ic
.
allocatorType
==
ipam
.
IPAMFromClusterAllocatorType
||
ic
.
allocatorType
==
ipam
.
IPAMFromCloudAllocatorType
{
if
ic
.
allocatorType
==
ipam
.
IPAMFromClusterAllocatorType
||
ic
.
allocatorType
==
ipam
.
IPAMFromCloudAllocatorType
{
cfg
:=
&
ipam
.
Config
{
cfg
:=
&
ipam
.
Config
{
Resync
:
ipamResyncInterval
,
Resync
:
ipamResyncInterval
,
...
@@ -157,7 +151,6 @@ func NewNodeIpamController(
...
@@ -157,7 +151,6 @@ func NewNodeIpamController(
return
nil
,
err
return
nil
,
err
}
}
}
}
}
ic
.
nodeLister
=
nodeInformer
.
Lister
()
ic
.
nodeLister
=
nodeInformer
.
Lister
()
ic
.
nodeInformerSynced
=
nodeInformer
.
Informer
()
.
HasSynced
ic
.
nodeInformerSynced
=
nodeInformer
.
Informer
()
.
HasSynced
...
@@ -176,12 +169,9 @@ func (nc *Controller) Run(stopCh <-chan struct{}) {
...
@@ -176,12 +169,9 @@ func (nc *Controller) Run(stopCh <-chan struct{}) {
return
return
}
}
// TODO: Abstract this check into a generic controller manager should run method.
if
nc
.
allocateNodeCIDRs
{
if
nc
.
allocatorType
!=
ipam
.
IPAMFromClusterAllocatorType
&&
nc
.
allocatorType
!=
ipam
.
IPAMFromCloudAllocatorType
{
if
nc
.
allocatorType
!=
ipam
.
IPAMFromClusterAllocatorType
&&
nc
.
allocatorType
!=
ipam
.
IPAMFromCloudAllocatorType
{
go
nc
.
cidrAllocator
.
Run
(
stopCh
)
go
nc
.
cidrAllocator
.
Run
(
stopCh
)
}
}
}
<-
stopCh
<-
stopCh
}
}
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