From 658b1b58d333fcbdfe3983d10034f8b918f014f7 Mon Sep 17 00:00:00 2001 From: Ashwani Singh Date: Sat, 20 Jul 2024 15:30:40 +0530 Subject: [PATCH 1/4] 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 From 2ef6f7f64353c43ab44c2a5410579a3aabc6ce13 Mon Sep 17 00:00:00 2001 From: Ashwani Singh Date: Sat, 20 Jul 2024 15:32:00 +0530 Subject: [PATCH 2/4] Fix Maintainers Signed-off-by: Ashwani Singh --- charts/microservice/Chart.yaml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/charts/microservice/Chart.yaml b/charts/microservice/Chart.yaml index 381b6b8d..2a0a8986 100644 --- a/charts/microservice/Chart.yaml +++ b/charts/microservice/Chart.yaml @@ -5,6 +5,5 @@ type: application version: 0.1.3 appVersion: "0.1.2" maintainers: - - name: Ashwani Singh - email: ashwani.singh@opstree.com - - name: Shikha Tripathi + - name: ashwani-opstree + - name: tripathishikha1 From ccbc743d42dfeccca25e9e381ac486b303852872 Mon Sep 17 00:00:00 2001 From: Ashwani Singh Date: Sat, 20 Jul 2024 15:32:36 +0530 Subject: [PATCH 3/4] Bump up chart version Signed-off-by: Ashwani Singh --- charts/microservice/Chart.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/charts/microservice/Chart.yaml b/charts/microservice/Chart.yaml index 2a0a8986..91c103d7 100644 --- a/charts/microservice/Chart.yaml +++ b/charts/microservice/Chart.yaml @@ -2,7 +2,7 @@ apiVersion: v2 name: microservice description: Basic helm chart for deploying microservices on kubernetes with best practices type: application -version: 0.1.3 +version: 0.1.4 appVersion: "0.1.2" maintainers: - name: ashwani-opstree From 7f4e354d75e7e4d405f9894b684639dc6e5a019e Mon Sep 17 00:00:00 2001 From: Ashwani Singh Date: Sat, 20 Jul 2024 16:27:14 +0530 Subject: [PATCH 4/4] Fix parameter name Signed-off-by: Ashwani Singh --- charts/microservice/templates/deployment.yaml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/charts/microservice/templates/deployment.yaml b/charts/microservice/templates/deployment.yaml index 8880ea9c..7795ae8d 100644 --- a/charts/microservice/templates/deployment.yaml +++ b/charts/microservice/templates/deployment.yaml @@ -27,10 +27,10 @@ spec: metadata: labels: {{- include "microservice.selectorLabels" . | nindent 8 }} - {{- if .Values.deployment.annotations }} + {{- if .Values.deployment.podAnnotations }} annotations: - {{- range $key, $value := .Values.deployment.podAnnotations }} - {{ $key }}: {{ $value }} + {{- range $key, $value := .Values.deployment.podAnnotations }} + {{ $key }}: {{ $value }} {{- end }} {{- end }} spec: