From 10ff2730a147fd5c702db65625aeb8982e72c4ab Mon Sep 17 00:00:00 2001 From: Dimitri Nicolopoulos Date: Thu, 24 Oct 2024 13:27:53 -0700 Subject: [PATCH] [EV-5299] Move windows os check under the license check --- .../policyrecommendation_controller.go | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/pkg/controller/policyrecommendation/policyrecommendation_controller.go b/pkg/controller/policyrecommendation/policyrecommendation_controller.go index bca4e7654c..1f09a128c8 100644 --- a/pkg/controller/policyrecommendation/policyrecommendation_controller.go +++ b/pkg/controller/policyrecommendation/policyrecommendation_controller.go @@ -289,6 +289,17 @@ func (r *ReconcilePolicyRecommendation) Reconcile(ctx context.Context, request r return reconcile.Result{RequeueAfter: utils.StandardRetry}, nil } + // Render a Policy Recommendation component for Windows if the cluster has Windows nodes. + hasWindowsNodes, err := common.HasWindowsNodes(r.client) + if err != nil { + r.status.SetDegraded(operatorv1.ResourceNotReady, "OS not found", err, logc) + return reconcile.Result{}, err + } + if hasWindowsNodes { + r.status.SetDegraded(operatorv1.ResourceValidationError, "Unsupported OS (Windows)", err, logc) + return reconcile.Result{}, err + } + license, err := utils.FetchLicenseKey(ctx, r.client) if err != nil { if errors.IsNotFound(err) { @@ -431,12 +442,6 @@ func (r *ReconcilePolicyRecommendation) Reconcile(ctx context.Context, request r return reconcile.Result{}, nil } - // Render a Policy Recommendation component for Windows if the cluster has Windows nodes. - hasWindowsNodes, err := common.HasWindowsNodes(r.client) - if err != nil { - return reconcile.Result{}, err - } - policyRecommendationCfg := &render.PolicyRecommendationConfiguration{ ClusterDomain: r.clusterDomain, Installation: installation,