Skip to content

Commit

Permalink
homeassistant: add liveness probe
Browse files Browse the repository at this point in the history
  • Loading branch information
paulfantom committed Dec 13, 2024
1 parent d0be5b9 commit cbaab75
Show file tree
Hide file tree
Showing 2 changed files with 63 additions and 0 deletions.
28 changes: 28 additions & 0 deletions apps/homeassistant/manifests/homeassistant/statefulSet.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,14 @@ spec:
value: Europe/Berlin
image: homeassistant/home-assistant:2024.11.3
imagePullPolicy: IfNotPresent
livenessProbe:
failureThreshold: 5
httpGet:
path: /local/healthz
port: http
scheme: HTTP
initialDelaySeconds: 5
timeoutSeconds: 10
name: homeassistant
ports:
- containerPort: 8123
Expand Down Expand Up @@ -77,6 +85,26 @@ spec:
readOnly: true
subPath: scripts.yaml
hostNetwork: true
initContainers:
- command:
- sh
- -c
- echo 'OK' > /config/www/healthz
image: homeassistant/home-assistant:2024.11.3
imagePullPolicy: IfNotPresent
name: healthcheck
resources:
limits:
cpu: 10m
memory: 10Mi
requests:
cpu: 10m
memory: 10Mi
securityContext:
runAsUser: 0
volumeMounts:
- mountPath: /config
name: homeassistant-config
priorityClassName: production-high
restartPolicy: Always
serviceAccountName: homeassistant
Expand Down
35 changes: 35 additions & 0 deletions lib/jsonnet/apps/homeassistant.libsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,30 @@ function(params) {
},

statefulSet: {
local health = {
name: "healthcheck",
image: $._config.image,
command: ["sh", "-c", "echo 'OK' > /config/www/healthz"],
imagePullPolicy: 'IfNotPresent',
resources: {
requests: {
cpu: "10m",
memory: "10Mi",
},
limits: {
cpu: "10m",
memory: "10Mi",
},
},
securityContext: {
runAsUser: 0,
},
volumeMounts: [{
mountPath: '/config',
name: $._metadata.name + '-config',
}]
},

local c = {
name: $._config.name,
image: $._config.image,
Expand Down Expand Up @@ -156,6 +180,16 @@ function(params) {
failureThreshold: 5,
timeoutSeconds: 10,
},
livenessProbe: {
httpGet: {
path: '/local/healthz',
port: 'http',
scheme: 'HTTP',
},
initialDelaySeconds: 5,
failureThreshold: 5,
timeoutSeconds: 10,
},
securityContext: {
privileged: $._config.zwaveSupport,
},
Expand Down Expand Up @@ -183,6 +217,7 @@ function(params) {
labels: $._config.commonLabels,
},
spec: {
initContainers: [health],
containers: [c],
restartPolicy: 'Always',
serviceAccountName: $.serviceAccount.metadata.name,
Expand Down

0 comments on commit cbaab75

Please sign in to comment.