Skip to content

Commit

Permalink
OPS-842 add probe configuration options
Browse files Browse the repository at this point in the history
  • Loading branch information
Markus Tippmann committed Jul 11, 2024
1 parent 66724b7 commit 1e6be3a
Show file tree
Hide file tree
Showing 4 changed files with 153 additions and 6 deletions.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ Requriements:
## Useful chart debugging commands

```bash
# print resolved template on console (requires a test deployment-values.yaml)
helm template --debug -f deployment-values.yaml --set buildtype=dev --set gitlabImage.repository=testrepo --set name=testname --set namespace=testnamespace helm-charts/project-template/

# create a new namespace (k8s admin access required)
kubectl create namespace namespace-example-1

Expand Down
12 changes: 12 additions & 0 deletions project-template/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,18 @@ More Information: [https://kubernetes.io/docs/tasks/configure-pod-container/conf
probe:
path: /
port: http
startup:
initialDelaySeconds: 1
periodSeconds: 10
successThreshold: 1
failureThreshold: 30
timeoutSeconds: 1
liveness:
initialDelaySeconds: 1
periodSeconds: 10
successThreshold: 1
failureThreshold: 1
timeoutSeconds: 1

> **OPTIONAL** - Default: no liveness/startup probe

Expand Down
74 changes: 70 additions & 4 deletions project-template/templates/cronjob.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,27 +40,93 @@ spec:
{{- else }}
image: {{ printf "%s:%s" .Values.gitlabImage.repository .Values.gitlabImage.tag }}
{{- end }}
{{- if .Values.probe -}}
{{- if .Values.probe }}
livenessProbe:
httpGet:
path: {{ .Values.probe.path }}
{{- if .Values.probe.port }}
port: {{ .Values.probe.port }}
{{- else -}}
{{- else if .Values.containerPort }}
port: {{ .Values.containerPort }}
{{- end -}}
{{- else }}
port: http
{{- end }}
{{- if .Values.probe.liveness }}
{{- if .Values.probe.liveness.initialDelaySeconds }}
initialDelaySeconds: {{ .Values.probe.liveness.initialDelaySeconds }}
{{- else }}
initialDelaySeconds: 1
{{- end }}
{{- if .Values.probe.liveness.failureThreshold }}
failureThreshold: {{ .Values.probe.liveness.failureThreshold }}
{{- else }}
failureThreshold: 1
{{- end }}
{{- if .Values.probe.liveness.successThreshold }}
successThreshold: {{ .Values.probe.liveness.successThreshold }}
{{- else }}
successThreshold: 1
{{- end }}
{{- if .Values.probe.liveness.periodSeconds }}
periodSeconds: {{ .Values.probe.liveness.periodSeconds }}
{{- else }}
periodSeconds: 10
{{- end }}
{{- if .Values.probe.startup.timeoutSeconds }}
timeoutSeconds: {{ .Values.probe.startup.timeoutSeconds }}
{{- else }}
timeoutSeconds: 10
{{- end }}
{{- else }}
initialDelaySeconds: 1
failureThreshold: 1
successThreshold: 1
periodSeconds: 10
timeoutSeconds: 1
{{- end }}
startupProbe:
httpGet:
path: {{ .Values.probe.path }}
{{- if .Values.probe.port }}
port: {{ .Values.probe.port }}
{{- else }}
{{- else if .Values.containerPort }}
port: {{ .Values.containerPort }}
{{- else }}
port: http
{{- end }}
{{- if .Values.probe.startup }}
{{- if .Values.probe.startup.initialDelaySeconds }}
initialDelaySeconds: {{ .Values.probe.startup.initialDelaySeconds }}
{{- else }}
initialDelaySeconds: 1
{{- end }}
{{- if .Values.probe.startup.failureThreshold }}
failureThreshold: {{ .Values.probe.startup.failureThreshold }}
{{- else }}
failureThreshold: 30
{{- end }}
{{- if .Values.probe.startup.successThreshold }}
successThreshold: {{ .Values.probe.startup.successThreshold }}
{{- else }}
successThreshold: 1
{{- end }}
{{- if .Values.probe.startup.periodSeconds }}
periodSeconds: {{ .Values.probe.startup.periodSeconds }}
{{- else }}
periodSeconds: 10
{{- end }}
{{- if .Values.probe.startup.timeoutSeconds }}
timeoutSeconds: {{ .Values.probe.startup.timeoutSeconds }}
{{- else }}
timeoutSeconds: 10
{{- end }}
{{- else }}
initialDelaySeconds: 1
failureThreshold: 30
successThreshold: 1
periodSeconds: 10
timeoutSeconds: 1
{{- end }}
{{ end }}
# We do not need to specify a pullPolicy, because we want to use the default behaviour:
# Defaults to 'Always' if image tag is 'latest', else set to 'IfNotPresent'
Expand Down
70 changes: 68 additions & 2 deletions project-template/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -48,21 +48,87 @@ spec:
path: {{ .Values.probe.path }}
{{- if .Values.probe.port }}
port: {{ .Values.probe.port }}
{{- else }}
{{- else if .Values.containerPort }}
port: {{ .Values.containerPort }}
{{- else }}
port: http
{{- end }}
{{- if .Values.probe.liveness }}
{{- if .Values.probe.liveness.initialDelaySeconds }}
initialDelaySeconds: {{ .Values.probe.liveness.initialDelaySeconds }}
{{- else }}
initialDelaySeconds: 1
{{- end }}
{{- if .Values.probe.liveness.failureThreshold }}
failureThreshold: {{ .Values.probe.liveness.failureThreshold }}
{{- else }}
failureThreshold: 1
{{- end }}
{{- if .Values.probe.liveness.successThreshold }}
successThreshold: {{ .Values.probe.liveness.successThreshold }}
{{- else }}
successThreshold: 1
{{- end }}
{{- if .Values.probe.liveness.periodSeconds }}
periodSeconds: {{ .Values.probe.liveness.periodSeconds }}
{{- else }}
periodSeconds: 10
{{- end }}
{{- if .Values.probe.startup.timeoutSeconds }}
timeoutSeconds: {{ .Values.probe.startup.timeoutSeconds }}
{{- else }}
timeoutSeconds: 10
{{- end }}
{{- else }}
initialDelaySeconds: 1
failureThreshold: 1
successThreshold: 1
periodSeconds: 10
timeoutSeconds: 1
{{- end }}
startupProbe:
httpGet:
path: {{ .Values.probe.path }}
{{- if .Values.probe.port }}
port: {{ .Values.probe.port }}
{{- else }}
{{- else if .Values.containerPort }}
port: {{ .Values.containerPort }}
{{- else }}
port: http
{{- end }}
{{- if .Values.probe.startup }}
{{- if .Values.probe.startup.initialDelaySeconds }}
initialDelaySeconds: {{ .Values.probe.startup.initialDelaySeconds }}
{{- else }}
initialDelaySeconds: 1
{{- end }}
{{- if .Values.probe.startup.failureThreshold }}
failureThreshold: {{ .Values.probe.startup.failureThreshold }}
{{- else }}
failureThreshold: 30
{{- end }}
{{- if .Values.probe.startup.successThreshold }}
successThreshold: {{ .Values.probe.startup.successThreshold }}
{{- else }}
successThreshold: 1
{{- end }}
{{- if .Values.probe.startup.periodSeconds }}
periodSeconds: {{ .Values.probe.startup.periodSeconds }}
{{- else }}
periodSeconds: 10
{{- end }}
{{- if .Values.probe.startup.timeoutSeconds }}
timeoutSeconds: {{ .Values.probe.startup.timeoutSeconds }}
{{- else }}
timeoutSeconds: 10
{{- end }}
{{- else }}
initialDelaySeconds: 1
failureThreshold: 30
successThreshold: 1
periodSeconds: 10
timeoutSeconds: 1
{{- end }}
{{ end }}
# We do not need to specify a pullPolicy, because we want to use the default behaviour:
# Defaults to 'Always' if image tag is 'latest', else set to 'IfNotPresent'
Expand Down

0 comments on commit 1e6be3a

Please sign in to comment.