feat(deployment): support custom probe settings
All checks were successful
Helm / helm-lint (push) Successful in 10s
Generate README / generate-parameters (push) Successful in 15s
Markdown linter / markdown-link-checker (push) Successful in 10s
Helm / helm-unittest (push) Successful in 18s
Markdown linter / markdown-lint (push) Successful in 9s
Release / publish-chart (push) Successful in 33s

This commit is contained in:
2025-12-07 22:14:19 +01:00
parent ab08c265f9
commit 9074030d78
4 changed files with 195 additions and 50 deletions

View File

@@ -339,7 +339,7 @@ spec:
### Deployment ### Deployment
| Name | Description | Value | | Name | Description | Value |
| -------------------------------------------------- | ---------------------------------------------------------------------------------------------------------- | --------------- | | ----------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------- | --------------- |
| `deployment.annotations` | Additional deployment annotations. | `{}` | | `deployment.annotations` | Additional deployment annotations. | `{}` |
| `deployment.labels` | Additional deployment labels. | `{}` | | `deployment.labels` | Additional deployment labels. | `{}` |
| `deployment.additionalContainers` | List of additional containers. | `[]` | | `deployment.additionalContainers` | List of additional containers. | `[]` |
@@ -359,6 +359,16 @@ spec:
| `deployment.athensProxy.image.repository` | Image repository, eg. `library/busybox`. | `gomods/athens` | | `deployment.athensProxy.image.repository` | Image repository, eg. `library/busybox`. | `gomods/athens` |
| `deployment.athensProxy.image.tag` | Custom image tag, eg. `0.1.0`. Defaults to `appVersion`. | `""` | | `deployment.athensProxy.image.tag` | Custom image tag, eg. `0.1.0`. Defaults to `appVersion`. | `""` |
| `deployment.athensProxy.image.pullPolicy` | Image pull policy. | `IfNotPresent` | | `deployment.athensProxy.image.pullPolicy` | Image pull policy. | `IfNotPresent` |
| `deployment.athensProxy.livenessProbe.failureThreshold` | Minimum consecutive failures for the probe to be considered failed after having succeeded. | `3` |
| `deployment.athensProxy.livenessProbe.initialDelaySeconds` | Number of seconds after the container has started before liveness probes are initiated. | `5` |
| `deployment.athensProxy.livenessProbe.periodSeconds` | How often (in seconds) to perform the probe. | `60` |
| `deployment.athensProxy.livenessProbe.successThreshold` | Minimum consecutive successes for the probe to be considered successful after having failed. | `1` |
| `deployment.athensProxy.livenessProbe.timeoutSeconds` | Number of seconds after which the probe times out. | `3` |
| `deployment.athensProxy.readinessProbe.failureThreshold` | Minimum consecutive failures for the probe to be considered failed after having succeeded. | `3` |
| `deployment.athensProxy.readinessProbe.initialDelaySeconds` | Number of seconds after the container has started before liveness probes are initiated. | `5` |
| `deployment.athensProxy.readinessProbe.periodSeconds` | How often (in seconds) to perform the probe. | `15` |
| `deployment.athensProxy.readinessProbe.successThreshold` | Minimum consecutive successes for the probe to be considered successful after having failed. | `1` |
| `deployment.athensProxy.readinessProbe.timeoutSeconds` | Number of seconds after which the probe times out. | `3` |
| `deployment.athensProxy.resources` | CPU and memory resources of the pod. | `{}` | | `deployment.athensProxy.resources` | CPU and memory resources of the pod. | `{}` |
| `deployment.athensProxy.securityContext` | Security context of the container of the deployment. | `{}` | | `deployment.athensProxy.securityContext` | Security context of the container of the deployment. | `{}` |
| `deployment.athensProxy.volumeMounts` | Additional volume mounts. | `[]` | | `deployment.athensProxy.volumeMounts` | Additional volume mounts. | `[]` |

View File

@@ -52,27 +52,27 @@ spec:
livenessProbe: livenessProbe:
exec: exec:
{{- if not .Values.certificate.enabled }} {{- if not .Values.certificate.enabled }}
command: [ "wget", "-T", "3", "-O", "/dev/null", "http://localhost:3000" ] command: [ "wget", "-T", "{{ .Values.deployment.athensProxy.livenessProbe.timeoutSeconds }}", "-O", "/dev/null", "http://localhost:3000" ]
{{- else }} {{- else }}
command: [ "wget", "--no-check-certificate", "-T", "3", "-O", "/dev/null", "https://localhost:3000" ] command: [ "wget", "--no-check-certificate", "-T", "{{ .Values.deployment.athensProxy.livenessProbe.timeoutSeconds }}", "-O", "/dev/null", "https://localhost:3000" ]
{{- end }} {{- end }}
failureThreshold: 3 failureThreshold: {{ .Values.deployment.athensProxy.livenessProbe.failureThreshold }}
initialDelaySeconds: 5 initialDelaySeconds: {{ .Values.deployment.athensProxy.livenessProbe.initialDelaySeconds }}
periodSeconds: 60 periodSeconds: {{ .Values.deployment.athensProxy.livenessProbe.periodSeconds }}
successThreshold: 1 successThreshold: {{ .Values.deployment.athensProxy.livenessProbe.successThreshold }}
timeoutSeconds: 3 timeoutSeconds: {{ .Values.deployment.athensProxy.livenessProbe.timeoutSeconds }}
readinessProbe: readinessProbe:
exec: exec:
{{- if not .Values.certificate.enabled }} {{- if not .Values.certificate.enabled }}
command: [ "wget", "-T", "3", "-O", "/dev/null", "http://localhost:3000" ] command: [ "wget", "-T", "{{ .Values.deployment.athensProxy.readinessProbe.timeoutSeconds }}", "-O", "/dev/null", "http://localhost:3000" ]
{{- else }} {{- else }}
command: [ "wget", "--no-check-certificate", "-T", "3", "-O", "/dev/null", "https://localhost:3000" ] command: [ "wget", "--no-check-certificate", "-T", "{{ .Values.deployment.athensProxy.readinessProbe.timeoutSeconds }}", "-O", "/dev/null", "https://localhost:3000" ]
{{- end }} {{- end }}
failureThreshold: 3 failureThreshold: {{ .Values.deployment.athensProxy.readinessProbe.failureThreshold }}
initialDelaySeconds: 5 initialDelaySeconds: {{ .Values.deployment.athensProxy.readinessProbe.initialDelaySeconds }}
periodSeconds: 15 periodSeconds: {{ .Values.deployment.athensProxy.readinessProbe.periodSeconds }}
successThreshold: 1 successThreshold: {{ .Values.deployment.athensProxy.readinessProbe.successThreshold }}
timeoutSeconds: 3 timeoutSeconds: {{ .Values.deployment.athensProxy.readinessProbe.timeoutSeconds }}
ports: ports:
- name: http - name: http
containerPort: 3000 containerPort: 3000

View File

@@ -67,6 +67,46 @@ tests:
path: spec.template.spec.containers[0].imagePullPolicy path: spec.template.spec.containers[0].imagePullPolicy
value: IfNotPresent value: IfNotPresent
template: templates/deployment.yaml template: templates/deployment.yaml
- equal:
path: spec.template.spec.containers[0].livenessProbe.failureThreshold
value: 3
template: templates/deployment.yaml
- equal:
path: spec.template.spec.containers[0].livenessProbe.initialDelaySeconds
value: 5
template: templates/deployment.yaml
- equal:
path: spec.template.spec.containers[0].livenessProbe.periodSeconds
value: 60
template: templates/deployment.yaml
- equal:
path: spec.template.spec.containers[0].livenessProbe.successThreshold
value: 1
template: templates/deployment.yaml
- equal:
path: spec.template.spec.containers[0].livenessProbe.timeoutSeconds
value: 3
template: templates/deployment.yaml
- equal:
path: spec.template.spec.containers[0].readinessProbe.failureThreshold
value: 3
template: templates/deployment.yaml
- equal:
path: spec.template.spec.containers[0].readinessProbe.initialDelaySeconds
value: 5
template: templates/deployment.yaml
- equal:
path: spec.template.spec.containers[0].readinessProbe.periodSeconds
value: 15
template: templates/deployment.yaml
- equal:
path: spec.template.spec.containers[0].readinessProbe.successThreshold
value: 1
template: templates/deployment.yaml
- equal:
path: spec.template.spec.containers[0].readinessProbe.timeoutSeconds
value: 3
template: templates/deployment.yaml
- notExists: - notExists:
path: spec.template.spec.containers[0].resources path: spec.template.spec.containers[0].resources
template: templates/deployment.yaml template: templates/deployment.yaml
@@ -221,6 +261,77 @@ tests:
value: Always value: Always
template: templates/deployment.yaml template: templates/deployment.yaml
- it: Test custom livenessProbe
set:
# Normal test values
deployment.athensProxy.livenessProbe:
failureThreshold: 5
initialDelaySeconds: 10
periodSeconds: 120
successThreshold: 3
timeoutSeconds: 5
asserts:
- equal:
path: spec.template.spec.containers[0].livenessProbe.failureThreshold
value: 5
template: templates/deployment.yaml
- equal:
path: spec.template.spec.containers[0].livenessProbe.initialDelaySeconds
value: 10
template: templates/deployment.yaml
- equal:
path: spec.template.spec.containers[0].livenessProbe.periodSeconds
value: 120
template: templates/deployment.yaml
- equal:
path: spec.template.spec.containers[0].livenessProbe.successThreshold
value: 3
template: templates/deployment.yaml
- equal:
path: spec.template.spec.containers[0].livenessProbe.timeoutSeconds
value: 5
template: templates/deployment.yaml
- contains:
path: spec.template.spec.containers[0].livenessProbe.exec.command
content: "5"
template: templates/deployment.yaml
- it: Test custom readinessProbe
set:
# Normal test values
deployment.athensProxy.readinessProbe:
failureThreshold: 10
initialDelaySeconds: 10
periodSeconds: 30
successThreshold: 5
timeoutSeconds: 5
asserts:
- equal:
path: spec.template.spec.containers[0].readinessProbe.failureThreshold
value: 10
template: templates/deployment.yaml
- equal:
path: spec.template.spec.containers[0].readinessProbe.initialDelaySeconds
value: 10
template: templates/deployment.yaml
- equal:
path: spec.template.spec.containers[0].readinessProbe.periodSeconds
value: 30
template: templates/deployment.yaml
- equal:
path: spec.template.spec.containers[0].readinessProbe.successThreshold
value: 5
template: templates/deployment.yaml
- equal:
path: spec.template.spec.containers[0].readinessProbe.timeoutSeconds
value: 5
template: templates/deployment.yaml
- contains:
path: spec.template.spec.containers[0].readinessProbe.exec.command
content: "5"
template: templates/deployment.yaml
- it: Test custom resource limits and requests - it: Test custom resource limits and requests
set: set:
# Ensure that the secrets and config maps are well configured. # Ensure that the secrets and config maps are well configured.

View File

@@ -415,6 +415,30 @@ deployment:
tag: "" tag: ""
pullPolicy: IfNotPresent pullPolicy: IfNotPresent
## @param deployment.athensProxy.livenessProbe.failureThreshold Minimum consecutive failures for the probe to be considered failed after having succeeded.
## @param deployment.athensProxy.livenessProbe.initialDelaySeconds Number of seconds after the container has started before liveness probes are initiated.
## @param deployment.athensProxy.livenessProbe.periodSeconds How often (in seconds) to perform the probe.
## @param deployment.athensProxy.livenessProbe.successThreshold Minimum consecutive successes for the probe to be considered successful after having failed.
## @param deployment.athensProxy.livenessProbe.timeoutSeconds Number of seconds after which the probe times out.
livenessProbe:
failureThreshold: 3
initialDelaySeconds: 5
periodSeconds: 60
successThreshold: 1
timeoutSeconds: 3
## @param deployment.athensProxy.readinessProbe.failureThreshold Minimum consecutive failures for the probe to be considered failed after having succeeded.
## @param deployment.athensProxy.readinessProbe.initialDelaySeconds Number of seconds after the container has started before liveness probes are initiated.
## @param deployment.athensProxy.readinessProbe.periodSeconds How often (in seconds) to perform the probe.
## @param deployment.athensProxy.readinessProbe.successThreshold Minimum consecutive successes for the probe to be considered successful after having failed.
## @param deployment.athensProxy.readinessProbe.timeoutSeconds Number of seconds after which the probe times out.
readinessProbe:
failureThreshold: 3
initialDelaySeconds: 5
periodSeconds: 15
successThreshold: 1
timeoutSeconds: 3
## @param deployment.athensProxy.resources CPU and memory resources of the pod. ## @param deployment.athensProxy.resources CPU and memory resources of the pod.
resources: {} resources: {}
# limits: # limits: