Skip to content

Commit

Permalink
Add readiness/liveness probes
Browse files Browse the repository at this point in the history
Signed-off-by: damatj <[email protected]>
  • Loading branch information
pcc-damatj committed May 15, 2023
1 parent 0074d5b commit 7a947d8
Show file tree
Hide file tree
Showing 4 changed files with 79 additions and 16 deletions.
2 changes: 2 additions & 0 deletions charts/backstage/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -132,9 +132,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 <br /> Ref: https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-startup-probes <!-- E.g. livenessProbe: failureThreshold: 3 httpGet: path: /healthcheck port: 7007 scheme: HTTP initialDelaySeconds: 60 periodSeconds: 10 successThreshold: 1 timeoutSeconds: 2 | object | `{}` |
| backstage.nodeSelector | Node labels for pod assignment <br /> Ref: https://kubernetes.io/docs/concepts/scheduling-eviction/assign-pod-node/#nodeselector | object | `{}` |
| backstage.podAnnotations | Annotations to add to the backend deployment pods | object | `{}` |
| backstage.podSecurityContext | Security settings for a Pod. The security settings that you specify for a Pod apply to all Containers in the Pod. <br /> Ref: https://kubernetes.io/docs/tasks/configure-pod-container/security-context/#set-the-security-context-for-a-pod | object | `{}` |
| backstage.readinessProbe | Readiness Probe <br /> Ref: https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-startup-probes <!-- E.g. readinessProbe: failureThreshold: 3 httpGet: path: /healthcheck port: 7007 scheme: HTTP initialDelaySeconds: 30 periodSeconds: 10 successThreshold: 2 timeoutSeconds: 2 | object | `{}` |
| backstage.replicas | Number of deployment replicas | int | `1` |
| backstage.resources | Resource requests/limits <br /> Ref: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/#resource-requests-and-limits-of-pod-and-container <!-- E.g. resources: limits: memory: 1Gi cpu: 1000m requests: memory: 250Mi cpu: 100m --> | object | `{}` |
| backstage.tolerations | Node tolerations for server scheduling to nodes with taints <br /> Ref: https://kubernetes.io/docs/concepts/scheduling-eviction/taint-and-toleration/ | list | `[]` |
Expand Down
6 changes: 6 additions & 0 deletions charts/backstage/templates/backstage-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand Down
42 changes: 41 additions & 1 deletion charts/backstage/values.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -666,4 +706,4 @@
}
}
}
}
}
45 changes: 30 additions & 15 deletions charts/backstage/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ extraDeploy: []

# -- Enable diagnostic mode in the Deployment
diagnosticMode:

# -- Enable diagnostic mode (all probes will be disabled and the command will be overridden)
enabled: false

Expand All @@ -54,7 +53,6 @@ diagnosticMode:

# -- Ingress parameters
ingress:

# -- Enable the creation of the ingress resource
enabled: false

Expand All @@ -69,7 +67,6 @@ ingress:

# -- Ingress TLS parameters
tls:

# -- Enable TLS configuration for the host defined at `ingress.host` parameter
enabled: false

Expand All @@ -79,12 +76,10 @@ ingress:
# -- Backstage parameters
# @default -- See below
backstage:

# -- Number of deployment replicas
replicas: 1

image:

# -- Backstage image registry
registry: ghcr.io

Expand Down Expand Up @@ -154,6 +149,36 @@ backstage:
# cpu: 100m -->
resources: {}

# -- Readiness Probe
# <br /> Ref: https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-startup-probes
# <!-- E.g.
# readinessProbe:
# failureThreshold: 3
# httpGet:
# path: /healthcheck
# port: 7007
# scheme: HTTP
# initialDelaySeconds: 30
# periodSeconds: 10
# successThreshold: 2
# timeoutSeconds: 2
readinessProbe: {}

# -- Liveness Probe
# <br /> Ref: https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-startup-probes
# <!-- E.g.
# livenessProbe:
# failureThreshold: 3
# httpGet:
# path: /healthcheck
# port: 7007
# scheme: HTTP
# initialDelaySeconds: 60
# periodSeconds: 10
# successThreshold: 1
# timeoutSeconds: 2
livenessProbe: {}

# -- Security settings for a Pod.
# The security settings that you specify for a Pod apply to all Containers in the Pod.
# <br /> Ref: https://kubernetes.io/docs/tasks/configure-pod-container/security-context/#set-the-security-context-for-a-pod
Expand Down Expand Up @@ -198,7 +223,6 @@ backstage:
# -- Service parameters
# @default -- See below
service:

# -- Kubernetes Service type
type: ClusterIP

Expand Down Expand Up @@ -252,7 +276,6 @@ service:
# -- Network policies
# <br /> Ref: https://kubernetes.io/docs/concepts/services-networking/network-policies/
networkPolicy:

# -- networkPolicy.enabled Specifies whether a NetworkPolicy should be created
enabled: false

Expand All @@ -261,7 +284,6 @@ networkPolicy:

# -- Custom network policy rule
egressRules:

# -- Additional custom egress rules
# e.g:
# customRules:
Expand All @@ -271,17 +293,14 @@ networkPolicy:
# label: example
customRules: []


# -- PostgreSQL [chart configuration](https://github.com/bitnami/charts/blob/master/bitnami/postgresql/values.yaml)
# @default -- See below
postgresql:

# -- Switch to enable or disable the PostgreSQL helm chart
enabled: false

# -- The authentication details of the Postgres database
auth:

# -- Name for a custom user to create
username: bn_backstage

Expand All @@ -293,7 +312,6 @@ postgresql:

# -- The secret keys Postgres will look for to retrieve the relevant password
secretKeys:

# -- The key in which Postgres will look for, for the admin password, in the existing Secret
adminPasswordKey: admin-password

Expand All @@ -309,7 +327,6 @@ postgresql:
# -- Service Account Configuration
# @default -- See below
serviceAccount:

# -- Enable the creation of a ServiceAccount for Backstage pods
create: false

Expand All @@ -328,11 +345,9 @@ serviceAccount:

# -- Metrics configuration
metrics:

# -- ServiceMonitor configuration
# <br /> Allows configuring your backstage instance as a scrape target for [Prometheus](https://github.com/prometheus/prometheus) using a ServiceMonitor custom resource that [Prometheus Operator](https://github.com/prometheus-operator/prometheus-operator) can understand.
serviceMonitor:

# -- If enabled, a ServiceMonitor resource for Prometheus Operator is created
# <br /> Prometheus Operator must be installed in your cluster prior to enabling.
enabled: false
Expand Down

0 comments on commit 7a947d8

Please sign in to comment.