7
7
"fmt"
8
8
"time"
9
9
10
+ "k8s.io/component-base/featuregate"
11
+
10
12
machinev1 "github.com/openshift/api/machine/v1beta1"
11
13
machinecontroller "github.com/openshift/machine-api-operator/pkg/controller/machine"
12
14
corev1 "k8s.io/api/core/v1"
@@ -27,33 +29,33 @@ const (
27
29
28
30
// Actuator is responsible for performing machine reconciliation.
29
31
type Actuator struct {
30
- client runtimeclient.Client
31
- apiReader runtimeclient.Reader
32
- eventRecorder record.EventRecorder
33
- TaskIDCache map [string ]string
34
- StaticIPFeatureGateEnabled bool
35
- openshiftConfigNamespace string
32
+ client runtimeclient.Client
33
+ apiReader runtimeclient.Reader
34
+ eventRecorder record.EventRecorder
35
+ TaskIDCache map [string ]string
36
+ FeatureGates featuregate. MutableFeatureGate
37
+ openshiftConfigNamespace string
36
38
}
37
39
38
40
// ActuatorParams holds parameter information for Actuator.
39
41
type ActuatorParams struct {
40
- Client runtimeclient.Client
41
- APIReader runtimeclient.Reader
42
- EventRecorder record.EventRecorder
43
- TaskIDCache map [string ]string
44
- StaticIPFeatureGateEnabled bool
45
- OpenshiftConfigNamespace string
42
+ Client runtimeclient.Client
43
+ APIReader runtimeclient.Reader
44
+ EventRecorder record.EventRecorder
45
+ TaskIDCache map [string ]string
46
+ FeatureGates featuregate. MutableFeatureGate
47
+ OpenshiftConfigNamespace string
46
48
}
47
49
48
50
// NewActuator returns an actuator.
49
51
func NewActuator (params ActuatorParams ) * Actuator {
50
52
return & Actuator {
51
- client : params .Client ,
52
- apiReader : params .APIReader ,
53
- eventRecorder : params .EventRecorder ,
54
- TaskIDCache : params .TaskIDCache ,
55
- StaticIPFeatureGateEnabled : params .StaticIPFeatureGateEnabled ,
56
- openshiftConfigNamespace : params .OpenshiftConfigNamespace ,
53
+ client : params .Client ,
54
+ apiReader : params .APIReader ,
55
+ eventRecorder : params .EventRecorder ,
56
+ TaskIDCache : params .TaskIDCache ,
57
+ FeatureGates : params .FeatureGates ,
58
+ openshiftConfigNamespace : params .OpenshiftConfigNamespace ,
57
59
}
58
60
}
59
61
@@ -72,12 +74,12 @@ func (a *Actuator) Create(ctx context.Context, machine *machinev1.Machine) error
72
74
klog .Infof ("%s: actuator creating machine" , machine .GetName ())
73
75
74
76
scope , err := newMachineScope (machineScopeParams {
75
- Context : ctx ,
76
- client : a .client ,
77
- machine : machine ,
78
- apiReader : a .apiReader ,
79
- StaticIPFeatureGateEnabled : a . StaticIPFeatureGateEnabled ,
80
- openshiftConfigNameSpace : a .openshiftConfigNamespace ,
77
+ Context : ctx ,
78
+ client : a .client ,
79
+ machine : machine ,
80
+ apiReader : a .apiReader ,
81
+ featureGates : a . FeatureGates ,
82
+ openshiftConfigNameSpace : a .openshiftConfigNamespace ,
81
83
})
82
84
if err != nil {
83
85
fmtErr := fmt .Errorf (scopeFailFmt , machine .GetName (), err )
@@ -116,12 +118,12 @@ func (a *Actuator) Create(ctx context.Context, machine *machinev1.Machine) error
116
118
func (a * Actuator ) Exists (ctx context.Context , machine * machinev1.Machine ) (bool , error ) {
117
119
klog .Infof ("%s: actuator checking if machine exists" , machine .GetName ())
118
120
scope , err := newMachineScope (machineScopeParams {
119
- Context : ctx ,
120
- client : a .client ,
121
- machine : machine ,
122
- apiReader : a .apiReader ,
123
- StaticIPFeatureGateEnabled : a . StaticIPFeatureGateEnabled ,
124
- openshiftConfigNameSpace : a .openshiftConfigNamespace ,
121
+ Context : ctx ,
122
+ client : a .client ,
123
+ machine : machine ,
124
+ apiReader : a .apiReader ,
125
+ featureGates : a . FeatureGates ,
126
+ openshiftConfigNameSpace : a .openshiftConfigNamespace ,
125
127
})
126
128
if err != nil {
127
129
return false , fmt .Errorf (scopeFailFmt , machine .GetName (), err )
@@ -135,12 +137,12 @@ func (a *Actuator) Update(ctx context.Context, machine *machinev1.Machine) error
135
137
delete (a .TaskIDCache , machine .Name )
136
138
137
139
scope , err := newMachineScope (machineScopeParams {
138
- Context : ctx ,
139
- client : a .client ,
140
- machine : machine ,
141
- apiReader : a .apiReader ,
142
- StaticIPFeatureGateEnabled : a . StaticIPFeatureGateEnabled ,
143
- openshiftConfigNameSpace : a .openshiftConfigNamespace ,
140
+ Context : ctx ,
141
+ client : a .client ,
142
+ machine : machine ,
143
+ apiReader : a .apiReader ,
144
+ featureGates : a . FeatureGates ,
145
+ openshiftConfigNameSpace : a .openshiftConfigNamespace ,
144
146
})
145
147
if err != nil {
146
148
fmtErr := fmt .Errorf (scopeFailFmt , machine .GetName (), err )
@@ -177,12 +179,12 @@ func (a *Actuator) Delete(ctx context.Context, machine *machinev1.Machine) error
177
179
delete (a .TaskIDCache , machine .Name )
178
180
179
181
scope , err := newMachineScope (machineScopeParams {
180
- Context : ctx ,
181
- client : a .client ,
182
- machine : machine ,
183
- apiReader : a .apiReader ,
184
- StaticIPFeatureGateEnabled : a . StaticIPFeatureGateEnabled ,
185
- openshiftConfigNameSpace : a .openshiftConfigNamespace ,
182
+ Context : ctx ,
183
+ client : a .client ,
184
+ machine : machine ,
185
+ apiReader : a .apiReader ,
186
+ featureGates : a . FeatureGates ,
187
+ openshiftConfigNameSpace : a .openshiftConfigNamespace ,
186
188
})
187
189
if err != nil {
188
190
fmtErr := fmt .Errorf (scopeFailFmt , machine .GetName (), err )
0 commit comments