You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by as...@apache.org on 2019/10/10 12:44:46 UTC

[camel-k] branch master updated: fix: Avoid updating Deployment replicas in default configuration

This is an automated email from the ASF dual-hosted git repository.

astefanutti pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel-k.git


The following commit(s) were added to refs/heads/master by this push:
     new 68f9cba  fix: Avoid updating Deployment replicas in default configuration
68f9cba is described below

commit 68f9cba0d10254a580c7b43b685662cf1aad73d2
Author: Antonin Stefanutti <an...@stefanutti.fr>
AuthorDate: Thu Oct 10 10:28:52 2019 +0200

    fix: Avoid updating Deployment replicas in default configuration
---
 pkg/trait/deployment.go | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/pkg/trait/deployment.go b/pkg/trait/deployment.go
index 6987ce2..3df8e39 100644
--- a/pkg/trait/deployment.go
+++ b/pkg/trait/deployment.go
@@ -128,9 +128,11 @@ func (t *deploymentTrait) Apply(e *Environment) error {
 			return err
 		}
 		replicas := e.Integration.Spec.Replicas
-		if replicas == nil && deployment.Spec.Replicas != nil ||
-			replicas != nil && deployment.Spec.Replicas == nil ||
-			*deployment.Spec.Replicas != *replicas {
+		// Deployment replicas defaults to 1, so we avoid forcing
+		// an update to nil that will result to another update cycle
+		// back to that default value by the Deployment controller.
+		if replicas == nil && *deployment.Spec.Replicas != 1 ||
+			replicas != nil && *deployment.Spec.Replicas != *replicas {
 			deployment.Spec.Replicas = replicas
 			err := t.client.Update(context.TODO(), deployment)
 			if err != nil {