From f69090f5d9cb147d8d5ea3c9a305eb5f2cfe163a Mon Sep 17 00:00:00 2001 From: Sina Date: Tue, 12 Dec 2023 19:36:18 +0330 Subject: [PATCH] comparing parts effecting adaptive scale --- internal/controller/basic_authenticator/provision.go | 6 +++--- tests/e2e/adaptive-scaling/00-assert.yaml | 2 +- tests/e2e/adaptive-scaling/00-install.yaml | 3 ++- tests/e2e/sidecar/00-assert.yaml | 3 +-- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/internal/controller/basic_authenticator/provision.go b/internal/controller/basic_authenticator/provision.go index df13ddf..fe68ebc 100644 --- a/internal/controller/basic_authenticator/provision.go +++ b/internal/controller/basic_authenticator/provision.go @@ -304,6 +304,7 @@ func (r *BasicAuthenticatorReconciler) createDeploymentAuthenticator(ctx context replica, err := r.acquireTargetReplica(ctx, basicAuthenticator) if err != nil { r.logger.Error(err, "failed to acquire target replica using adaptiveScale") + return subreconciler.RequeueWithError(err) } targetReplica = &replica } @@ -313,8 +314,7 @@ func (r *BasicAuthenticatorReconciler) createDeploymentAuthenticator(ctx context foundDeployment.Spec = newDeployment.Spec foundDeployment.Spec.Replicas = targetReplica - - err := r.Update(ctx, foundDeployment) + err = r.Update(ctx, foundDeployment) if err != nil { r.logger.Error(err, "failed to update deployment") return subreconciler.RequeueWithError(err) @@ -322,7 +322,7 @@ func (r *BasicAuthenticatorReconciler) createDeploymentAuthenticator(ctx context } r.logger.Info("updating ready replicas") basicAuthenticator.Status.ReadyReplicas = int(foundDeployment.Status.ReadyReplicas) - err := r.Status().Update(ctx, basicAuthenticator) + err = r.Status().Update(ctx, basicAuthenticator) if err != nil { r.logger.Error(err, "failed to update basic authenticator status") return subreconciler.RequeueWithError(err) diff --git a/tests/e2e/adaptive-scaling/00-assert.yaml b/tests/e2e/adaptive-scaling/00-assert.yaml index fa51848..6934eb9 100644 --- a/tests/e2e/adaptive-scaling/00-assert.yaml +++ b/tests/e2e/adaptive-scaling/00-assert.yaml @@ -3,5 +3,5 @@ kind: BasicAuthenticator metadata: name: basicauthenticator-sample status: - readyReplicas: 1 + readyReplicas: 2 diff --git a/tests/e2e/adaptive-scaling/00-install.yaml b/tests/e2e/adaptive-scaling/00-install.yaml index 6b23552..67be0d5 100644 --- a/tests/e2e/adaptive-scaling/00-install.yaml +++ b/tests/e2e/adaptive-scaling/00-install.yaml @@ -10,7 +10,7 @@ metadata: name: basicauthenticator-sample spec: type: deployment - replicas: 1 + replicas: 2 appPort: 8080 appService: my-service adaptiveScale: true @@ -36,6 +36,7 @@ spec: containers: - name: curl-container image: curlimages/curl:latest + imagePullPolicy: IfNotPresent command: ["sleep", "infinity"] --- apiVersion: v1 diff --git a/tests/e2e/sidecar/00-assert.yaml b/tests/e2e/sidecar/00-assert.yaml index d50539a..f1291c3 100644 --- a/tests/e2e/sidecar/00-assert.yaml +++ b/tests/e2e/sidecar/00-assert.yaml @@ -4,5 +4,4 @@ metadata: name: curl-deployment labels: foo: bar - finalizers: - - basicauthenticator.snappcloud.io/finalizer + basicauthenticator.snappcloud.io/name: basicauthenticator-sidecar