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
d973158a
Commit
d973158a
authored
Nov 21, 2016
by
deads2k
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
make controller manager use specified stop channel
parent
cbd87c3a
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
30 additions
and
29 deletions
+30
-29
controllermanager.go
cmd/kube-controller-manager/app/controllermanager.go
+21
-22
BUILD
pkg/controller/volume/attachdetach/BUILD
+1
-1
attach_detach_controller.go
...ontroller/volume/attachdetach/attach_detach_controller.go
+7
-2
attach_detach_controller_test.go
...ller/volume/attachdetach/attach_detach_controller_test.go
+1
-4
No files found.
cmd/kube-controller-manager/app/controllermanager.go
View file @
d973158a
...
@@ -179,7 +179,7 @@ func Run(s *options.CMServer) error {
...
@@ -179,7 +179,7 @@ func Run(s *options.CMServer) error {
clientBuilder
=
rootClientBuilder
clientBuilder
=
rootClientBuilder
}
}
err
:=
StartControllers
(
s
,
kubeconfig
,
rootClientBuilder
,
clientBuilder
,
stop
,
recorder
)
err
:=
StartControllers
(
s
,
kubeconfig
,
rootClientBuilder
,
clientBuilder
,
stop
)
glog
.
Fatalf
(
"error running controllers: %v"
,
err
)
glog
.
Fatalf
(
"error running controllers: %v"
,
err
)
panic
(
"unreachable"
)
panic
(
"unreachable"
)
}
}
...
@@ -222,7 +222,7 @@ func Run(s *options.CMServer) error {
...
@@ -222,7 +222,7 @@ func Run(s *options.CMServer) error {
panic
(
"unreachable"
)
panic
(
"unreachable"
)
}
}
func
StartControllers
(
s
*
options
.
CMServer
,
kubeconfig
*
restclient
.
Config
,
rootClientBuilder
,
clientBuilder
controller
.
ControllerClientBuilder
,
stop
<-
chan
struct
{}
,
recorder
record
.
EventRecorder
)
error
{
func
StartControllers
(
s
*
options
.
CMServer
,
kubeconfig
*
restclient
.
Config
,
rootClientBuilder
,
clientBuilder
controller
.
ControllerClientBuilder
,
stop
<-
chan
struct
{})
error
{
client
:=
func
(
serviceAccountName
string
)
clientset
.
Interface
{
client
:=
func
(
serviceAccountName
string
)
clientset
.
Interface
{
return
rootClientBuilder
.
ClientOrDie
(
serviceAccountName
)
return
rootClientBuilder
.
ClientOrDie
(
serviceAccountName
)
}
}
...
@@ -254,13 +254,13 @@ func StartControllers(s *options.CMServer, kubeconfig *restclient.Config, rootCl
...
@@ -254,13 +254,13 @@ func StartControllers(s *options.CMServer, kubeconfig *restclient.Config, rootCl
TokenGenerator
:
serviceaccount
.
JWTTokenGenerator
(
privateKey
),
TokenGenerator
:
serviceaccount
.
JWTTokenGenerator
(
privateKey
),
RootCA
:
rootCA
,
RootCA
:
rootCA
,
},
},
)
.
Run
(
int
(
s
.
ConcurrentSATokenSyncs
),
wait
.
NeverS
top
)
)
.
Run
(
int
(
s
.
ConcurrentSATokenSyncs
),
s
top
)
time
.
Sleep
(
wait
.
Jitter
(
s
.
ControllerStartInterval
.
Duration
,
ControllerStartJitter
))
time
.
Sleep
(
wait
.
Jitter
(
s
.
ControllerStartInterval
.
Duration
,
ControllerStartJitter
))
}
}
}
}
go
endpointcontroller
.
NewEndpointController
(
sharedInformers
.
Pods
()
.
Informer
(),
client
(
"endpoint-controller"
))
.
go
endpointcontroller
.
NewEndpointController
(
sharedInformers
.
Pods
()
.
Informer
(),
client
(
"endpoint-controller"
))
.
Run
(
int
(
s
.
ConcurrentEndpointSyncs
),
wait
.
NeverS
top
)
Run
(
int
(
s
.
ConcurrentEndpointSyncs
),
s
top
)
time
.
Sleep
(
wait
.
Jitter
(
s
.
ControllerStartInterval
.
Duration
,
ControllerStartJitter
))
time
.
Sleep
(
wait
.
Jitter
(
s
.
ControllerStartInterval
.
Duration
,
ControllerStartJitter
))
go
replicationcontroller
.
NewReplicationManager
(
go
replicationcontroller
.
NewReplicationManager
(
...
@@ -270,11 +270,11 @@ func StartControllers(s *options.CMServer, kubeconfig *restclient.Config, rootCl
...
@@ -270,11 +270,11 @@ func StartControllers(s *options.CMServer, kubeconfig *restclient.Config, rootCl
replicationcontroller
.
BurstReplicas
,
replicationcontroller
.
BurstReplicas
,
int
(
s
.
LookupCacheSizeForRC
),
int
(
s
.
LookupCacheSizeForRC
),
s
.
EnableGarbageCollector
,
s
.
EnableGarbageCollector
,
)
.
Run
(
int
(
s
.
ConcurrentRCSyncs
),
wait
.
NeverS
top
)
)
.
Run
(
int
(
s
.
ConcurrentRCSyncs
),
s
top
)
time
.
Sleep
(
wait
.
Jitter
(
s
.
ControllerStartInterval
.
Duration
,
ControllerStartJitter
))
time
.
Sleep
(
wait
.
Jitter
(
s
.
ControllerStartInterval
.
Duration
,
ControllerStartJitter
))
go
podgc
.
NewPodGC
(
client
(
"pod-garbage-collector"
),
sharedInformers
.
Pods
()
.
Informer
(),
go
podgc
.
NewPodGC
(
client
(
"pod-garbage-collector"
),
sharedInformers
.
Pods
()
.
Informer
(),
int
(
s
.
TerminatedPodGCThreshold
))
.
Run
(
wait
.
NeverS
top
)
int
(
s
.
TerminatedPodGCThreshold
))
.
Run
(
s
top
)
time
.
Sleep
(
wait
.
Jitter
(
s
.
ControllerStartInterval
.
Duration
,
ControllerStartJitter
))
time
.
Sleep
(
wait
.
Jitter
(
s
.
ControllerStartInterval
.
Duration
,
ControllerStartJitter
))
cloud
,
err
:=
cloudprovider
.
InitCloudProvider
(
s
.
CloudProvider
,
s
.
CloudConfigFile
)
cloud
,
err
:=
cloudprovider
.
InitCloudProvider
(
s
.
CloudProvider
,
s
.
CloudConfigFile
)
...
@@ -342,7 +342,7 @@ func StartControllers(s *options.CMServer, kubeconfig *restclient.Config, rootCl
...
@@ -342,7 +342,7 @@ func StartControllers(s *options.CMServer, kubeconfig *restclient.Config, rootCl
ReplenishmentResyncPeriod
:
ResyncPeriod
(
s
),
ReplenishmentResyncPeriod
:
ResyncPeriod
(
s
),
GroupKindsToReplenish
:
groupKindsToReplenish
,
GroupKindsToReplenish
:
groupKindsToReplenish
,
}
}
go
resourcequotacontroller
.
NewResourceQuotaController
(
resourceQuotaControllerOptions
)
.
Run
(
int
(
s
.
ConcurrentResourceQuotaSyncs
),
wait
.
NeverS
top
)
go
resourcequotacontroller
.
NewResourceQuotaController
(
resourceQuotaControllerOptions
)
.
Run
(
int
(
s
.
ConcurrentResourceQuotaSyncs
),
s
top
)
time
.
Sleep
(
wait
.
Jitter
(
s
.
ControllerStartInterval
.
Duration
,
ControllerStartJitter
))
time
.
Sleep
(
wait
.
Jitter
(
s
.
ControllerStartInterval
.
Duration
,
ControllerStartJitter
))
// If apiserver is not running we should wait for some time and fail only then. This is particularly
// If apiserver is not running we should wait for some time and fail only then. This is particularly
...
@@ -395,7 +395,7 @@ func StartControllers(s *options.CMServer, kubeconfig *restclient.Config, rootCl
...
@@ -395,7 +395,7 @@ func StartControllers(s *options.CMServer, kubeconfig *restclient.Config, rootCl
}
}
}
}
namespaceController
:=
namespacecontroller
.
NewNamespaceController
(
namespaceKubeClient
,
namespaceClientPool
,
gvrFn
,
s
.
NamespaceSyncPeriod
.
Duration
,
v1
.
FinalizerKubernetes
)
namespaceController
:=
namespacecontroller
.
NewNamespaceController
(
namespaceKubeClient
,
namespaceClientPool
,
gvrFn
,
s
.
NamespaceSyncPeriod
.
Duration
,
v1
.
FinalizerKubernetes
)
go
namespaceController
.
Run
(
int
(
s
.
ConcurrentNamespaceSyncs
),
wait
.
NeverS
top
)
go
namespaceController
.
Run
(
int
(
s
.
ConcurrentNamespaceSyncs
),
s
top
)
time
.
Sleep
(
wait
.
Jitter
(
s
.
ControllerStartInterval
.
Duration
,
ControllerStartJitter
))
time
.
Sleep
(
wait
.
Jitter
(
s
.
ControllerStartInterval
.
Duration
,
ControllerStartJitter
))
groupVersion
:=
"extensions/v1beta1"
groupVersion
:=
"extensions/v1beta1"
...
@@ -407,28 +407,28 @@ func StartControllers(s *options.CMServer, kubeconfig *restclient.Config, rootCl
...
@@ -407,28 +407,28 @@ func StartControllers(s *options.CMServer, kubeconfig *restclient.Config, rootCl
if
containsResource
(
resources
,
"daemonsets"
)
{
if
containsResource
(
resources
,
"daemonsets"
)
{
glog
.
Infof
(
"Starting daemon set controller"
)
glog
.
Infof
(
"Starting daemon set controller"
)
go
daemon
.
NewDaemonSetsController
(
sharedInformers
.
DaemonSets
(),
sharedInformers
.
Pods
(),
sharedInformers
.
Nodes
(),
client
(
"daemon-set-controller"
),
int
(
s
.
LookupCacheSizeForDaemonSet
))
.
go
daemon
.
NewDaemonSetsController
(
sharedInformers
.
DaemonSets
(),
sharedInformers
.
Pods
(),
sharedInformers
.
Nodes
(),
client
(
"daemon-set-controller"
),
int
(
s
.
LookupCacheSizeForDaemonSet
))
.
Run
(
int
(
s
.
ConcurrentDaemonSetSyncs
),
wait
.
NeverS
top
)
Run
(
int
(
s
.
ConcurrentDaemonSetSyncs
),
s
top
)
time
.
Sleep
(
wait
.
Jitter
(
s
.
ControllerStartInterval
.
Duration
,
ControllerStartJitter
))
time
.
Sleep
(
wait
.
Jitter
(
s
.
ControllerStartInterval
.
Duration
,
ControllerStartJitter
))
}
}
if
containsResource
(
resources
,
"jobs"
)
{
if
containsResource
(
resources
,
"jobs"
)
{
glog
.
Infof
(
"Starting job controller"
)
glog
.
Infof
(
"Starting job controller"
)
go
job
.
NewJobController
(
sharedInformers
.
Pods
()
.
Informer
(),
sharedInformers
.
Jobs
(),
client
(
"job-controller"
))
.
go
job
.
NewJobController
(
sharedInformers
.
Pods
()
.
Informer
(),
sharedInformers
.
Jobs
(),
client
(
"job-controller"
))
.
Run
(
int
(
s
.
ConcurrentJobSyncs
),
wait
.
NeverS
top
)
Run
(
int
(
s
.
ConcurrentJobSyncs
),
s
top
)
time
.
Sleep
(
wait
.
Jitter
(
s
.
ControllerStartInterval
.
Duration
,
ControllerStartJitter
))
time
.
Sleep
(
wait
.
Jitter
(
s
.
ControllerStartInterval
.
Duration
,
ControllerStartJitter
))
}
}
if
containsResource
(
resources
,
"deployments"
)
{
if
containsResource
(
resources
,
"deployments"
)
{
glog
.
Infof
(
"Starting deployment controller"
)
glog
.
Infof
(
"Starting deployment controller"
)
go
deployment
.
NewDeploymentController
(
sharedInformers
.
Deployments
(),
sharedInformers
.
ReplicaSets
(),
sharedInformers
.
Pods
(),
client
(
"deployment-controller"
))
.
go
deployment
.
NewDeploymentController
(
sharedInformers
.
Deployments
(),
sharedInformers
.
ReplicaSets
(),
sharedInformers
.
Pods
(),
client
(
"deployment-controller"
))
.
Run
(
int
(
s
.
ConcurrentDeploymentSyncs
),
wait
.
NeverS
top
)
Run
(
int
(
s
.
ConcurrentDeploymentSyncs
),
s
top
)
time
.
Sleep
(
wait
.
Jitter
(
s
.
ControllerStartInterval
.
Duration
,
ControllerStartJitter
))
time
.
Sleep
(
wait
.
Jitter
(
s
.
ControllerStartInterval
.
Duration
,
ControllerStartJitter
))
}
}
if
containsResource
(
resources
,
"replicasets"
)
{
if
containsResource
(
resources
,
"replicasets"
)
{
glog
.
Infof
(
"Starting ReplicaSet controller"
)
glog
.
Infof
(
"Starting ReplicaSet controller"
)
go
replicaset
.
NewReplicaSetController
(
sharedInformers
.
ReplicaSets
(),
sharedInformers
.
Pods
(),
client
(
"replicaset-controller"
),
replicaset
.
BurstReplicas
,
int
(
s
.
LookupCacheSizeForRS
),
s
.
EnableGarbageCollector
)
.
go
replicaset
.
NewReplicaSetController
(
sharedInformers
.
ReplicaSets
(),
sharedInformers
.
Pods
(),
client
(
"replicaset-controller"
),
replicaset
.
BurstReplicas
,
int
(
s
.
LookupCacheSizeForRS
),
s
.
EnableGarbageCollector
)
.
Run
(
int
(
s
.
ConcurrentRSSyncs
),
wait
.
NeverS
top
)
Run
(
int
(
s
.
ConcurrentRSSyncs
),
s
top
)
time
.
Sleep
(
wait
.
Jitter
(
s
.
ControllerStartInterval
.
Duration
,
ControllerStartJitter
))
time
.
Sleep
(
wait
.
Jitter
(
s
.
ControllerStartInterval
.
Duration
,
ControllerStartJitter
))
}
}
}
}
...
@@ -450,7 +450,7 @@ func StartControllers(s *options.CMServer, kubeconfig *restclient.Config, rootCl
...
@@ -450,7 +450,7 @@ func StartControllers(s *options.CMServer, kubeconfig *restclient.Config, rootCl
)
)
replicaCalc
:=
podautoscaler
.
NewReplicaCalculator
(
metricsClient
,
hpaClient
.
Core
())
replicaCalc
:=
podautoscaler
.
NewReplicaCalculator
(
metricsClient
,
hpaClient
.
Core
())
go
podautoscaler
.
NewHorizontalController
(
hpaClient
.
Core
(),
hpaClient
.
Extensions
(),
hpaClient
.
Autoscaling
(),
replicaCalc
,
s
.
HorizontalPodAutoscalerSyncPeriod
.
Duration
)
.
go
podautoscaler
.
NewHorizontalController
(
hpaClient
.
Core
(),
hpaClient
.
Extensions
(),
hpaClient
.
Autoscaling
(),
replicaCalc
,
s
.
HorizontalPodAutoscalerSyncPeriod
.
Duration
)
.
Run
(
wait
.
NeverS
top
)
Run
(
s
top
)
time
.
Sleep
(
wait
.
Jitter
(
s
.
ControllerStartInterval
.
Duration
,
ControllerStartJitter
))
time
.
Sleep
(
wait
.
Jitter
(
s
.
ControllerStartInterval
.
Duration
,
ControllerStartJitter
))
}
}
}
}
...
@@ -462,7 +462,7 @@ func StartControllers(s *options.CMServer, kubeconfig *restclient.Config, rootCl
...
@@ -462,7 +462,7 @@ func StartControllers(s *options.CMServer, kubeconfig *restclient.Config, rootCl
glog
.
Infof
(
"Starting %s apis"
,
groupVersion
)
glog
.
Infof
(
"Starting %s apis"
,
groupVersion
)
if
containsResource
(
resources
,
"poddisruptionbudgets"
)
{
if
containsResource
(
resources
,
"poddisruptionbudgets"
)
{
glog
.
Infof
(
"Starting disruption controller"
)
glog
.
Infof
(
"Starting disruption controller"
)
go
disruption
.
NewDisruptionController
(
sharedInformers
.
Pods
()
.
Informer
(),
client
(
"disruption-controller"
))
.
Run
(
wait
.
NeverS
top
)
go
disruption
.
NewDisruptionController
(
sharedInformers
.
Pods
()
.
Informer
(),
client
(
"disruption-controller"
))
.
Run
(
s
top
)
time
.
Sleep
(
wait
.
Jitter
(
s
.
ControllerStartInterval
.
Duration
,
ControllerStartJitter
))
time
.
Sleep
(
wait
.
Jitter
(
s
.
ControllerStartInterval
.
Duration
,
ControllerStartJitter
))
}
}
}
}
...
@@ -479,7 +479,7 @@ func StartControllers(s *options.CMServer, kubeconfig *restclient.Config, rootCl
...
@@ -479,7 +479,7 @@ func StartControllers(s *options.CMServer, kubeconfig *restclient.Config, rootCl
sharedInformers
.
Pods
()
.
Informer
(),
sharedInformers
.
Pods
()
.
Informer
(),
client
(
"statefulset-controller"
),
client
(
"statefulset-controller"
),
resyncPeriod
,
resyncPeriod
,
)
.
Run
(
1
,
wait
.
NeverS
top
)
)
.
Run
(
1
,
s
top
)
time
.
Sleep
(
wait
.
Jitter
(
s
.
ControllerStartInterval
.
Duration
,
ControllerStartJitter
))
time
.
Sleep
(
wait
.
Jitter
(
s
.
ControllerStartInterval
.
Duration
,
ControllerStartJitter
))
}
}
}
}
...
@@ -493,7 +493,7 @@ func StartControllers(s *options.CMServer, kubeconfig *restclient.Config, rootCl
...
@@ -493,7 +493,7 @@ func StartControllers(s *options.CMServer, kubeconfig *restclient.Config, rootCl
// // TODO: this is a temp fix for allowing kubeClient list v2alpha1 sj, should switch to using clientset
// // TODO: this is a temp fix for allowing kubeClient list v2alpha1 sj, should switch to using clientset
kubeconfig
.
ContentConfig
.
GroupVersion
=
&
schema
.
GroupVersion
{
Group
:
batch
.
GroupName
,
Version
:
"v2alpha1"
}
kubeconfig
.
ContentConfig
.
GroupVersion
=
&
schema
.
GroupVersion
{
Group
:
batch
.
GroupName
,
Version
:
"v2alpha1"
}
go
cronjob
.
NewCronJobController
(
client
(
"cronjob-controller"
))
.
go
cronjob
.
NewCronJobController
(
client
(
"cronjob-controller"
))
.
Run
(
wait
.
NeverS
top
)
Run
(
s
top
)
time
.
Sleep
(
wait
.
Jitter
(
s
.
ControllerStartInterval
.
Duration
,
ControllerStartJitter
))
time
.
Sleep
(
wait
.
Jitter
(
s
.
ControllerStartInterval
.
Duration
,
ControllerStartJitter
))
time
.
Sleep
(
wait
.
Jitter
(
s
.
ControllerStartInterval
.
Duration
,
ControllerStartJitter
))
time
.
Sleep
(
wait
.
Jitter
(
s
.
ControllerStartInterval
.
Duration
,
ControllerStartJitter
))
}
}
...
@@ -515,7 +515,7 @@ func StartControllers(s *options.CMServer, kubeconfig *restclient.Config, rootCl
...
@@ -515,7 +515,7 @@ func StartControllers(s *options.CMServer, kubeconfig *restclient.Config, rootCl
EnableDynamicProvisioning
:
s
.
VolumeConfiguration
.
EnableDynamicProvisioning
,
EnableDynamicProvisioning
:
s
.
VolumeConfiguration
.
EnableDynamicProvisioning
,
}
}
volumeController
:=
persistentvolumecontroller
.
NewController
(
params
)
volumeController
:=
persistentvolumecontroller
.
NewController
(
params
)
volumeController
.
Run
(
wait
.
NeverS
top
)
volumeController
.
Run
(
s
top
)
time
.
Sleep
(
wait
.
Jitter
(
s
.
ControllerStartInterval
.
Duration
,
ControllerStartJitter
))
time
.
Sleep
(
wait
.
Jitter
(
s
.
ControllerStartInterval
.
Duration
,
ControllerStartJitter
))
attachDetachController
,
attachDetachControllerErr
:=
attachDetachController
,
attachDetachControllerErr
:=
...
@@ -526,12 +526,11 @@ func StartControllers(s *options.CMServer, kubeconfig *restclient.Config, rootCl
...
@@ -526,12 +526,11 @@ func StartControllers(s *options.CMServer, kubeconfig *restclient.Config, rootCl
sharedInformers
.
PersistentVolumeClaims
()
.
Informer
(),
sharedInformers
.
PersistentVolumeClaims
()
.
Informer
(),
sharedInformers
.
PersistentVolumes
()
.
Informer
(),
sharedInformers
.
PersistentVolumes
()
.
Informer
(),
cloud
,
cloud
,
ProbeAttachableVolumePlugins
(
s
.
VolumeConfiguration
),
ProbeAttachableVolumePlugins
(
s
.
VolumeConfiguration
))
recorder
)
if
attachDetachControllerErr
!=
nil
{
if
attachDetachControllerErr
!=
nil
{
glog
.
Fatalf
(
"Failed to start attach/detach controller: %v"
,
attachDetachControllerErr
)
glog
.
Fatalf
(
"Failed to start attach/detach controller: %v"
,
attachDetachControllerErr
)
}
}
go
attachDetachController
.
Run
(
wait
.
NeverS
top
)
go
attachDetachController
.
Run
(
s
top
)
time
.
Sleep
(
wait
.
Jitter
(
s
.
ControllerStartInterval
.
Duration
,
ControllerStartJitter
))
time
.
Sleep
(
wait
.
Jitter
(
s
.
ControllerStartInterval
.
Duration
,
ControllerStartJitter
))
groupVersion
=
"certificates.k8s.io/v1alpha1"
groupVersion
=
"certificates.k8s.io/v1alpha1"
...
@@ -552,7 +551,7 @@ func StartControllers(s *options.CMServer, kubeconfig *restclient.Config, rootCl
...
@@ -552,7 +551,7 @@ func StartControllers(s *options.CMServer, kubeconfig *restclient.Config, rootCl
if
err
!=
nil
{
if
err
!=
nil
{
glog
.
Errorf
(
"Failed to start certificate controller: %v"
,
err
)
glog
.
Errorf
(
"Failed to start certificate controller: %v"
,
err
)
}
else
{
}
else
{
go
certController
.
Run
(
1
,
wait
.
NeverS
top
)
go
certController
.
Run
(
1
,
s
top
)
}
}
time
.
Sleep
(
wait
.
Jitter
(
s
.
ControllerStartInterval
.
Duration
,
ControllerStartJitter
))
time
.
Sleep
(
wait
.
Jitter
(
s
.
ControllerStartInterval
.
Duration
,
ControllerStartJitter
))
}
}
...
@@ -582,7 +581,7 @@ func StartControllers(s *options.CMServer, kubeconfig *restclient.Config, rootCl
...
@@ -582,7 +581,7 @@ func StartControllers(s *options.CMServer, kubeconfig *restclient.Config, rootCl
glog
.
Errorf
(
"Failed to start the generic garbage collector: %v"
,
err
)
glog
.
Errorf
(
"Failed to start the generic garbage collector: %v"
,
err
)
}
else
{
}
else
{
workers
:=
int
(
s
.
ConcurrentGCSyncs
)
workers
:=
int
(
s
.
ConcurrentGCSyncs
)
go
garbageCollector
.
Run
(
workers
,
wait
.
NeverS
top
)
go
garbageCollector
.
Run
(
workers
,
s
top
)
}
}
}
}
...
...
pkg/controller/volume/attachdetach/BUILD
View file @
d973158a
...
@@ -19,6 +19,7 @@ go_library(
...
@@ -19,6 +19,7 @@ go_library(
"//pkg/api/v1:go_default_library",
"//pkg/api/v1:go_default_library",
"//pkg/client/cache:go_default_library",
"//pkg/client/cache:go_default_library",
"//pkg/client/clientset_generated/release_1_5:go_default_library",
"//pkg/client/clientset_generated/release_1_5:go_default_library",
"//pkg/client/clientset_generated/release_1_5/typed/core/v1:go_default_library",
"//pkg/client/record:go_default_library",
"//pkg/client/record:go_default_library",
"//pkg/cloudprovider:go_default_library",
"//pkg/cloudprovider:go_default_library",
"//pkg/controller/volume/attachdetach/cache:go_default_library",
"//pkg/controller/volume/attachdetach/cache:go_default_library",
...
@@ -42,7 +43,6 @@ go_test(
...
@@ -42,7 +43,6 @@ go_test(
library = "go_default_library",
library = "go_default_library",
tags = ["automanaged"],
tags = ["automanaged"],
deps = [
deps = [
"//pkg/client/record:go_default_library",
"//pkg/controller/informers:go_default_library",
"//pkg/controller/informers:go_default_library",
"//pkg/controller/volume/attachdetach/testing:go_default_library",
"//pkg/controller/volume/attachdetach/testing:go_default_library",
],
],
...
...
pkg/controller/volume/attachdetach/attach_detach_controller.go
View file @
d973158a
...
@@ -28,6 +28,7 @@ import (
...
@@ -28,6 +28,7 @@ import (
"k8s.io/kubernetes/pkg/api/v1"
"k8s.io/kubernetes/pkg/api/v1"
kcache
"k8s.io/kubernetes/pkg/client/cache"
kcache
"k8s.io/kubernetes/pkg/client/cache"
clientset
"k8s.io/kubernetes/pkg/client/clientset_generated/release_1_5"
clientset
"k8s.io/kubernetes/pkg/client/clientset_generated/release_1_5"
v1core
"k8s.io/kubernetes/pkg/client/clientset_generated/release_1_5/typed/core/v1"
"k8s.io/kubernetes/pkg/client/record"
"k8s.io/kubernetes/pkg/client/record"
"k8s.io/kubernetes/pkg/cloudprovider"
"k8s.io/kubernetes/pkg/cloudprovider"
"k8s.io/kubernetes/pkg/controller/volume/attachdetach/cache"
"k8s.io/kubernetes/pkg/controller/volume/attachdetach/cache"
...
@@ -76,8 +77,7 @@ func NewAttachDetachController(
...
@@ -76,8 +77,7 @@ func NewAttachDetachController(
pvcInformer
kcache
.
SharedInformer
,
pvcInformer
kcache
.
SharedInformer
,
pvInformer
kcache
.
SharedInformer
,
pvInformer
kcache
.
SharedInformer
,
cloud
cloudprovider
.
Interface
,
cloud
cloudprovider
.
Interface
,
plugins
[]
volume
.
VolumePlugin
,
plugins
[]
volume
.
VolumePlugin
)
(
AttachDetachController
,
error
)
{
recorder
record
.
EventRecorder
)
(
AttachDetachController
,
error
)
{
// TODO: The default resyncPeriod for shared informers is 12 hours, this is
// TODO: The default resyncPeriod for shared informers is 12 hours, this is
// unacceptable for the attach/detach controller. For example, if a pod is
// unacceptable for the attach/detach controller. For example, if a pod is
// skipped because the node it is scheduled to didn't set its annotation in
// skipped because the node it is scheduled to didn't set its annotation in
...
@@ -115,6 +115,11 @@ func NewAttachDetachController(
...
@@ -115,6 +115,11 @@ func NewAttachDetachController(
return
nil
,
fmt
.
Errorf
(
"Could not initialize volume plugins for Attach/Detach Controller: %+v"
,
err
)
return
nil
,
fmt
.
Errorf
(
"Could not initialize volume plugins for Attach/Detach Controller: %+v"
,
err
)
}
}
eventBroadcaster
:=
record
.
NewBroadcaster
()
eventBroadcaster
.
StartLogging
(
glog
.
Infof
)
eventBroadcaster
.
StartRecordingToSink
(
&
v1core
.
EventSinkImpl
{
Interface
:
kubeClient
.
Core
()
.
Events
(
""
)})
recorder
:=
eventBroadcaster
.
NewRecorder
(
v1
.
EventSource
{
Component
:
"attachdetach"
})
adc
.
desiredStateOfWorld
=
cache
.
NewDesiredStateOfWorld
(
&
adc
.
volumePluginMgr
)
adc
.
desiredStateOfWorld
=
cache
.
NewDesiredStateOfWorld
(
&
adc
.
volumePluginMgr
)
adc
.
actualStateOfWorld
=
cache
.
NewActualStateOfWorld
(
&
adc
.
volumePluginMgr
)
adc
.
actualStateOfWorld
=
cache
.
NewActualStateOfWorld
(
&
adc
.
volumePluginMgr
)
adc
.
attacherDetacher
=
adc
.
attacherDetacher
=
...
...
pkg/controller/volume/attachdetach/attach_detach_controller_test.go
View file @
d973158a
...
@@ -20,7 +20,6 @@ import (
...
@@ -20,7 +20,6 @@ import (
"testing"
"testing"
"time"
"time"
"k8s.io/kubernetes/pkg/client/record"
"k8s.io/kubernetes/pkg/controller/informers"
"k8s.io/kubernetes/pkg/controller/informers"
controllervolumetesting
"k8s.io/kubernetes/pkg/controller/volume/attachdetach/testing"
controllervolumetesting
"k8s.io/kubernetes/pkg/controller/volume/attachdetach/testing"
)
)
...
@@ -33,7 +32,6 @@ func Test_NewAttachDetachController_Positive(t *testing.T) {
...
@@ -33,7 +32,6 @@ func Test_NewAttachDetachController_Positive(t *testing.T) {
nodeInformer
:=
informers
.
NewNodeInformer
(
fakeKubeClient
,
resyncPeriod
)
nodeInformer
:=
informers
.
NewNodeInformer
(
fakeKubeClient
,
resyncPeriod
)
pvcInformer
:=
informers
.
NewPVCInformer
(
fakeKubeClient
,
resyncPeriod
)
pvcInformer
:=
informers
.
NewPVCInformer
(
fakeKubeClient
,
resyncPeriod
)
pvInformer
:=
informers
.
NewPVInformer
(
fakeKubeClient
,
resyncPeriod
)
pvInformer
:=
informers
.
NewPVInformer
(
fakeKubeClient
,
resyncPeriod
)
fakeRecorder
:=
&
record
.
FakeRecorder
{}
// Act
// Act
_
,
err
:=
NewAttachDetachController
(
_
,
err
:=
NewAttachDetachController
(
...
@@ -43,8 +41,7 @@ func Test_NewAttachDetachController_Positive(t *testing.T) {
...
@@ -43,8 +41,7 @@ func Test_NewAttachDetachController_Positive(t *testing.T) {
pvcInformer
,
pvcInformer
,
pvInformer
,
pvInformer
,
nil
,
/* cloud */
nil
,
/* cloud */
nil
,
/* plugins */
nil
/* plugins */
)
fakeRecorder
)
// Assert
// Assert
if
err
!=
nil
{
if
err
!=
nil
{
...
...
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