From 7203e86a0fc1deaae2cc1cd9fd812367a45dbd48 Mon Sep 17 00:00:00 2001 From: Lihi Zitzer Date: Tue, 6 Aug 2024 16:15:37 +0300 Subject: [PATCH] SLK-82520: Fix KE replicas not being set --- controllers/operator/aquakubeenforcer/aquaKubeEnforcerHelper.go | 2 +- .../operator/aquakubeenforcer/aquakubeenforcer_controller.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/controllers/operator/aquakubeenforcer/aquaKubeEnforcerHelper.go b/controllers/operator/aquakubeenforcer/aquaKubeEnforcerHelper.go index 74f1d857..57c64375 100644 --- a/controllers/operator/aquakubeenforcer/aquaKubeEnforcerHelper.go +++ b/controllers/operator/aquakubeenforcer/aquaKubeEnforcerHelper.go @@ -637,7 +637,7 @@ func (enf *AquaKubeEnforcerHelper) CreateKEDeployment(cr *operatorv1alpha1.AquaK Annotations: annotations, }, Spec: appsv1.DeploymentSpec{ - //Replicas: extra.Int32Ptr(int32(2)), + Replicas: extra.Int32Ptr(int32(cr.Spec.KubeEnforcerService.Replicas)), Selector: &metav1.LabelSelector{ MatchLabels: selectors, }, diff --git a/controllers/operator/aquakubeenforcer/aquakubeenforcer_controller.go b/controllers/operator/aquakubeenforcer/aquakubeenforcer_controller.go index 0a7d18a7..713c141d 100644 --- a/controllers/operator/aquakubeenforcer/aquakubeenforcer_controller.go +++ b/controllers/operator/aquakubeenforcer/aquakubeenforcer_controller.go @@ -493,7 +493,7 @@ func (r *AquaKubeEnforcerReconciler) addKEDeployment(cr *operatorv1alpha1.AquaKu _ = r.Client.Status().Update(context.Background(), cr) } else { currentState := cr.Status.State - if !k8s.IsDeploymentReady(found, 1) { + if !k8s.IsDeploymentReady(found, int(cr.Spec.KubeEnforcerService.Replicas)) { if !reflect.DeepEqual(operatorv1alpha1.AquaEnforcerUpdateInProgress, currentState) && !reflect.DeepEqual(operatorv1alpha1.AquaDeploymentStatePending, currentState) { cr.Status.State = operatorv1alpha1.AquaEnforcerUpdateInProgress