From e7354542ce60cd48cd54cd5af3df43c93598434f Mon Sep 17 00:00:00 2001 From: Jason Parraga Date: Tue, 3 Dec 2024 22:53:04 -0800 Subject: [PATCH] Set armada server replicas from spec Signed-off-by: Jason Parraga --- internal/controller/install/armadaserver_controller.go | 3 +-- internal/controller/install/armadaserver_controller_test.go | 3 ++- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/internal/controller/install/armadaserver_controller.go b/internal/controller/install/armadaserver_controller.go index a94b0b6..8138454 100644 --- a/internal/controller/install/armadaserver_controller.go +++ b/internal/controller/install/armadaserver_controller.go @@ -438,7 +438,6 @@ func createArmadaServerDeployment( serviceAccountName string, commonConfig *builders.CommonApplicationConfig, ) (*appsv1.Deployment, error) { - var replicas int32 = 1 env := createEnv(as.Spec.Environment) pulsarConfig, err := ExtractPulsarConfig(as.Spec.ApplicationConfig) if err != nil { @@ -458,7 +457,7 @@ func createArmadaServerDeployment( Labels: AllLabels(as.Name, as.Labels), }, Spec: appsv1.DeploymentSpec{ - Replicas: &replicas, + Replicas: as.Spec.Replicas, Selector: &metav1.LabelSelector{ MatchLabels: IdentityLabel(as.Name), }, diff --git a/internal/controller/install/armadaserver_controller_test.go b/internal/controller/install/armadaserver_controller_test.go index bd0319c..cc24125 100644 --- a/internal/controller/install/armadaserver_controller_test.go +++ b/internal/controller/install/armadaserver_controller_test.go @@ -501,6 +501,7 @@ func TestArmadaServerReconciler_CreateDeployment(t *testing.T) { Labels: map[string]string{"test": "hello"}, Annotations: map[string]string{"test": "hello"}, }, + Replicas: ptr.To[int32](2), }, } @@ -517,7 +518,7 @@ func TestArmadaServerReconciler_CreateDeployment(t *testing.T) { }, }, Spec: appsv1.DeploymentSpec{ - Replicas: ptr.To[int32](1), + Replicas: ptr.To[int32](2), Selector: &metav1.LabelSelector{ MatchLabels: map[string]string{ "app": "armadaserver",