@@ -56,8 +56,8 @@ type TargetConfigController struct {
56
56
kubeClient kubernetes.Interface
57
57
configMapLister corev1listers.ConfigMapLister
58
58
59
- isStartupMonitorEnabledFn func () (bool , error )
60
- notOnSingleReplicaTopologyFn func () bool
59
+ isStartupMonitorEnabledFn func () (bool , error )
60
+ requireMultipleEtcdEndpointsFn func () bool
61
61
}
62
62
63
63
func NewTargetConfigController (
@@ -67,18 +67,18 @@ func NewTargetConfigController(
67
67
kubeInformersForNamespaces v1helpers.KubeInformersForNamespaces ,
68
68
kubeClient kubernetes.Interface ,
69
69
isStartupMonitorEnabledFn func () (bool , error ),
70
- notOnSingleReplicaTopologyFn func () bool ,
70
+ requireMultipleEtcdEndpointsFn func () bool ,
71
71
eventRecorder events.Recorder ,
72
72
) factory.Controller {
73
73
c := & TargetConfigController {
74
- targetImagePullSpec : targetImagePullSpec ,
75
- operatorImagePullSpec : operatorImagePullSpec ,
76
- operatorImageVersion : operatorImageVersion ,
77
- operatorClient : operatorClient ,
78
- kubeClient : kubeClient ,
79
- configMapLister : kubeInformersForNamespaces .ConfigMapLister (),
80
- isStartupMonitorEnabledFn : isStartupMonitorEnabledFn ,
81
- notOnSingleReplicaTopologyFn : notOnSingleReplicaTopologyFn ,
74
+ targetImagePullSpec : targetImagePullSpec ,
75
+ operatorImagePullSpec : operatorImagePullSpec ,
76
+ operatorImageVersion : operatorImageVersion ,
77
+ operatorClient : operatorClient ,
78
+ kubeClient : kubeClient ,
79
+ configMapLister : kubeInformersForNamespaces .ConfigMapLister (),
80
+ isStartupMonitorEnabledFn : isStartupMonitorEnabledFn ,
81
+ requireMultipleEtcdEndpointsFn : requireMultipleEtcdEndpointsFn ,
82
82
}
83
83
84
84
return factory .New ().WithInformers (
@@ -112,8 +112,8 @@ func (c TargetConfigController) sync(ctx context.Context, syncContext factory.Sy
112
112
}
113
113
114
114
// block until config is observed and specific paths are present
115
- isNotOnSingleReplicaTopology := c .notOnSingleReplicaTopologyFn ()
116
- if err := c .isRequiredConfigPresent (operatorSpec .ObservedConfig .Raw , isNotOnSingleReplicaTopology ); err != nil {
115
+ requireMultipleEtcdEndpoints := c .requireMultipleEtcdEndpointsFn ()
116
+ if err := c .isRequiredConfigPresent (operatorSpec .ObservedConfig .Raw , requireMultipleEtcdEndpoints ); err != nil {
117
117
syncContext .Recorder ().Warning ("ConfigMissing" , err .Error ())
118
118
return err
119
119
}
@@ -129,7 +129,7 @@ func (c TargetConfigController) sync(ctx context.Context, syncContext factory.Sy
129
129
return nil
130
130
}
131
131
132
- func (c * TargetConfigController ) isRequiredConfigPresent (config []byte , isNotSingleNode bool ) error {
132
+ func (c * TargetConfigController ) isRequiredConfigPresent (config []byte , requireMultipleEtcdEndpoints bool ) error {
133
133
if len (config ) == 0 {
134
134
return fmt .Errorf ("no observedConfig" )
135
135
}
@@ -162,7 +162,7 @@ func (c *TargetConfigController) isRequiredConfigPresent(config []byte, isNotSin
162
162
return fmt .Errorf ("%v empty in config" , strings .Join (requiredPath , "." ))
163
163
}
164
164
165
- if len (requiredPath ) == 2 && requiredPath [0 ] == "apiServerArguments" && requiredPath [1 ] == "etcd-servers" && isNotSingleNode {
165
+ if len (requiredPath ) == 2 && requiredPath [0 ] == "apiServerArguments" && requiredPath [1 ] == "etcd-servers" && requireMultipleEtcdEndpoints {
166
166
configValSlice , ok := configVal .([]interface {})
167
167
if ! ok {
168
168
return fmt .Errorf ("%v is not a slice" , strings .Join (requiredPath , "." ))
0 commit comments