Skip to content

Commit

Permalink
Allow for service, readinessProbe and livenessProbe to be disabled
Browse files Browse the repository at this point in the history
  • Loading branch information
blenkjon committed Jul 17, 2024
1 parent 2cbf1a8 commit 7ed6ab7
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 3 deletions.
6 changes: 6 additions & 0 deletions chart-tests/application/ci/test-disabled-service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
service:
disabled: true
readinessProbe:
disabled: true
livenessProbe:
disabled: true
2 changes: 1 addition & 1 deletion charts/application/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ maintainers:
- name: MediaMarktSaturn
url: https://github.com/MediaMarktSaturn
appVersion: 1.0.0
version: 1.18.0
version: 1.19.0
5 changes: 4 additions & 1 deletion charts/application/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# application

![Version: 1.18.0](https://img.shields.io/badge/Version-1.18.0-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 1.0.0](https://img.shields.io/badge/AppVersion-1.0.0-informational?style=flat-square)
![Version: 1.19.0](https://img.shields.io/badge/Version-1.19.0-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 1.0.0](https://img.shields.io/badge/AppVersion-1.0.0-informational?style=flat-square)

Generic application chart with common requirements of a typical workload.

Expand All @@ -24,12 +24,14 @@ Generic application chart with common requirements of a typical workload.
| autoscaling.minReplicaCount | int | `1` | |
| autoscaling.maxReplicaCount | int | `1` | |
| autoscaling.averageUtilization.cpu | int | `80` | |
| livenessProbe.disabled | bool | `false` | |
| livenessProbe.path | string | `"/.well-known/live"` | |
| livenessProbe.cmd | list | `[]` | |
| livenessProbe.initialDelaySeconds | int | `10` | |
| livenessProbe.periodSeconds | int | `10` | |
| livenessProbe.failureThreshold | int | `3` | |
| livenessProbe.timeoutSeconds | int | `5` | |
| readinessProbe.disabled | bool | `false` | |
| readinessProbe.path | string | `"/.well-known/ready"` | |
| readinessProbe.cmd | list | `[]` | |
| readinessProbe.initialDelaySeconds | int | `10` | |
Expand All @@ -49,6 +51,7 @@ Generic application chart with common requirements of a typical workload.
| image.repositoryProvider | string | `"generic"` | |
| image.imageAutomationNamespace | string | `nil` | |
| image.pullSecrets | list | `[]` | |
| service.disabled | bool | `false` | |
| service.port | int | `80` | |
| service.timeout | string | `"120s"` | |
| service.annotations | object | `{}` | |
Expand Down
4 changes: 4 additions & 0 deletions charts/application/templates/_podTemplate.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,7 @@ spec:
containerPort: {{ $ap.containerPort }}
protocol: {{ $ap.protocol }}
{{- end }}
{{- if not .Values.livenessProbe.disabled }}
livenessProbe:
{{- if .Values.livenessProbe.cmd }}
exec:
Expand All @@ -246,6 +247,8 @@ spec:
periodSeconds: {{ .Values.livenessProbe.periodSeconds }}
failureThreshold: {{ .Values.livenessProbe.failureThreshold }}
timeoutSeconds: {{ .Values.livenessProbe.timeoutSeconds }}
{{- end }}
{{- if not .Values.readinessProbe.disabled }}
readinessProbe:
{{- if .Values.readinessProbe.cmd }}
exec:
Expand All @@ -262,6 +265,7 @@ spec:
periodSeconds: {{ .Values.readinessProbe.periodSeconds }}
failureThreshold: {{ .Values.readinessProbe.failureThreshold }}
timeoutSeconds: {{ .Values.readinessProbe.timeoutSeconds }}
{{- end }}
resources:
{{- toYaml .Values.resources | nindent 8 }}
volumeMounts: {{ if not (or .Values.secretVolumes .Values.configVolumes .Values.serviceAccount.secretName .Values.encryptedSecret.mountPath .Values.volumeMounts) -}}[]{{- end -}}
Expand Down
2 changes: 1 addition & 1 deletion charts/application/templates/k8s-service.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{{- if not (and .Values.canary.enabled .Values.istio.enabled ) }}
{{- if and (not .Values.service.disabled) (not (and .Values.canary.enabled .Values.istio.enabled)) }}
apiVersion: v1
kind: Service
metadata:
Expand Down
5 changes: 5 additions & 0 deletions charts/application/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ autoscaling:

# Check if the container is running
livenessProbe:
# Disable the liveness probe
disabled: false
path: /.well-known/live
# Use a command to check liveness from inside the container, for example ['curl', '-f', 'http://localhost/health/live'].
# This will take precedence over the given `path` value, if provided.
Expand All @@ -36,6 +38,8 @@ livenessProbe:

# Check if the container are able to service requests
readinessProbe:
# Disable the readiness probe
disabled: false
path: /.well-known/ready
# Use a command to check readiness from inside the container, for example ['curl', '-f', 'http://localhost/health/ready'].
# This will take precedence over the given `path` value, if provided.
Expand Down Expand Up @@ -82,6 +86,7 @@ image:
pullSecrets: []

service:
disabled: false
port: 80
timeout: 120s
annotations: {}
Expand Down

0 comments on commit 7ed6ab7

Please sign in to comment.