From ba62fd730a96c9905b287aa55af643290412b9d7 Mon Sep 17 00:00:00 2001 From: devthejo Date: Sun, 17 Dec 2023 11:31:11 +0100 Subject: [PATCH] feat: kind deployment --- charts/modjo-microservice/templates/preview.ingress.yaml | 2 +- charts/modjo-microservice/templates/preview.service.yaml | 2 +- .../templates/{rollout.yaml => rollout-deployment.yaml} | 8 ++++++-- charts/modjo-microservice/values.yaml | 4 ++++ 4 files changed, 12 insertions(+), 4 deletions(-) rename charts/modjo-microservice/templates/{rollout.yaml => rollout-deployment.yaml} (96%) diff --git a/charts/modjo-microservice/templates/preview.ingress.yaml b/charts/modjo-microservice/templates/preview.ingress.yaml index 667c162..a44812b 100644 --- a/charts/modjo-microservice/templates/preview.ingress.yaml +++ b/charts/modjo-microservice/templates/preview.ingress.yaml @@ -1,4 +1,4 @@ -{{- if and (eq .Values.rollout.strategy.type "BlueGreen") .Values.preview.ingress.enabled -}} +{{- if and (eq .Values.kind "Rollout") (eq .Values.rollout.strategy.type "BlueGreen") .Values.preview.ingress.enabled -}} apiVersion: networking.k8s.io/v1 kind: Ingress metadata: diff --git a/charts/modjo-microservice/templates/preview.service.yaml b/charts/modjo-microservice/templates/preview.service.yaml index 8e8e98a..4e7c049 100644 --- a/charts/modjo-microservice/templates/preview.service.yaml +++ b/charts/modjo-microservice/templates/preview.service.yaml @@ -1,4 +1,4 @@ -{{- if and .Values.exposed .Values.service.enabled (eq .Values.rollout.strategy.type "BlueGreen") -}} +{{- if and (eq .Values.kind "Rollout") .Values.exposed .Values.service.enabled (eq .Values.rollout.strategy.type "BlueGreen") -}} apiVersion: v1 kind: Service metadata: diff --git a/charts/modjo-microservice/templates/rollout.yaml b/charts/modjo-microservice/templates/rollout-deployment.yaml similarity index 96% rename from charts/modjo-microservice/templates/rollout.yaml rename to charts/modjo-microservice/templates/rollout-deployment.yaml index c6c29d3..f4a4eee 100644 --- a/charts/modjo-microservice/templates/rollout.yaml +++ b/charts/modjo-microservice/templates/rollout-deployment.yaml @@ -1,5 +1,5 @@ -apiVersion: argoproj.io/v1alpha1 -kind: Rollout +apiVersion: {{ eq .Values.kind "Rollout" | ternary "argoproj.io/v1alpha1" "apps/v1" }} +kind: {{ .Values.kind }} metadata: name: {{ include "common.names.fullname" . }} labels: {{- include "common.labels.standard" . | nindent 4 }} @@ -17,6 +17,7 @@ spec: selector: matchLabels: {{ include "common.labels.matchLabels" . | nindent 6 }} strategy: + {{- if eq .Values.kind "Rollout" }} {{- if eq .Values.rollout.strategy.type "BlueGreen" }} blueGreen: activeService: {{ default (include "common.names.fullname" .) .Values.rollout.strategy.blueGreen.activeService | quote }} @@ -36,6 +37,9 @@ spec: rollingUpdate: {{- toYaml .Values.rollout.strategy.rollingUpdate | nindent 6 }} {{- end }} + {{- else }} + {{- .Values.deployment.strategy | toYaml | nindent 4 }} + {{- end }} template: metadata: annotations: diff --git a/charts/modjo-microservice/values.yaml b/charts/modjo-microservice/values.yaml index 8a4e56a..97c9a06 100644 --- a/charts/modjo-microservice/values.yaml +++ b/charts/modjo-microservice/values.yaml @@ -1,6 +1,7 @@ fullnameOverride: "" nameOverride: "" +kind: Rollout exposed: true image: @@ -99,6 +100,9 @@ namespace: labels: alerte-secours-tls: wildcard +deployment: + strategy: {} + rollout: strategy: type: "BlueGreen"