Allow override kubernetes probes (#117)

- Allow overriding liveness and readiness probe
- Add optional startup probe

closes #118

Reviewed-on: https://gitea.com/gitea/helm-chart/pulls/117
Reviewed-by: luhahn <luhahn@noreply.gitea.io>
Reviewed-by: lafriks <lafriks@noreply.gitea.io>
Co-authored-by: Michael Kriese <michael.kriese@visualon.de>
Co-committed-by: Michael Kriese <michael.kriese@visualon.de>
This commit is contained in:
Michael Kriese 2021-03-01 22:46:05 +08:00 committed by lafriks
parent d1c58a2e77
commit 551f4e312e
3 changed files with 107 additions and 9 deletions

View File

@ -417,6 +417,34 @@ Annotations can be added to the Gitea pod.
|---------------------|-----------------------------------|------------------------------|
|gitea.config | Everything in app.ini can be configured with this dict. See Examples for more details | {} |
### Gitea Probes
Configure Liveness, Readiness and Startup [Probes](https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-startup-probes/)
| Parameter | Description | Default |
|---------------------|-----------------------------------|------------------------------|
|gitea.livenessProbe.enabled | Enable liveness probe | true |
|gitea.livenessProbe.initialDelaySeconds | Delay before probe start| 200 |
|gitea.livenessProbe.timeoutSeconds | probe timeout | 1 |
|gitea.livenessProbe.periodSeconds | period between probes | 10 |
|gitea.livenessProbe.successThreshold | Minimum consecutive success probes | 1 |
|gitea.livenessProbe.failureThreshold | Minimum consecutive error probes | 10 |
|gitea.readinessProbe.enabled | Enable readiness probe | true |
|gitea.readinessProbe.initialDelaySeconds | Delay before probe start| 200 |
|gitea.readinessProbe.timeoutSeconds | probe timeout | 1 |
|gitea.readinessProbe.periodSeconds | period between probes | 10 |
|gitea.readinessProbe.successThreshold | Minimum consecutive success probes | 1 |
|gitea.readinessProbe.failureThreshold | Minimum consecutive error probes | 10 |
|gitea.startupProbe.enabled | Enable startup probe | false |
|gitea.startupProbe.initialDelaySeconds | Delay before probe start| 200 |
|gitea.startupProbe.timeoutSeconds | probe timeout | 1 |
|gitea.startupProbe.periodSeconds | period between probes | 10 |
|gitea.startupProbe.successThreshold | Minimum consecutive success probes | 1 |
|gitea.startupProbe.failureThreshold | Minimum consecutive error probes | 10 |
|gitea.customLivenessProbe | Custom liveness probe (needs `gitea.livenessProbe.enabled: false`) | |
|gitea.customReadinessProbe | Custom readiness probe (needs `gitea.readinessProbe.enabled: false`) | |
|gitea.customStartupProbe | Custom startup probe (needs `gitea.startupProbe.enabled: false`) | |
### Memcached BuiltIn
Memcached is loaded as a dependency from [Bitnami](https://github.com/bitnami/charts/tree/master/bitnami/memcached) if enabled in the values. Complete Configuration can be taken from their website.

View File

@ -71,21 +71,45 @@ spec:
- name: profiler
containerPort: 6060
{{- end }}
{{- if .Values.gitea.livenessProbe.enabled }}
livenessProbe:
tcpSocket:
port: http
initialDelaySeconds: 200
timeoutSeconds: 1
periodSeconds: 10
successThreshold: 1
failureThreshold: 10
initialDelaySeconds: {{ .Values.gitea.livenessProbe.initialDelaySeconds }}
periodSeconds: {{ .Values.gitea.livenessProbe.periodSeconds }}
timeoutSeconds: {{ .Values.gitea.livenessProbe.timeoutSeconds }}
successThreshold: {{ .Values.gitea.livenessProbe.successThreshold }}
failureThreshold: {{ .Values.gitea.livenessProbe.failureThreshold }}
{{- else if .Values.gitea.customLivenessProbe }}
livenessProbe:
{{- toYaml .Values.gitea.customLivenessProbe | nindent 12 }}
{{- end }}
{{- if .Values.gitea.readinessProbe.enabled }}
readinessProbe:
tcpSocket:
port: http
initialDelaySeconds: 5
periodSeconds: 10
successThreshold: 1
failureThreshold: 3
initialDelaySeconds: {{ .Values.gitea.readinessProbe.initialDelaySeconds }}
periodSeconds: {{ .Values.gitea.readinessProbe.periodSeconds }}
timeoutSeconds: {{ .Values.gitea.readinessProbe.timeoutSeconds }}
successThreshold: {{ .Values.gitea.readinessProbe.successThreshold }}
failureThreshold: {{ .Values.gitea.readinessProbe.failureThreshold }}
{{- else if .Values.gitea.customReadinessProbe }}
readinessProbe:
{{- toYaml .Values.gitea.customReadinessProbe | nindent 12 }}
{{- end }}
{{- if .Values.gitea.startupProbe.enabled }}
startupProbe:
tcpSocket:
port: http
initialDelaySeconds: {{ .Values.gitea.startupProbe.initialDelaySeconds }}
periodSeconds: {{ .Values.gitea.startupProbe.periodSeconds }}
timeoutSeconds: {{ .Values.gitea.startupProbe.timeoutSeconds }}
successThreshold: {{ .Values.gitea.startupProbe.successThreshold }}
failureThreshold: {{ .Values.gitea.startupProbe.failureThreshold }}
{{- else if .Values.gitea.customStartupProbe }}
startupProbe:
{{- toYaml .Values.gitea.customStartupProbe | nindent 12 }}
{{- end }}
resources:
{{- toYaml .Values.resources | nindent 12 }}
securityContext:

View File

@ -169,6 +169,52 @@ gitea:
builtIn:
enabled: true
livenessProbe:
enabled: true
initialDelaySeconds: 200
timeoutSeconds: 1
periodSeconds: 10
successThreshold: 1
failureThreshold: 10
readinessProbe:
enabled: true
initialDelaySeconds: 5
timeoutSeconds: 1
periodSeconds: 10
successThreshold: 1
failureThreshold: 3
startupProbe:
enabled: false
initialDelaySeconds: 60
periodSeconds: 10
successThreshold: 1
failureThreshold: 10
# customLivenessProbe:
# httpGet:
# path: /user/login
# port: http
# initialDelaySeconds: 60
# periodSeconds: 10
# successThreshold: 1
# failureThreshold: 10
# customReadinessProbe:
# httpGet:
# path: /user/login
# port: http
# initialDelaySeconds: 5
# periodSeconds: 10
# successThreshold: 1
# failureThreshold: 3
# customStartupProbe:
# httpGet:
# path: /user/login
# port: http
# initialDelaySeconds: 60
# periodSeconds: 10
# successThreshold: 1
# failureThreshold: 10
memcached:
service:
port: 11211