@@ -241,6 +241,10 @@ func createTargetConfig(ctx context.Context, c TargetConfigController, recorder
241
241
if err != nil {
242
242
errors = append (errors , fmt .Errorf ("%q: %v" , "serviceaccount/localhost-recovery-client" , err ))
243
243
}
244
+ _ , _ , err = manageKubeAPICheckEndpointsConfig (ctx , c .kubeClient .CoreV1 (), recorder )
245
+ if err != nil {
246
+ errors = append (errors , fmt .Errorf ("%q: %v" , "configmap/kube-apiserver-check-endpoints-config" , err ))
247
+ }
244
248
245
249
if len (errors ) > 0 {
246
250
condition := operatorv1.OperatorCondition {
@@ -303,6 +307,19 @@ func manageKubeAPIServerConfig(ctx context.Context, client coreclientv1.ConfigMa
303
307
return resourceapply .ApplyConfigMap (ctx , client , recorder , requiredConfigMap )
304
308
}
305
309
310
+ func manageKubeAPICheckEndpointsConfig (ctx context.Context , client coreclientv1.ConfigMapsGetter , recorder events.Recorder ) (* corev1.ConfigMap , bool , error ) {
311
+ configMap := resourceread .ReadConfigMapV1OrDie (bindata .MustAsset ("assets/kube-apiserver/check-endpoints-config-cm.yaml" ))
312
+ cmCLient := client .ConfigMaps (operatorclient .TargetNamespace )
313
+ cm , err := cmCLient .Get (ctx , "kube-apiserver-check-endpoints-config" , metav1.GetOptions {})
314
+ if err != nil {
315
+ if apierrors .IsNotFound (err ) {
316
+ _ , err = cmCLient .Create (ctx , required , metav1.CreateOptions {})
317
+ }
318
+ return err
319
+ }
320
+ return resourceapply .ApplyConfigMap (ctx , client , recorder , configMap )
321
+ }
322
+
306
323
func managePods (ctx context.Context , client coreclientv1.ConfigMapsGetter , isStartupMonitorEnabledFn func () (bool , error ), recorder events.Recorder , operatorSpec * operatorv1.StaticPodOperatorSpec , imagePullSpec , operatorImagePullSpec , operatorImageVersion string ) (* corev1.ConfigMap , bool , error ) {
307
324
appliedPodTemplate , err := manageTemplate (string (bindata .MustAsset ("assets/kube-apiserver/pod.yaml" )), imagePullSpec , operatorImagePullSpec , operatorImageVersion , operatorSpec )
308
325
if err != nil {
0 commit comments