From 780b4308e74b5d4ff1d8bb8aa00dc68a3b1c8e00 Mon Sep 17 00:00:00 2001 From: Ashwani Singh Date: Sat, 20 Jul 2024 15:30:40 +0530 Subject: [PATCH] Add deployment strategy feature Signed-off-by: Ashwani Singh --- charts/microservice/templates/deployment.yaml | 21 ++++++++++++++----- charts/microservice/values.yaml | 10 ++++++++- 2 files changed, 25 insertions(+), 6 deletions(-) diff --git a/charts/microservice/templates/deployment.yaml b/charts/microservice/templates/deployment.yaml index 9bf469a8..8880ea9c 100644 --- a/charts/microservice/templates/deployment.yaml +++ b/charts/microservice/templates/deployment.yaml @@ -5,9 +5,9 @@ kind: Deployment metadata: name: {{ include "microservice.fullname" . }}-app namespace: {{ .Values.global.namespace | quote }} - {{- if .Values.annotations }} + {{- if .Values.deployment.annotations }} annotations: - {{- range $key, $value := .Values.annotations }} + {{- range $key, $value := .Values.deployment.annotations }} {{ $key }}: {{ $value }} {{- end }} {{- end }} @@ -15,6 +15,11 @@ metadata: {{- include "microservice.labels" . | nindent 4 }} spec: replicas: {{ .Values.global.replicaCount }} + {{- if .Values.deployment.strategy }} + strategy: + {{- toYaml .Values.deployment.strategy | nindent 4 }} + {{- end }} + terminationGracePeriodSeconds: {{ .Values.deployment.terminationGracePeriodSeconds }} selector: matchLabels: {{- include "microservice.selectorLabels" . | nindent 6 }} @@ -22,6 +27,12 @@ spec: metadata: labels: {{- include "microservice.selectorLabels" . | nindent 8 }} + {{- if .Values.deployment.annotations }} + annotations: + {{- range $key, $value := .Values.deployment.podAnnotations }} + {{ $key }}: {{ $value }} + {{- end }} + {{- end }} spec: {{- with .Values.imagePullSecrets }} imagePullSecrets: @@ -51,11 +62,11 @@ spec: value: {{ $value | quote }} {{- end }} {{- end }} - {{- if .Values.deployment.livenessProbe }} + {{- if and .Values.deployment.healthProbes.enabled .Values.deployment.livenessProbe }} livenessProbe: {{- toYaml .Values.deployment.livenessProbe | nindent 12 }} {{- end }} - {{- if .Values.deployment.readinessProbe }} + {{- if and .Values.deployment.healthProbes.enabled .Values.deployment.readinessProbe }} readinessProbe: {{- toYaml .Values.deployment.readinessProbe | nindent 12 }} {{- end }} @@ -96,4 +107,4 @@ spec: {{- with .Values.deployment.tolerations }} tolerations: {{- toYaml . | nindent 8 }} - {{- end }} \ No newline at end of file + {{- end }} diff --git a/charts/microservice/values.yaml b/charts/microservice/values.yaml index e3da4f73..99757b40 100644 --- a/charts/microservice/values.yaml +++ b/charts/microservice/values.yaml @@ -21,15 +21,23 @@ deployment: tag: "" pullPolicy: IfNotPresent + strategy: {} + # Annotation for the Deployment annotations: {} + podAnnotations: {} + + terminationGracePeriodSeconds: 30 + + healthProbes: + enabled: true # livenessProbe: {} livenessProbe: # httpGet: # path: "/" # port: http - initialDelaySeconds: 250 + initialDelaySeconds: 30 periodSeconds: 10 timeoutSeconds: 5 successThreshold: 1