From 7aacaae3547b8655f9c48a22cf24bca56f110d43 Mon Sep 17 00:00:00 2001 From: Andrea Panattoni Date: Wed, 3 Jul 2024 17:15:00 +0200 Subject: [PATCH] Add a non namespaced client to `SriovOperatorConfigReconciler` Signed-off-by: Andrea Panattoni --- controllers/sriovoperatorconfig_controller.go | 3 ++- controllers/sriovoperatorconfig_controller_test.go | 1 + main.go | 1 + 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/controllers/sriovoperatorconfig_controller.go b/controllers/sriovoperatorconfig_controller.go index c43c90a07..5a2ba11ac 100644 --- a/controllers/sriovoperatorconfig_controller.go +++ b/controllers/sriovoperatorconfig_controller.go @@ -56,6 +56,7 @@ type SriovOperatorConfigReconciler struct { Scheme *runtime.Scheme PlatformHelper platforms.Interface FeatureGate featuregate.FeatureGate + GlobalClient client.Client } //+kubebuilder:rbac:groups=sriovnetwork.openshift.io,resources=sriovoperatorconfigs,verbs=get;list;watch;create;update;patch;delete @@ -237,7 +238,7 @@ func (r *SriovOperatorConfigReconciler) syncMetricsExporter(ctx context.Context, data.Data["MetricsExporterPort"] = os.Getenv("METRICS_EXPORTER_PORT") data.Data["MetricsExporterKubeRbacProxyImage"] = os.Getenv("METRICS_EXPORTER_KUBE_RBAC_PROXY_IMAGE") data.Data["IsOpenshift"] = r.PlatformHelper.IsOpenshiftCluster() - data.Data["IsPrometheusOperatorInstalled"] = isPrometheusOperatorInstalled(ctx, r.Client) + data.Data["IsPrometheusOperatorInstalled"] = isPrometheusOperatorInstalled(ctx, r.GlobalClient) data.Data["NodeSelectorField"] = GetDefaultNodeSelector() if dc.Spec.ConfigDaemonNodeSelector != nil { data.Data["NodeSelectorField"] = dc.Spec.ConfigDaemonNodeSelector diff --git a/controllers/sriovoperatorconfig_controller_test.go b/controllers/sriovoperatorconfig_controller_test.go index 8c87c3468..5b8ade0f0 100644 --- a/controllers/sriovoperatorconfig_controller_test.go +++ b/controllers/sriovoperatorconfig_controller_test.go @@ -83,6 +83,7 @@ var _ = Describe("SriovOperatorConfig controller", Ordered, func() { reconciler = &SriovOperatorConfigReconciler{ Client: k8sManager.GetClient(), + GlobalClient: k8sManager.GetClient(), Scheme: k8sManager.GetScheme(), PlatformHelper: platformHelper, FeatureGate: featuregate.New(), diff --git a/main.go b/main.go index 64b1e10a3..f5185f3b5 100644 --- a/main.go +++ b/main.go @@ -222,6 +222,7 @@ func main() { } if err = (&controllers.SriovOperatorConfigReconciler{ Client: mgr.GetClient(), + GlobalClient: mgrGlobal.GetClient(), Scheme: mgr.GetScheme(), PlatformHelper: platformsHelper, FeatureGate: featureGate,