Default probes implementation (#3)

* Added code for Makefile manifests

* Done changes for default value

* Added code for default values for liveness probe

* Updated code to handle default and non-default value for liveness check

* Updated code to handle default and non-default value for readiness check

* Updated code
This commit is contained in:
Sandeep Rawat 2020-11-09 11:50:27 +05:30 committed by GitHub
parent 1816f005bf
commit 00974ab3e5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 37 additions and 13 deletions

View File

@ -24,22 +24,30 @@ spec:
{{- range .Values.containers }}
- name: {{ .name }}
image: "{{ .image.repository }}:{{ .image.tag }}"
imagePullPolicy: {{ .image.pullPolicy | default "IfNotPresent" }}
imagePullPolicy: {{ .image.pullPolicy | default $.Values.default.imagePullPolicy }}
ports:
- name: {{ .ports.name }}
containerPort: {{ .ports.containerPort }}
protocol: {{ .ports.protocol }}
{{- with .probes.liveness }}
{{- if .probes }}
{{- if .probes.liveness }}
livenessProbe:
httpGet:
path: {{ .path }}
port: {{ .port }}
{{- end }}
{{- with .probes.readiness }}
{{- toYaml .probes.liveness | nindent 14 }}
{{- end }}
{{- if .probes.readiness }}
readinessProbe:
httpGet:
path: {{ .path }}
port: {{ .port }}
{{- toYaml .probes.readiness | nindent 14 }}
{{- end }}
{{- else }}
livenessProbe:
httpGet:
{{- toYaml $.Values.default.probes.liveness | nindent 14 }}
readinessProbe:
httpGet:
{{- toYaml $.Values.default.probes.readiness | nindent 14 }}
{{- end }}
resources:
{{- toYaml .resources | nindent 12 }}

View File

@ -8,6 +8,13 @@ podAnnotations:
podSecurityContext:
fsGroup: 2000
default:
probes:
liveness:
path: /health/live
port: http
readiness:
path: /health/ready
port: http
imagePullPolicy: IfNotPresent
containers:
- name: nginx
@ -20,10 +27,7 @@ containers:
protocol: TCP
probes:
liveness:
path: /
port: http
readiness:
path: /
path: /health
port: http
resources:
limits:
@ -41,5 +45,17 @@ containers:
name: http
containerPort: 80
protocol: TCP
probes: {}
probes:
readiness:
path: /health
port: http
- name: nginx3
image:
repository: nginx
pullPolicy: Always
tag: "1.17.9"
ports:
name: http
containerPort: 80
protocol: TCP
resources: {}