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
816f6d32
Commit
816f6d32
authored
Aug 04, 2016
by
Dominika Hodovska
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Collapse duplicate informer creation paths
parent
3afd8225
Hide whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
40 additions
and
129 deletions
+40
-129
controllermanager.go
cmd/kube-controller-manager/app/controllermanager.go
+4
-4
daemoncontroller.go
pkg/controller/daemon/daemoncontroller.go
+1
-1
endpoints_controller.go
pkg/controller/endpoint/endpoints_controller.go
+1
-1
core.go
pkg/controller/framework/informers/core.go
+11
-81
factory.go
pkg/controller/framework/informers/factory.go
+10
-29
jobcontroller.go
pkg/controller/job/jobcontroller.go
+1
-1
nodecontroller.go
pkg/controller/node/nodecontroller.go
+1
-1
replica_set.go
pkg/controller/replicaset/replica_set.go
+1
-1
replication_controller.go
pkg/controller/replication/replication_controller.go
+2
-2
replenishment_controller.go
pkg/controller/resourcequota/replenishment_controller.go
+1
-1
attach_detach_controller_test.go
...ller/volume/attachdetach/attach_detach_controller_test.go
+4
-4
reconciler_test.go
...troller/volume/attachdetach/reconciler/reconciler_test.go
+1
-1
replicaset_test.go
test/integration/replicaset/replicaset_test.go
+1
-1
replicationcontroller_test.go
...ation/replicationcontroller/replicationcontroller_test.go
+1
-1
No files found.
cmd/kube-controller-manager/app/controllermanager.go
View file @
816f6d32
...
...
@@ -197,10 +197,10 @@ func Run(s *options.CMServer) error {
}
func
StartControllers
(
s
*
options
.
CMServer
,
kubeClient
*
client
.
Client
,
kubeconfig
*
restclient
.
Config
,
stop
<-
chan
struct
{})
error
{
podInformer
:=
informers
.
CreateSharedPodIndex
Informer
(
clientset
.
NewForConfigOrDie
(
restclient
.
AddUserAgent
(
kubeconfig
,
"pod-informer"
)),
ResyncPeriod
(
s
)())
nodeInformer
:=
informers
.
CreateSharedNodeIndex
Informer
(
clientset
.
NewForConfigOrDie
(
restclient
.
AddUserAgent
(
kubeconfig
,
"node-informer"
)),
ResyncPeriod
(
s
)())
pvcInformer
:=
informers
.
CreateSharedPVCIndex
Informer
(
clientset
.
NewForConfigOrDie
(
restclient
.
AddUserAgent
(
kubeconfig
,
"pvc-informer"
)),
ResyncPeriod
(
s
)())
pvInformer
:=
informers
.
CreateSharedPVIndex
Informer
(
clientset
.
NewForConfigOrDie
(
restclient
.
AddUserAgent
(
kubeconfig
,
"pv-informer"
)),
ResyncPeriod
(
s
)())
podInformer
:=
informers
.
NewPod
Informer
(
clientset
.
NewForConfigOrDie
(
restclient
.
AddUserAgent
(
kubeconfig
,
"pod-informer"
)),
ResyncPeriod
(
s
)())
nodeInformer
:=
informers
.
NewNode
Informer
(
clientset
.
NewForConfigOrDie
(
restclient
.
AddUserAgent
(
kubeconfig
,
"node-informer"
)),
ResyncPeriod
(
s
)())
pvcInformer
:=
informers
.
NewPVC
Informer
(
clientset
.
NewForConfigOrDie
(
restclient
.
AddUserAgent
(
kubeconfig
,
"pvc-informer"
)),
ResyncPeriod
(
s
)())
pvInformer
:=
informers
.
NewPV
Informer
(
clientset
.
NewForConfigOrDie
(
restclient
.
AddUserAgent
(
kubeconfig
,
"pv-informer"
)),
ResyncPeriod
(
s
)())
informers
:=
map
[
reflect
.
Type
]
framework
.
SharedIndexInformer
{}
informers
[
reflect
.
TypeOf
(
&
api
.
Pod
{})]
=
podInformer
informers
[
reflect
.
TypeOf
(
&
api
.
Node
{})]
=
nodeInformer
...
...
pkg/controller/daemon/daemoncontroller.go
View file @
816f6d32
...
...
@@ -205,7 +205,7 @@ func NewDaemonSetsController(podInformer framework.SharedIndexInformer, kubeClie
}
func
NewDaemonSetsControllerFromClient
(
kubeClient
clientset
.
Interface
,
resyncPeriod
controller
.
ResyncPeriodFunc
,
lookupCacheSize
int
)
*
DaemonSetsController
{
podInformer
:=
informers
.
CreateSharedPodIndex
Informer
(
kubeClient
,
resyncPeriod
())
podInformer
:=
informers
.
NewPod
Informer
(
kubeClient
,
resyncPeriod
())
dsc
:=
NewDaemonSetsController
(
podInformer
,
kubeClient
,
resyncPeriod
,
lookupCacheSize
)
dsc
.
internalPodInformer
=
podInformer
...
...
pkg/controller/endpoint/endpoints_controller.go
View file @
816f6d32
...
...
@@ -113,7 +113,7 @@ func NewEndpointController(podInformer framework.SharedIndexInformer, client *cl
// NewEndpointControllerFromClient returns a new *EndpointController that runs its own informer.
func
NewEndpointControllerFromClient
(
client
*
clientset
.
Clientset
,
resyncPeriod
controller
.
ResyncPeriodFunc
)
*
EndpointController
{
podInformer
:=
informers
.
CreateSharedPodIndex
Informer
(
client
,
resyncPeriod
())
podInformer
:=
informers
.
NewPod
Informer
(
client
,
resyncPeriod
())
e
:=
NewEndpointController
(
podInformer
,
client
)
e
.
internalPodInformer
=
podInformer
...
...
pkg/controller/framework/informers/core.go
View file @
816f6d32
...
...
@@ -22,8 +22,6 @@ import (
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/client/cache"
"k8s.io/kubernetes/pkg/controller/framework"
"k8s.io/kubernetes/pkg/runtime"
"k8s.io/kubernetes/pkg/watch"
)
// PodInformer is type of SharedIndexInformer which watches and lists all pods.
...
...
@@ -43,26 +41,12 @@ func (f *podInformer) Informer() framework.SharedIndexInformer {
f
.
lock
.
Lock
()
defer
f
.
lock
.
Unlock
()
informerObj
:=
&
api
.
Pod
{}
informerType
:=
reflect
.
TypeOf
(
informerObj
)
informerType
:=
reflect
.
TypeOf
(
&
api
.
Pod
{})
informer
,
exists
:=
f
.
informers
[
informerType
]
if
exists
{
return
informer
}
informer
=
framework
.
NewSharedIndexInformer
(
&
cache
.
ListWatch
{
ListFunc
:
func
(
options
api
.
ListOptions
)
(
runtime
.
Object
,
error
)
{
return
f
.
client
.
Core
()
.
Pods
(
api
.
NamespaceAll
)
.
List
(
options
)
},
WatchFunc
:
func
(
options
api
.
ListOptions
)
(
watch
.
Interface
,
error
)
{
return
f
.
client
.
Core
()
.
Pods
(
api
.
NamespaceAll
)
.
Watch
(
options
)
},
},
informerObj
,
f
.
defaultResync
,
cache
.
Indexers
{
cache
.
NamespaceIndex
:
cache
.
MetaNamespaceIndexFunc
},
)
informer
=
NewPodInformer
(
f
.
client
,
f
.
defaultResync
)
f
.
informers
[
informerType
]
=
informer
return
informer
...
...
@@ -92,25 +76,13 @@ type namespaceInformer struct {
func
(
f
*
namespaceInformer
)
Informer
()
framework
.
SharedIndexInformer
{
f
.
lock
.
Lock
()
defer
f
.
lock
.
Unlock
()
informerObj
:=
&
api
.
Namespace
{}
informerType
:=
reflect
.
TypeOf
(
informerObj
)
informerType
:=
reflect
.
TypeOf
(
&
api
.
Namespace
{}
)
informer
,
exists
:=
f
.
informers
[
informerType
]
if
exists
{
return
informer
}
informer
=
framework
.
NewSharedIndexInformer
(
&
cache
.
ListWatch
{
ListFunc
:
func
(
options
api
.
ListOptions
)
(
runtime
.
Object
,
error
)
{
return
f
.
client
.
Core
()
.
Namespaces
()
.
List
(
options
)
},
WatchFunc
:
func
(
options
api
.
ListOptions
)
(
watch
.
Interface
,
error
)
{
return
f
.
client
.
Core
()
.
Namespaces
()
.
Watch
(
options
)
},
},
informerObj
,
f
.
defaultResync
,
cache
.
Indexers
{},
)
informer
=
NewNamespaceInformer
(
f
.
client
,
f
.
defaultResync
)
f
.
informers
[
informerType
]
=
informer
return
informer
...
...
@@ -141,26 +113,12 @@ func (f *nodeInformer) Informer() framework.SharedIndexInformer {
f
.
lock
.
Lock
()
defer
f
.
lock
.
Unlock
()
informerObj
:=
&
api
.
Node
{}
informerType
:=
reflect
.
TypeOf
(
informerObj
)
informerType
:=
reflect
.
TypeOf
(
&
api
.
Node
{})
informer
,
exists
:=
f
.
informers
[
informerType
]
if
exists
{
return
informer
}
informer
=
framework
.
NewSharedIndexInformer
(
&
cache
.
ListWatch
{
ListFunc
:
func
(
options
api
.
ListOptions
)
(
runtime
.
Object
,
error
)
{
return
f
.
client
.
Core
()
.
Nodes
()
.
List
(
options
)
},
WatchFunc
:
func
(
options
api
.
ListOptions
)
(
watch
.
Interface
,
error
)
{
return
f
.
client
.
Core
()
.
Nodes
()
.
Watch
(
options
)
},
},
informerObj
,
f
.
defaultResync
,
cache
.
Indexers
{
cache
.
NamespaceIndex
:
cache
.
MetaNamespaceIndexFunc
},
)
informer
=
NewNodeInformer
(
f
.
client
,
f
.
defaultResync
)
f
.
informers
[
informerType
]
=
informer
return
informer
...
...
@@ -191,26 +149,12 @@ func (f *pvcInformer) Informer() framework.SharedIndexInformer {
f
.
lock
.
Lock
()
defer
f
.
lock
.
Unlock
()
informerObj
:=
&
api
.
PersistentVolumeClaim
{}
informerType
:=
reflect
.
TypeOf
(
informerObj
)
informerType
:=
reflect
.
TypeOf
(
&
api
.
PersistentVolumeClaim
{})
informer
,
exists
:=
f
.
informers
[
informerType
]
if
exists
{
return
informer
}
informer
=
framework
.
NewSharedIndexInformer
(
&
cache
.
ListWatch
{
ListFunc
:
func
(
options
api
.
ListOptions
)
(
runtime
.
Object
,
error
)
{
return
f
.
client
.
Core
()
.
PersistentVolumeClaims
(
api
.
NamespaceAll
)
.
List
(
options
)
},
WatchFunc
:
func
(
options
api
.
ListOptions
)
(
watch
.
Interface
,
error
)
{
return
f
.
client
.
Core
()
.
PersistentVolumeClaims
(
api
.
NamespaceAll
)
.
Watch
(
options
)
},
},
informerObj
,
f
.
defaultResync
,
cache
.
Indexers
{
cache
.
NamespaceIndex
:
cache
.
MetaNamespaceIndexFunc
},
)
informer
=
NewPVCInformer
(
f
.
client
,
f
.
defaultResync
)
f
.
informers
[
informerType
]
=
informer
return
informer
...
...
@@ -241,26 +185,12 @@ func (f *pvInformer) Informer() framework.SharedIndexInformer {
f
.
lock
.
Lock
()
defer
f
.
lock
.
Unlock
()
informerObj
:=
&
api
.
PersistentVolume
{}
informerType
:=
reflect
.
TypeOf
(
informerObj
)
informerType
:=
reflect
.
TypeOf
(
&
api
.
PersistentVolume
{})
informer
,
exists
:=
f
.
informers
[
informerType
]
if
exists
{
return
informer
}
informer
=
framework
.
NewSharedIndexInformer
(
&
cache
.
ListWatch
{
ListFunc
:
func
(
options
api
.
ListOptions
)
(
runtime
.
Object
,
error
)
{
return
f
.
client
.
Core
()
.
PersistentVolumes
()
.
List
(
options
)
},
WatchFunc
:
func
(
options
api
.
ListOptions
)
(
watch
.
Interface
,
error
)
{
return
f
.
client
.
Core
()
.
PersistentVolumes
()
.
Watch
(
options
)
},
},
informerObj
,
f
.
defaultResync
,
cache
.
Indexers
{
cache
.
NamespaceIndex
:
cache
.
MetaNamespaceIndexFunc
},
)
informer
=
NewPVInformer
(
f
.
client
,
f
.
defaultResync
)
f
.
informers
[
informerType
]
=
informer
return
informer
...
...
pkg/controller/framework/informers/factory.go
View file @
816f6d32
...
...
@@ -101,27 +101,8 @@ func (f *sharedInformerFactory) PersistentVolumes() PVInformer {
return
&
pvInformer
{
sharedInformerFactory
:
f
}
}
// CreateSharedPodInformer returns a SharedIndexInformer that lists and watches all pods
func
CreateSharedPodInformer
(
client
clientset
.
Interface
,
resyncPeriod
time
.
Duration
)
framework
.
SharedIndexInformer
{
sharedInformer
:=
framework
.
NewSharedIndexInformer
(
&
cache
.
ListWatch
{
ListFunc
:
func
(
options
api
.
ListOptions
)
(
runtime
.
Object
,
error
)
{
return
client
.
Core
()
.
Pods
(
api
.
NamespaceAll
)
.
List
(
options
)
},
WatchFunc
:
func
(
options
api
.
ListOptions
)
(
watch
.
Interface
,
error
)
{
return
client
.
Core
()
.
Pods
(
api
.
NamespaceAll
)
.
Watch
(
options
)
},
},
&
api
.
Pod
{},
resyncPeriod
,
cache
.
Indexers
{},
)
return
sharedInformer
}
// CreateSharedPodIndexInformer returns a SharedIndexInformer that lists and watches all pods
func
CreateSharedPodIndexInformer
(
client
clientset
.
Interface
,
resyncPeriod
time
.
Duration
)
framework
.
SharedIndexInformer
{
// NewPodInformer returns a SharedIndexInformer that lists and watches all pods
func
NewPodInformer
(
client
clientset
.
Interface
,
resyncPeriod
time
.
Duration
)
framework
.
SharedIndexInformer
{
sharedIndexInformer
:=
framework
.
NewSharedIndexInformer
(
&
cache
.
ListWatch
{
ListFunc
:
func
(
options
api
.
ListOptions
)
(
runtime
.
Object
,
error
)
{
...
...
@@ -139,8 +120,8 @@ func CreateSharedPodIndexInformer(client clientset.Interface, resyncPeriod time.
return
sharedIndexInformer
}
//
CreateSharedNodeIndex
Informer returns a SharedIndexInformer that lists and watches all nodes
func
CreateSharedNodeIndex
Informer
(
client
clientset
.
Interface
,
resyncPeriod
time
.
Duration
)
framework
.
SharedIndexInformer
{
//
NewNode
Informer returns a SharedIndexInformer that lists and watches all nodes
func
NewNode
Informer
(
client
clientset
.
Interface
,
resyncPeriod
time
.
Duration
)
framework
.
SharedIndexInformer
{
sharedIndexInformer
:=
framework
.
NewSharedIndexInformer
(
&
cache
.
ListWatch
{
ListFunc
:
func
(
options
api
.
ListOptions
)
(
runtime
.
Object
,
error
)
{
...
...
@@ -157,8 +138,8 @@ func CreateSharedNodeIndexInformer(client clientset.Interface, resyncPeriod time
return
sharedIndexInformer
}
//
CreateSharedPVCIndex
Informer returns a SharedIndexInformer that lists and watches all PVCs
func
CreateSharedPVCIndex
Informer
(
client
clientset
.
Interface
,
resyncPeriod
time
.
Duration
)
framework
.
SharedIndexInformer
{
//
NewPVC
Informer returns a SharedIndexInformer that lists and watches all PVCs
func
NewPVC
Informer
(
client
clientset
.
Interface
,
resyncPeriod
time
.
Duration
)
framework
.
SharedIndexInformer
{
sharedIndexInformer
:=
framework
.
NewSharedIndexInformer
(
&
cache
.
ListWatch
{
ListFunc
:
func
(
options
api
.
ListOptions
)
(
runtime
.
Object
,
error
)
{
...
...
@@ -175,8 +156,8 @@ func CreateSharedPVCIndexInformer(client clientset.Interface, resyncPeriod time.
return
sharedIndexInformer
}
//
CreateSharedPVIndex
Informer returns a SharedIndexInformer that lists and watches all PVs
func
CreateSharedPVIndex
Informer
(
client
clientset
.
Interface
,
resyncPeriod
time
.
Duration
)
framework
.
SharedIndexInformer
{
//
NewPV
Informer returns a SharedIndexInformer that lists and watches all PVs
func
NewPV
Informer
(
client
clientset
.
Interface
,
resyncPeriod
time
.
Duration
)
framework
.
SharedIndexInformer
{
sharedIndexInformer
:=
framework
.
NewSharedIndexInformer
(
&
cache
.
ListWatch
{
ListFunc
:
func
(
options
api
.
ListOptions
)
(
runtime
.
Object
,
error
)
{
...
...
@@ -193,8 +174,8 @@ func CreateSharedPVIndexInformer(client clientset.Interface, resyncPeriod time.D
return
sharedIndexInformer
}
//
CreateSharedNamespaceIndex
Informer returns a SharedIndexInformer that lists and watches namespaces
func
CreateSharedNamespaceIndex
Informer
(
client
clientset
.
Interface
,
resyncPeriod
time
.
Duration
)
framework
.
SharedIndexInformer
{
//
NewNamespace
Informer returns a SharedIndexInformer that lists and watches namespaces
func
NewNamespace
Informer
(
client
clientset
.
Interface
,
resyncPeriod
time
.
Duration
)
framework
.
SharedIndexInformer
{
sharedIndexInformer
:=
framework
.
NewSharedIndexInformer
(
&
cache
.
ListWatch
{
ListFunc
:
func
(
options
api
.
ListOptions
)
(
runtime
.
Object
,
error
)
{
...
...
pkg/controller/job/jobcontroller.go
View file @
816f6d32
...
...
@@ -135,7 +135,7 @@ func NewJobController(podInformer framework.SharedIndexInformer, kubeClient clie
}
func
NewJobControllerFromClient
(
kubeClient
clientset
.
Interface
,
resyncPeriod
controller
.
ResyncPeriodFunc
)
*
JobController
{
podInformer
:=
informers
.
CreateSharedPodIndex
Informer
(
kubeClient
,
resyncPeriod
())
podInformer
:=
informers
.
NewPod
Informer
(
kubeClient
,
resyncPeriod
())
jm
:=
NewJobController
(
podInformer
,
kubeClient
)
jm
.
internalPodInformer
=
podInformer
...
...
pkg/controller/node/nodecontroller.go
View file @
816f6d32
...
...
@@ -343,7 +343,7 @@ func NewNodeControllerFromClient(
serviceCIDR
*
net
.
IPNet
,
nodeCIDRMaskSize
int
,
allocateNodeCIDRs
bool
)
(
*
NodeController
,
error
)
{
podInformer
:=
informers
.
CreateSharedPodIndex
Informer
(
kubeClient
,
controller
.
NoResyncPeriodFunc
())
podInformer
:=
informers
.
NewPod
Informer
(
kubeClient
,
controller
.
NoResyncPeriodFunc
())
nc
,
err
:=
NewNodeController
(
podInformer
,
cloud
,
kubeClient
,
podEvictionTimeout
,
evictionLimiterQPS
,
nodeMonitorGracePeriod
,
nodeStartupGracePeriod
,
nodeMonitorPeriod
,
clusterCIDR
,
serviceCIDR
,
nodeCIDRMaskSize
,
allocateNodeCIDRs
)
if
err
!=
nil
{
...
...
pkg/controller/replicaset/replica_set.go
View file @
816f6d32
...
...
@@ -184,7 +184,7 @@ func newReplicaSetController(eventRecorder record.EventRecorder, podInformer fra
// NewReplicationManagerFromClient creates a new ReplicationManager that runs its own informer.
func
NewReplicaSetControllerFromClient
(
kubeClient
clientset
.
Interface
,
resyncPeriod
controller
.
ResyncPeriodFunc
,
burstReplicas
int
,
lookupCacheSize
int
)
*
ReplicaSetController
{
podInformer
:=
informers
.
CreateSharedPodIndex
Informer
(
kubeClient
,
resyncPeriod
())
podInformer
:=
informers
.
NewPod
Informer
(
kubeClient
,
resyncPeriod
())
garbageCollectorEnabled
:=
false
rsc
:=
NewReplicaSetController
(
podInformer
,
kubeClient
,
resyncPeriod
,
burstReplicas
,
lookupCacheSize
,
garbageCollectorEnabled
)
rsc
.
internalPodInformer
=
podInformer
...
...
pkg/controller/replication/replication_controller.go
View file @
816f6d32
...
...
@@ -189,7 +189,7 @@ func newReplicationManager(eventRecorder record.EventRecorder, podInformer frame
// NewReplicationManagerFromClientForIntegration creates a new ReplicationManager that runs its own informer. It disables event recording for use in integration tests.
func
NewReplicationManagerFromClientForIntegration
(
kubeClient
clientset
.
Interface
,
resyncPeriod
controller
.
ResyncPeriodFunc
,
burstReplicas
int
,
lookupCacheSize
int
)
*
ReplicationManager
{
podInformer
:=
informers
.
CreateSharedPodIndex
Informer
(
kubeClient
,
resyncPeriod
())
podInformer
:=
informers
.
NewPod
Informer
(
kubeClient
,
resyncPeriod
())
garbageCollectorEnabled
:=
false
rm
:=
newReplicationManager
(
&
record
.
FakeRecorder
{},
podInformer
,
kubeClient
,
resyncPeriod
,
burstReplicas
,
lookupCacheSize
,
garbageCollectorEnabled
)
rm
.
internalPodInformer
=
podInformer
...
...
@@ -198,7 +198,7 @@ func NewReplicationManagerFromClientForIntegration(kubeClient clientset.Interfac
// NewReplicationManagerFromClient creates a new ReplicationManager that runs its own informer.
func
NewReplicationManagerFromClient
(
kubeClient
clientset
.
Interface
,
resyncPeriod
controller
.
ResyncPeriodFunc
,
burstReplicas
int
,
lookupCacheSize
int
)
*
ReplicationManager
{
podInformer
:=
informers
.
CreateSharedPodIndex
Informer
(
kubeClient
,
resyncPeriod
())
podInformer
:=
informers
.
NewPod
Informer
(
kubeClient
,
resyncPeriod
())
garbageCollectorEnabled
:=
false
rm
:=
NewReplicationManager
(
podInformer
,
kubeClient
,
resyncPeriod
,
burstReplicas
,
lookupCacheSize
,
garbageCollectorEnabled
)
rm
.
internalPodInformer
=
podInformer
...
...
pkg/controller/resourcequota/replenishment_controller.go
View file @
816f6d32
...
...
@@ -129,7 +129,7 @@ func (r *replenishmentControllerFactory) NewController(options *ReplenishmentCon
break
}
r
.
podInformer
=
informers
.
CreateShared
PodInformer
(
r
.
kubeClient
,
options
.
ResyncPeriod
())
r
.
podInformer
=
informers
.
New
PodInformer
(
r
.
kubeClient
,
options
.
ResyncPeriod
())
result
=
r
.
podInformer
case
api
.
Kind
(
"Service"
)
:
...
...
pkg/controller/volume/attachdetach/attach_detach_controller_test.go
View file @
816f6d32
...
...
@@ -28,10 +28,10 @@ func Test_NewAttachDetachController_Positive(t *testing.T) {
// Arrange
fakeKubeClient
:=
controllervolumetesting
.
CreateTestClient
()
resyncPeriod
:=
5
*
time
.
Minute
podInformer
:=
informers
.
CreateSharedPodIndex
Informer
(
fakeKubeClient
,
resyncPeriod
)
nodeInformer
:=
informers
.
CreateSharedNodeIndex
Informer
(
fakeKubeClient
,
resyncPeriod
)
pvcInformer
:=
informers
.
CreateSharedPVCIndex
Informer
(
fakeKubeClient
,
resyncPeriod
)
pvInformer
:=
informers
.
CreateSharedPVIndex
Informer
(
fakeKubeClient
,
resyncPeriod
)
podInformer
:=
informers
.
NewPod
Informer
(
fakeKubeClient
,
resyncPeriod
)
nodeInformer
:=
informers
.
NewNode
Informer
(
fakeKubeClient
,
resyncPeriod
)
pvcInformer
:=
informers
.
NewPVC
Informer
(
fakeKubeClient
,
resyncPeriod
)
pvInformer
:=
informers
.
NewPV
Informer
(
fakeKubeClient
,
resyncPeriod
)
// Act
_
,
err
:=
NewAttachDetachController
(
...
...
pkg/controller/volume/attachdetach/reconciler/reconciler_test.go
View file @
816f6d32
...
...
@@ -47,7 +47,7 @@ func Test_Run_Positive_DoNothing(t *testing.T) {
fakeKubeClient
:=
controllervolumetesting
.
CreateTestClient
()
ad
:=
operationexecutor
.
NewOperationExecutor
(
fakeKubeClient
,
volumePluginMgr
)
nodeInformer
:=
informers
.
CreateSharedNodeIndex
Informer
(
nodeInformer
:=
informers
.
NewNode
Informer
(
fakeKubeClient
,
resyncPeriod
)
nsu
:=
statusupdater
.
NewNodeStatusUpdater
(
fakeKubeClient
,
nodeInformer
,
asw
)
...
...
test/integration/replicaset/replicaset_test.go
View file @
816f6d32
...
...
@@ -141,7 +141,7 @@ func rmSetup(t *testing.T, enableGarbageCollector bool) (*httptest.Server, *repl
resyncPeriodFunc
:=
func
()
time
.
Duration
{
return
resyncPeriod
}
podInformer
:=
informers
.
CreateSharedPodIndex
Informer
(
internalclientset
.
NewForConfigOrDie
(
restclient
.
AddUserAgent
(
&
config
,
"pod-informer"
)),
resyncPeriod
)
podInformer
:=
informers
.
NewPod
Informer
(
internalclientset
.
NewForConfigOrDie
(
restclient
.
AddUserAgent
(
&
config
,
"pod-informer"
)),
resyncPeriod
)
rm
:=
replicaset
.
NewReplicaSetController
(
podInformer
,
internalclientset
.
NewForConfigOrDie
(
restclient
.
AddUserAgent
(
&
config
,
"replicaset-controller"
)),
...
...
test/integration/replicationcontroller/replicationcontroller_test.go
View file @
816f6d32
...
...
@@ -138,7 +138,7 @@ func rmSetup(t *testing.T, enableGarbageCollector bool) (*httptest.Server, *repl
resyncPeriodFunc
:=
func
()
time
.
Duration
{
return
resyncPeriod
}
podInformer
:=
informers
.
CreateSharedPodIndex
Informer
(
internalclientset
.
NewForConfigOrDie
(
restclient
.
AddUserAgent
(
&
config
,
"pod-informer"
)),
resyncPeriod
)
podInformer
:=
informers
.
NewPod
Informer
(
internalclientset
.
NewForConfigOrDie
(
restclient
.
AddUserAgent
(
&
config
,
"pod-informer"
)),
resyncPeriod
)
rm
:=
replication
.
NewReplicationManager
(
podInformer
,
internalclientset
.
NewForConfigOrDie
(
restclient
.
AddUserAgent
(
&
config
,
"replication-controller"
)),
...
...
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