Skip to content

Commit

Permalink
Add deployment strategy feature
Browse files Browse the repository at this point in the history
Signed-off-by: Ashwani Singh <[email protected]>
  • Loading branch information
ashwani-opstree committed Jul 20, 2024
1 parent 555b0ee commit 780b430
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 6 deletions.
21 changes: 16 additions & 5 deletions charts/microservice/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,23 +5,34 @@ 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 }}
labels:
{{- 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 }}
template:
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:
Expand Down Expand Up @@ -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 }}
Expand Down Expand Up @@ -96,4 +107,4 @@ spec:
{{- with .Values.deployment.tolerations }}
tolerations:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- end }}
10 changes: 9 additions & 1 deletion charts/microservice/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 780b430

Please sign in to comment.