@@ -35,6 +35,7 @@ import (
35
35
"k8s.io/apimachinery/pkg/util/validation/field"
36
36
"k8s.io/client-go/rest"
37
37
"k8s.io/client-go/tools/record"
38
+ "k8s.io/component-base/featuregate"
38
39
"k8s.io/klog/v2"
39
40
"k8s.io/utils/ptr"
40
41
"sigs.k8s.io/controller-runtime/pkg/client"
@@ -75,13 +76,13 @@ const (
75
76
76
77
var DefaultActuator Actuator
77
78
78
- func AddWithActuator (mgr manager.Manager , actuator Actuator ) error {
79
- return AddWithActuatorOpts (mgr , actuator , controller.Options {})
79
+ func AddWithActuator (mgr manager.Manager , actuator Actuator , gate featuregate. MutableFeatureGate ) error {
80
+ return AddWithActuatorOpts (mgr , actuator , controller.Options {}, gate )
80
81
}
81
82
82
- func AddWithActuatorOpts (mgr manager.Manager , actuator Actuator , opts controller.Options ) error {
83
+ func AddWithActuatorOpts (mgr manager.Manager , actuator Actuator , opts controller.Options , gate featuregate. MutableFeatureGate ) error {
83
84
machineControllerOpts := opts
84
- machineControllerOpts .Reconciler = newReconciler (mgr , actuator )
85
+ machineControllerOpts .Reconciler = newReconciler (mgr , actuator , gate )
85
86
86
87
if err := addWithOpts (mgr , machineControllerOpts , "machine-controller" ); err != nil {
87
88
return err
@@ -96,14 +97,14 @@ func AddWithActuatorOpts(mgr manager.Manager, actuator Actuator, opts controller
96
97
return nil
97
98
}
98
99
99
- // newReconciler returns a new reconcile.Reconciler
100
- func newReconciler (mgr manager.Manager , actuator Actuator ) reconcile.Reconciler {
100
+ func newReconciler (mgr manager.Manager , actuator Actuator , gate featuregate.MutableFeatureGate ) reconcile.Reconciler {
101
101
r := & ReconcileMachine {
102
102
Client : mgr .GetClient (),
103
103
eventRecorder : mgr .GetEventRecorderFor ("machine-controller" ),
104
104
config : mgr .GetConfig (),
105
105
scheme : mgr .GetScheme (),
106
106
actuator : actuator ,
107
+ gate : gate ,
107
108
}
108
109
return r
109
110
}
@@ -137,6 +138,7 @@ type ReconcileMachine struct {
137
138
eventRecorder record.EventRecorder
138
139
139
140
actuator Actuator
141
+ gate featuregate.MutableFeatureGate
140
142
141
143
// nowFunc is used to mock time in testing. It should be nil in production.
142
144
nowFunc func () time.Time
0 commit comments