From b7c63c1d85f0903f7f741ae2079eae9efc479375 Mon Sep 17 00:00:00 2001 From: Ben Jackson Date: Tue, 30 Jul 2024 07:46:26 +1000 Subject: [PATCH] fix: check usespot before applying replicas (#341) --- internal/generator/services.go | 2 +- .../service-templates/service1/deployment-nginx-php.yaml | 2 +- .../service-templates/service2/deployment-nginx-php.yaml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/internal/generator/services.go b/internal/generator/services.go index f923be1e..5c5461a3 100644 --- a/internal/generator/services.go +++ b/internal/generator/services.go @@ -381,7 +381,7 @@ func composeToServiceValues( // check if the this service is production and can support 2 replicas on spot for _, t := range strings.Split(spotReplicaTypes, ",") { if t != "" { - if t == lagoonType && buildValues.EnvironmentType == "production" { + if t == lagoonType && buildValues.EnvironmentType == "production" && useSpot { spotReplicas = 2 } } diff --git a/internal/testdata/complex/service-templates/service1/deployment-nginx-php.yaml b/internal/testdata/complex/service-templates/service1/deployment-nginx-php.yaml index eec5dbd8..d4209736 100644 --- a/internal/testdata/complex/service-templates/service1/deployment-nginx-php.yaml +++ b/internal/testdata/complex/service-templates/service1/deployment-nginx-php.yaml @@ -19,7 +19,7 @@ metadata: lagoon.sh/template: nginx-php-persistent-0.1.0 name: nginx-php spec: - replicas: 2 + replicas: 1 selector: matchLabels: app.kubernetes.io/instance: nginx-php diff --git a/internal/testdata/complex/service-templates/service2/deployment-nginx-php.yaml b/internal/testdata/complex/service-templates/service2/deployment-nginx-php.yaml index aba76bd9..72990ae0 100644 --- a/internal/testdata/complex/service-templates/service2/deployment-nginx-php.yaml +++ b/internal/testdata/complex/service-templates/service2/deployment-nginx-php.yaml @@ -19,7 +19,7 @@ metadata: lagoon.sh/template: nginx-php-persistent-0.1.0 name: nginx-php spec: - replicas: 2 + replicas: 1 selector: matchLabels: app.kubernetes.io/instance: nginx-php