@@ -56,8 +56,8 @@ type TargetConfigController struct {
5656 kubeClient kubernetes.Interface
5757 configMapLister corev1listers.ConfigMapLister
5858
59- isStartupMonitorEnabledFn func () (bool , error )
60- notOnSingleReplicaTopologyFn func () bool
59+ isStartupMonitorEnabledFn func () (bool , error )
60+ requireMultipleEtcdEndpointsFn func () bool
6161}
6262
6363func NewTargetConfigController (
@@ -67,18 +67,18 @@ func NewTargetConfigController(
6767 kubeInformersForNamespaces v1helpers.KubeInformersForNamespaces ,
6868 kubeClient kubernetes.Interface ,
6969 isStartupMonitorEnabledFn func () (bool , error ),
70- notOnSingleReplicaTopologyFn func () bool ,
70+ requireMultipleEtcdEndpointsFn func () bool ,
7171 eventRecorder events.Recorder ,
7272) factory.Controller {
7373 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 ,
8282 }
8383
8484 return factory .New ().WithInformers (
@@ -112,8 +112,8 @@ func (c TargetConfigController) sync(ctx context.Context, syncContext factory.Sy
112112 }
113113
114114 // 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 {
117117 syncContext .Recorder ().Warning ("ConfigMissing" , err .Error ())
118118 return err
119119 }
@@ -129,7 +129,7 @@ func (c TargetConfigController) sync(ctx context.Context, syncContext factory.Sy
129129 return nil
130130}
131131
132- func (c * TargetConfigController ) isRequiredConfigPresent (config []byte , isNotSingleNode bool ) error {
132+ func (c * TargetConfigController ) isRequiredConfigPresent (config []byte , requireMultipleEtcdEndpoints bool ) error {
133133 if len (config ) == 0 {
134134 return fmt .Errorf ("no observedConfig" )
135135 }
@@ -162,7 +162,7 @@ func (c *TargetConfigController) isRequiredConfigPresent(config []byte, isNotSin
162162 return fmt .Errorf ("%v empty in config" , strings .Join (requiredPath , "." ))
163163 }
164164
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 {
166166 configValSlice , ok := configVal .([]interface {})
167167 if ! ok {
168168 return fmt .Errorf ("%v is not a slice" , strings .Join (requiredPath , "." ))
0 commit comments