From bf1772a44e07bf2eaf3bfba018de27731bed4fa9 Mon Sep 17 00:00:00 2001 From: Thomas Ingvarsson Date: Sat, 14 Nov 2020 21:02:13 +0100 Subject: [PATCH] [unifi] Add liveness and readiness probe configuration (#149) * Parameterize timing of livenessProbe * Parameterize timing of readinessProbe * Bump version, no change in default behaviour * Update README.md with new configuration parameters Signed-off-by: Thomas Ingvarsson Co-authored-by: Jeff Billimek --- charts/unifi/Chart.yaml | 2 +- charts/unifi/README.md | 12 ++++++++++++ charts/unifi/templates/deployment.yaml | 16 ++++++++++++++-- charts/unifi/values.yaml | 18 ++++++++++++++++++ 4 files changed, 45 insertions(+), 3 deletions(-) diff --git a/charts/unifi/Chart.yaml b/charts/unifi/Chart.yaml index 2367aa4a..374bdddf 100644 --- a/charts/unifi/Chart.yaml +++ b/charts/unifi/Chart.yaml @@ -2,7 +2,7 @@ apiVersion: v2 appVersion: 5.14.23 description: Ubiquiti Network's Unifi Controller name: unifi -version: 1.1.1 +version: 1.2.0 keywords: - ubiquiti - unifi diff --git a/charts/unifi/README.md b/charts/unifi/README.md index 29670cb7..4650eeda 100644 --- a/charts/unifi/README.md +++ b/charts/unifi/README.md @@ -142,6 +142,18 @@ The following tables lists the configurable parameters of the Unifi chart and th | `extraConfigFiles` | `{}` | Dictionary containing files mounted to `/configmap` inside the pod (See [values.yaml](values.yaml) for examples) | | `extraJvmOpts` | `[]` | List of additional JVM options, e.g. `["-Dlog4j.configurationFile=file:/configmap/log4j2.xml"]` | | `resources` | `{}` | CPU/Memory resource requests/limits | +| `livenessProbe.enabled` | `true` | Turn on and off liveness probe | +| `livenessProbe.initialDelaySeconds` | `30` | Delay before liveness probe is initiated | +| `livenessProbe.periodSeconds` | `15` | How often to perform the probe | +| `livenessProbe.timeoutSeconds` | `5` | When the probe times out | +| `livenessProbe.failureThreshold` | `3` | Minimum consecutive failures for the probe | +| `livenessProbe.successThreshold` | `1` | Minimum consecutive successes for the probe | +| `readinessProbe.enabled` | `true` | Turn on and off readiness probe | +| `readinessProbe.initialDelaySeconds` | `30` | Delay before readiness probe is initiated | +| `readinessProbe.periodSeconds` | `15` | How often to perform the probe | +| `readinessProbe.timeoutSeconds` | `5` | When the probe times out | +| `readinessProbe.failureThreshold` | `3` | Minimum consecutive failures for the probe | +| `readinessProbe.successThreshold` | `1` | Minimum consecutive successes for the probe | | `nodeSelector` | `{}` | Node labels for pod assignment | | `tolerations` | `[]` | Toleration labels for pod assignment | | `affinity` | `{}` | Affinity settings for pod assignment | diff --git a/charts/unifi/templates/deployment.yaml b/charts/unifi/templates/deployment.yaml index 5c9e833c..5233dfaf 100644 --- a/charts/unifi/templates/deployment.yaml +++ b/charts/unifi/templates/deployment.yaml @@ -85,18 +85,30 @@ spec: add: - SETFCAP {{- end }} + {{- if .Values.livenessProbe.enabled }} livenessProbe: httpGet: path: /status port: https-gui scheme: HTTPS - initialDelaySeconds: 30 + initialDelaySeconds: {{ .Values.livenessProbe.initialDelaySeconds }} + periodSeconds: {{ .Values.livenessProbe.periodSeconds }} + timeoutSeconds: {{ .Values.livenessProbe.timeoutSeconds }} + successThreshold: {{ .Values.livenessProbe.successThreshold }} + failureThreshold: {{ .Values.livenessProbe.failureThreshold }} + {{- end }} + {{- if .Values.readinessProbe.enabled }} readinessProbe: httpGet: path: /status port: https-gui scheme: HTTPS - initialDelaySeconds: 15 + initialDelaySeconds: {{ .Values.readinessProbe.initialDelaySeconds }} + periodSeconds: {{ .Values.readinessProbe.periodSeconds }} + timeoutSeconds: {{ .Values.readinessProbe.timeoutSeconds }} + successThreshold: {{ .Values.readinessProbe.successThreshold }} + failureThreshold: {{ .Values.readinessProbe.failureThreshold }} + {{- end }} env: - name: UNIFI_HTTP_PORT value: "{{ .Values.controllerService.port }}" diff --git a/charts/unifi/values.yaml b/charts/unifi/values.yaml index 058d4ae6..11a7d94c 100644 --- a/charts/unifi/values.yaml +++ b/charts/unifi/values.yaml @@ -341,6 +341,24 @@ resources: {} # cpu: 100m # memory: 128Mi +## Liveness and readiness probe values +## Ref: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle/#container-probes +## +livenessProbe: + enabled: true + initialDelaySeconds: 30 + periodSeconds: 10 + timeoutSeconds: 1 + failureThreshold: 3 + successThreshold: 1 +readinessProbe: + enabled: true + initialDelaySeconds: 15 + periodSeconds: 10 + timeoutSeconds: 1 + failureThreshold: 3 + successThreshold: 1 + nodeSelector: {} tolerations: []