Skip to content

Commit 5362611

Browse files
authored
Merge pull request #940 from alvaroaleman/simplify-3
🏃 Remove unused attributes from controller
2 parents eb68324 + da2a49b commit 5362611

File tree

2 files changed

+1
-17
lines changed

2 files changed

+1
-17
lines changed

pkg/controller/controller.go

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -102,10 +102,7 @@ func NewUnmanaged(name string, mgr manager.Manager, options Options) (Controller
102102

103103
// Create controller with dependencies set
104104
c := &controller.Controller{
105-
Do: options.Reconciler,
106-
Scheme: mgr.GetScheme(),
107-
Client: mgr.GetClient(),
108-
Recorder: mgr.GetEventRecorderFor(name),
105+
Do: options.Reconciler,
109106
MakeQueue: func() workqueue.RateLimitingInterface {
110107
return workqueue.NewNamedRateLimitingQueue(options.RateLimiter, name)
111108
},

pkg/internal/controller/controller.go

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,9 @@ import (
2121
"sync"
2222
"time"
2323

24-
"k8s.io/apimachinery/pkg/runtime"
2524
utilruntime "k8s.io/apimachinery/pkg/util/runtime"
2625
"k8s.io/apimachinery/pkg/util/wait"
27-
"k8s.io/client-go/tools/record"
2826
"k8s.io/client-go/util/workqueue"
29-
"sigs.k8s.io/controller-runtime/pkg/client"
3027
"sigs.k8s.io/controller-runtime/pkg/handler"
3128
ctrlmetrics "sigs.k8s.io/controller-runtime/pkg/internal/controller/metrics"
3229
logf "sigs.k8s.io/controller-runtime/pkg/internal/log"
@@ -53,12 +50,6 @@ type Controller struct {
5350
// Defaults to the DefaultReconcileFunc.
5451
Do reconcile.Reconciler
5552

56-
// Client is a lazily initialized Client. The controllerManager will initialize this when Start is called.
57-
Client client.Client
58-
59-
// Scheme is injected by the controllerManager when controllerManager.Start is called
60-
Scheme *runtime.Scheme
61-
6253
// MakeQueue constructs the queue for this controller once the controller is ready to start.
6354
// This exists because the standard Kubernetes workqueues start themselves immediately, which
6455
// leads to goroutine leaks if something calls controller.New repeatedly.
@@ -80,10 +71,6 @@ type Controller struct {
8071
// Started is true if the Controller has been Started
8172
Started bool
8273

83-
// Recorder is an event recorder for recording Event resources to the
84-
// Kubernetes API.
85-
Recorder record.EventRecorder
86-
8774
// TODO(community): Consider initializing a logger with the Controller Name as the tag
8875

8976
// watches maintains a list of sources, handlers, and predicates to start when the controller is started.

0 commit comments

Comments
 (0)