From c007dad3638a41eeba2383743f4110ca3f5db5fa Mon Sep 17 00:00:00 2001
From: Remi  PLANEL <rplanel@pasteur.fr>
Date: Mon, 2 Oct 2023 11:51:16 +0200
Subject: [PATCH] Recreate deploy strategy

---
 .gitlab-ci.yml                           | 4 ++++
 deploy/df-wiki/templates/deployment.yaml | 2 ++
 deploy/df-wiki/values.yaml               | 2 ++
 3 files changed, 8 insertions(+)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index ce046085..72e2bc56 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -50,6 +50,8 @@ build:dev:
   variables:
     CI_DEBUG_TRACE: "true"
     TEAM_ID: "df"
+    DEPLOY_STRATEGY: RollingUpdate
+
   script:
     - >
       helm upgrade --install $CI_PROJECT_NAME-$CI_ENVIRONMENT_NAME ./deploy/df-wiki --namespace=${KUBE_NAMESPACE}
@@ -61,6 +63,7 @@ build:dev:
       --set image.repository="$CI_REGISTRY_IMAGE/$IMAGE_NAME"
       --set image.tag="$CI_COMMIT_SHORT_SHA"
       --set image.pullPolicy='Always'
+      --set strategy.type="${DEPLOY_STRATEGY}"
       --set env="$ENV"
 
 deploy:dev:
@@ -77,6 +80,7 @@ deploy:dev:
     AUTOSCALE: "true"
     AUTSCALING_MIN_REPLICAS: "1"
     AUTSCALING_MAX_REPLICAS: "4"
+    DEPLOY_STRATEGY: "Recreate"
     ENV: "development"
   environment:
     name: k8sdev-01
diff --git a/deploy/df-wiki/templates/deployment.yaml b/deploy/df-wiki/templates/deployment.yaml
index c622b0c0..d6e2fb6e 100644
--- a/deploy/df-wiki/templates/deployment.yaml
+++ b/deploy/df-wiki/templates/deployment.yaml
@@ -8,6 +8,8 @@ spec:
   {{- if not .Values.autoscaling.enabled }}
   replicas: {{ .Values.replicaCount }}
   {{- end }}
+  strategy:
+    type: {{ .Values.strategy.type }}
   selector:
     matchLabels:
       {{- include "df-wiki.selectorLabels" . | nindent 6 }}
diff --git a/deploy/df-wiki/values.yaml b/deploy/df-wiki/values.yaml
index 0f4ab1e6..85642d7c 100644
--- a/deploy/df-wiki/values.yaml
+++ b/deploy/df-wiki/values.yaml
@@ -13,6 +13,8 @@ image:
 imagePullSecrets: []
 nameOverride: ""
 fullnameOverride: ""
+strategy:
+  type: RollingUpdate
 
 serviceAccount:
   # Specifies whether a service account should be created
-- 
GitLab