From d94c8a2da4bf54fa5a0dcd660837add664387c5e Mon Sep 17 00:00:00 2001 From: Joel Damata Date: Wed, 31 May 2023 09:30:07 -0400 Subject: [PATCH] Add readiness/liveness probes (#101) * Add readiness/liveness probes Signed-off-by: damatj * Bump chart yaml version Signed-off-by: damatj * Fix linting Signed-off-by: damatj * Fix linting Signed-off-by: damatj * Description in wrong location Signed-off-by: damatj * add ci file Signed-off-by: damatj * run precommit Signed-off-by: damatj --------- Signed-off-by: damatj Co-authored-by: damatj --- charts/backstage/Chart.yaml | 2 +- charts/backstage/README.md | 4 +- charts/backstage/ci/probes-values.yaml | 21 ++++++++++ .../templates/backstage-deployment.yaml | 6 +++ charts/backstage/values.schema.json | 40 +++++++++++++++++++ charts/backstage/values.yaml | 32 +++++++++++++++ 6 files changed, 103 insertions(+), 2 deletions(-) create mode 100644 charts/backstage/ci/probes-values.yaml diff --git a/charts/backstage/Chart.yaml b/charts/backstage/Chart.yaml index 2a65069..f0aaf15 100644 --- a/charts/backstage/Chart.yaml +++ b/charts/backstage/Chart.yaml @@ -38,4 +38,4 @@ sources: # This is the chart version. This version number should be incremented each time you make changes # to the chart and its templates, including the app version. # Versions are expected to follow Semantic Versioning (https://semver.org/) -version: 1.0.0 +version: 1.1.0 diff --git a/charts/backstage/README.md b/charts/backstage/README.md index 489a5e9..d5dfdbb 100644 --- a/charts/backstage/README.md +++ b/charts/backstage/README.md @@ -2,7 +2,7 @@ # Backstage Helm Chart [![Artifact Hub](https://img.shields.io/endpoint?url=https://artifacthub.io/badge/repository/backstage)](https://artifacthub.io/packages/search?repo=backstage) -![Version: 1.0.0](https://img.shields.io/badge/Version-1.0.0-informational?style=flat-square) +![Version: 1.1.0](https://img.shields.io/badge/Version-1.1.0-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) A Helm chart for deploying a Backstage application @@ -134,9 +134,11 @@ Kubernetes: `>= 1.19.0-0` | backstage.image.tag | Backstage image tag (immutable tags are recommended) | string | `"latest"` | | backstage.initContainers | Backstage container init containers | list | `[]` | | backstage.installDir | Directory containing the backstage installation | string | `"/app"` | +| backstage.livenessProbe | Liveness Probe Backstage doesn't provide any health endpoints by default. A simple one can be added like this: https://backstage.io/docs/plugins/observability/#health-checks
Ref: https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-startup-probes | object | `{}` | | backstage.tolerations | Node tolerations for server scheduling to nodes with taints
Ref: https://kubernetes.io/docs/concepts/scheduling-eviction/taint-and-toleration/ | list | `[]` | diff --git a/charts/backstage/ci/probes-values.yaml b/charts/backstage/ci/probes-values.yaml new file mode 100644 index 0000000..b936eff --- /dev/null +++ b/charts/backstage/ci/probes-values.yaml @@ -0,0 +1,21 @@ +backstage: + readinessProbe: + failureThreshold: 3 + httpGet: + path: /healthcheck + port: 7007 + scheme: HTTP + initialDelaySeconds: 30 + periodSeconds: 10 + successThreshold: 2 + timeoutSeconds: 2 + livenessProbe: + failureThreshold: 3 + httpGet: + path: /healthcheck + port: 7007 + scheme: HTTP + initialDelaySeconds: 60 + periodSeconds: 10 + successThreshold: 1 + timeoutSeconds: 2 diff --git a/charts/backstage/templates/backstage-deployment.yaml b/charts/backstage/templates/backstage-deployment.yaml index 6c0ac81..0befefd 100644 --- a/charts/backstage/templates/backstage-deployment.yaml +++ b/charts/backstage/templates/backstage-deployment.yaml @@ -103,6 +103,12 @@ spec: {{- if .Values.backstage.resources }} resources: {{- include "common.tplvalues.render" (dict "value" .Values.backstage.resources "context" $) | nindent 12 }} {{- end }} + {{- if .Values.backstage.readinessProbe }} + readinessProbe: {{- include "common.tplvalues.render" (dict "value" .Values.backstage.readinessProbe "context" $) | nindent 12 }} + {{- end }} + {{- if .Values.backstage.livenessProbe }} + livenessProbe: {{- include "common.tplvalues.render" (dict "value" .Values.backstage.livenessProbe "context" $) | nindent 12 }} + {{- end }} {{- if .Values.backstage.extraEnvVarsSecrets }} envFrom: {{- range .Values.backstage.extraEnvVarsSecrets }} diff --git a/charts/backstage/values.schema.json b/charts/backstage/values.schema.json index a55839d..361b759 100644 --- a/charts/backstage/values.schema.json +++ b/charts/backstage/values.schema.json @@ -362,6 +362,46 @@ } ] }, + "readinessProbe": { + "title": "Readiness probe", + "description": "Ref: https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-startup-probes/", + "$ref": "https://kubernetesjsonschema.dev/master/_definitions.json#/definitions/io.k8s.api.core.v1.Probe", + "default": {}, + "examples": [ + { + "failureThreshold": 3, + "httpGet": { + "path": "/healthcheck", + "port": 7007, + "scheme": "HTTP" + }, + "initialDelaySeconds": 30, + "periodSeconds": 10, + "successThreshold": 2, + "timeoutSeconds": 2 + } + ] + }, + "livenessProbe": { + "title": "Liveness probe", + "description": "Ref: https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-startup-probes/", + "$ref": "https://kubernetesjsonschema.dev/master/_definitions.json#/definitions/io.k8s.api.core.v1.Probe", + "default": {}, + "examples": [ + { + "failureThreshold": 3, + "httpGet": { + "path": "/healthcheck", + "port": 7007, + "scheme": "HTTP" + }, + "initialDelaySeconds": 60, + "periodSeconds": 10, + "successThreshold": 1, + "timeoutSeconds": 2 + } + ] + }, "podSecurityContext": { "title": "Security settings for a Pod.", "description": "The security settings that you specify for a Pod apply to all Containers in the Pod. Ref: https://kubernetes.io/docs/tasks/configure-pod-container/security-context/#set-the-security-context-for-a-pod", diff --git a/charts/backstage/values.yaml b/charts/backstage/values.yaml index b9f925b..e087779 100644 --- a/charts/backstage/values.yaml +++ b/charts/backstage/values.yaml @@ -154,6 +154,38 @@ backstage: # cpu: 100m --> resources: {} + # -- Readiness Probe + # Backstage doesn't provide any health endpoints by default. A simple one can be added like this: https://backstage.io/docs/plugins/observability/#health-checks + #
Ref: https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-startup-probes + #