@@ -10,8 +10,9 @@ import (
10
10
kerrors "k8s.io/kubernetes/pkg/api/errors"
11
11
"k8s.io/kubernetes/pkg/api/unversioned"
12
12
"k8s.io/kubernetes/pkg/client/cache"
13
+ kclientset "k8s.io/kubernetes/pkg/client/clientset_generated/internalclientset"
14
+ kcoreclient "k8s.io/kubernetes/pkg/client/clientset_generated/internalclientset/typed/core/unversioned"
13
15
"k8s.io/kubernetes/pkg/client/record"
14
- kclient "k8s.io/kubernetes/pkg/client/unversioned"
15
16
"k8s.io/kubernetes/pkg/labels"
16
17
"k8s.io/kubernetes/pkg/runtime"
17
18
"k8s.io/kubernetes/pkg/util/flowcontrol"
@@ -69,7 +70,7 @@ func limitedLogAndRetry(buildupdater buildclient.BuildUpdater, maxTimeout time.D
69
70
// BuildControllerFactory constructs BuildController objects
70
71
type BuildControllerFactory struct {
71
72
OSClient osclient.Interface
72
- KubeClient kclient .Interface
73
+ KubeClient kclientset .Interface
73
74
BuildUpdater buildclient.BuildUpdater
74
75
BuildLister buildclient.BuildLister
75
76
DockerBuildStrategy * strategy.DockerBuildStrategy
@@ -88,7 +89,7 @@ func (factory *BuildControllerFactory) Create() controller.RunnableController {
88
89
cache .NewReflector (& buildLW {client : factory .OSClient }, & buildapi.Build {}, queue , 2 * time .Minute ).RunUntil (factory .Stop )
89
90
90
91
eventBroadcaster := record .NewBroadcaster ()
91
- eventBroadcaster .StartRecordingToSink (factory .KubeClient .Events ("" ))
92
+ eventBroadcaster .StartRecordingToSink (& kcoreclient. EventSinkImpl { Interface : factory .KubeClient .Core (). Events ("" )} )
92
93
93
94
client := ControllerClient {factory .KubeClient , factory .OSClient }
94
95
buildController := & buildcontroller.BuildController {
@@ -168,7 +169,7 @@ func (factory *BuildControllerFactory) CreateDeleteController() controller.Runna
168
169
// BuildPodControllerFactory construct BuildPodController objects
169
170
type BuildPodControllerFactory struct {
170
171
OSClient osclient.Interface
171
- KubeClient kclient .Interface
172
+ KubeClient kclientset .Interface
172
173
BuildUpdater buildclient.BuildUpdater
173
174
// Stop may be set to allow controllers created by this factory to be terminated.
174
175
Stop <- chan struct {}
@@ -210,7 +211,7 @@ func (factory *BuildPodControllerFactory) Create() controller.RunnableController
210
211
buildPodController := & buildcontroller.BuildPodController {
211
212
BuildStore : factory .buildStore ,
212
213
BuildUpdater : factory .BuildUpdater ,
213
- SecretClient : factory .KubeClient ,
214
+ SecretClient : factory .KubeClient . Core () ,
214
215
PodManager : client ,
215
216
}
216
217
@@ -336,7 +337,7 @@ func (factory *ImageChangeControllerFactory) waitForSyncedStores() {
336
337
337
338
type BuildConfigControllerFactory struct {
338
339
Client osclient.Interface
339
- KubeClient kclient .Interface
340
+ KubeClient kclientset .Interface
340
341
BuildConfigInstantiator buildclient.BuildConfigInstantiator
341
342
// Stop may be set to allow controllers created by this factory to be terminated.
342
343
Stop <- chan struct {}
@@ -348,7 +349,7 @@ func (factory *BuildConfigControllerFactory) Create() controller.RunnableControl
348
349
cache .NewReflector (& buildConfigLW {client : factory .Client }, & buildapi.BuildConfig {}, queue , 2 * time .Minute ).RunUntil (factory .Stop )
349
350
350
351
eventBroadcaster := record .NewBroadcaster ()
351
- eventBroadcaster .StartRecordingToSink (factory .KubeClient .Events ("" ))
352
+ eventBroadcaster .StartRecordingToSink (& kcoreclient. EventSinkImpl { Interface : factory .KubeClient .Core (). Events ("" )} )
352
353
353
354
bcController := & buildcontroller.BuildConfigController {
354
355
BuildConfigInstantiator : factory .BuildConfigInstantiator ,
@@ -420,21 +421,21 @@ func (f *typeBasedFactoryStrategy) CreateBuildPod(build *buildapi.Build) (*kapi.
420
421
421
422
// podLW is a ListWatcher implementation for Pods.
422
423
type podLW struct {
423
- client kclient .Interface
424
+ client kclientset .Interface
424
425
}
425
426
426
427
// List lists all Pods that have a build label.
427
428
func (lw * podLW ) List (options kapi.ListOptions ) (runtime.Object , error ) {
428
429
return listPods (lw .client )
429
430
}
430
431
431
- func listPods (client kclient .Interface ) (* kapi.PodList , error ) {
432
+ func listPods (client kclientset .Interface ) (* kapi.PodList , error ) {
432
433
// get builds with new label
433
434
sel , err := labels .Parse (buildapi .BuildLabel )
434
435
if err != nil {
435
436
return nil , err
436
437
}
437
- listNew , err := client .Pods (kapi .NamespaceAll ).List (kapi.ListOptions {LabelSelector : sel })
438
+ listNew , err := client .Core (). Pods (kapi .NamespaceAll ).List (kapi.ListOptions {LabelSelector : sel })
438
439
if err != nil {
439
440
return nil , err
440
441
}
@@ -452,7 +453,7 @@ func (lw *podLW) Watch(options kapi.ListOptions) (watch.Interface, error) {
452
453
LabelSelector : sel ,
453
454
ResourceVersion : options .ResourceVersion ,
454
455
}
455
- return lw .client .Pods (kapi .NamespaceAll ).Watch (opts )
456
+ return lw .client .Core (). Pods (kapi .NamespaceAll ).Watch (opts )
456
457
}
457
458
458
459
// buildLW is a ListWatcher implementation for Builds.
@@ -578,7 +579,7 @@ func (lw *buildPodDeleteLW) List(options kapi.ListOptions) (runtime.Object, erro
578
579
glog .V (5 ).Infof ("Ignoring build %s/%s because it is a pipeline build" , build .Namespace , build .Name )
579
580
continue
580
581
}
581
- pod , err := lw .KubeClient .Pods (build .Namespace ).Get (buildapi .GetBuildPodName (& build ))
582
+ pod , err := lw .KubeClient .Core (). Pods (build .Namespace ).Get (buildapi .GetBuildPodName (& build ))
582
583
if err != nil {
583
584
if ! kerrors .IsNotFound (err ) {
584
585
glog .V (4 ).Infof ("Error getting pod for build %s/%s: %v" , build .Namespace , build .Name , err )
@@ -621,28 +622,28 @@ func (lw *buildPodDeleteLW) Watch(options kapi.ListOptions) (watch.Interface, er
621
622
LabelSelector : sel ,
622
623
ResourceVersion : options .ResourceVersion ,
623
624
}
624
- return lw .KubeClient .Pods (kapi .NamespaceAll ).Watch (opts )
625
+ return lw .KubeClient .Core (). Pods (kapi .NamespaceAll ).Watch (opts )
625
626
}
626
627
627
628
// ControllerClient implements the common interfaces needed for build controllers
628
629
type ControllerClient struct {
629
- KubeClient kclient .Interface
630
+ KubeClient kclientset .Interface
630
631
Client osclient.Interface
631
632
}
632
633
633
634
// CreatePod creates a pod using the Kubernetes client.
634
635
func (c ControllerClient ) CreatePod (namespace string , pod * kapi.Pod ) (* kapi.Pod , error ) {
635
- return c .KubeClient .Pods (namespace ).Create (pod )
636
+ return c .KubeClient .Core (). Pods (namespace ).Create (pod )
636
637
}
637
638
638
639
// DeletePod destroys a pod using the Kubernetes client.
639
640
func (c ControllerClient ) DeletePod (namespace string , pod * kapi.Pod ) error {
640
- return c .KubeClient .Pods (namespace ).Delete (pod .Name , nil )
641
+ return c .KubeClient .Core (). Pods (namespace ).Delete (pod .Name , nil )
641
642
}
642
643
643
644
// GetPod gets a pod using the Kubernetes client.
644
645
func (c ControllerClient ) GetPod (namespace , name string ) (* kapi.Pod , error ) {
645
- return c .KubeClient .Pods (namespace ).Get (name )
646
+ return c .KubeClient .Core (). Pods (namespace ).Get (name )
646
647
}
647
648
648
649
// GetImageStream retrieves an image repository by namespace and name
0 commit comments