Skip to content

Commit cbaab75

Browse files
committed
homeassistant: add liveness probe
1 parent d0be5b9 commit cbaab75

File tree

2 files changed

+63
-0
lines changed

2 files changed

+63
-0
lines changed

apps/homeassistant/manifests/homeassistant/statefulSet.yaml

+28
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,14 @@ spec:
3232
value: Europe/Berlin
3333
image: homeassistant/home-assistant:2024.11.3
3434
imagePullPolicy: IfNotPresent
35+
livenessProbe:
36+
failureThreshold: 5
37+
httpGet:
38+
path: /local/healthz
39+
port: http
40+
scheme: HTTP
41+
initialDelaySeconds: 5
42+
timeoutSeconds: 10
3543
name: homeassistant
3644
ports:
3745
- containerPort: 8123
@@ -77,6 +85,26 @@ spec:
7785
readOnly: true
7886
subPath: scripts.yaml
7987
hostNetwork: true
88+
initContainers:
89+
- command:
90+
- sh
91+
- -c
92+
- echo 'OK' > /config/www/healthz
93+
image: homeassistant/home-assistant:2024.11.3
94+
imagePullPolicy: IfNotPresent
95+
name: healthcheck
96+
resources:
97+
limits:
98+
cpu: 10m
99+
memory: 10Mi
100+
requests:
101+
cpu: 10m
102+
memory: 10Mi
103+
securityContext:
104+
runAsUser: 0
105+
volumeMounts:
106+
- mountPath: /config
107+
name: homeassistant-config
80108
priorityClassName: production-high
81109
restartPolicy: Always
82110
serviceAccountName: homeassistant

lib/jsonnet/apps/homeassistant.libsonnet

+35
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,30 @@ function(params) {
121121
},
122122

123123
statefulSet: {
124+
local health = {
125+
name: "healthcheck",
126+
image: $._config.image,
127+
command: ["sh", "-c", "echo 'OK' > /config/www/healthz"],
128+
imagePullPolicy: 'IfNotPresent',
129+
resources: {
130+
requests: {
131+
cpu: "10m",
132+
memory: "10Mi",
133+
},
134+
limits: {
135+
cpu: "10m",
136+
memory: "10Mi",
137+
},
138+
},
139+
securityContext: {
140+
runAsUser: 0,
141+
},
142+
volumeMounts: [{
143+
mountPath: '/config',
144+
name: $._metadata.name + '-config',
145+
}]
146+
},
147+
124148
local c = {
125149
name: $._config.name,
126150
image: $._config.image,
@@ -156,6 +180,16 @@ function(params) {
156180
failureThreshold: 5,
157181
timeoutSeconds: 10,
158182
},
183+
livenessProbe: {
184+
httpGet: {
185+
path: '/local/healthz',
186+
port: 'http',
187+
scheme: 'HTTP',
188+
},
189+
initialDelaySeconds: 5,
190+
failureThreshold: 5,
191+
timeoutSeconds: 10,
192+
},
159193
securityContext: {
160194
privileged: $._config.zwaveSupport,
161195
},
@@ -183,6 +217,7 @@ function(params) {
183217
labels: $._config.commonLabels,
184218
},
185219
spec: {
220+
initContainers: [health],
186221
containers: [c],
187222
restartPolicy: 'Always',
188223
serviceAccountName: $.serviceAccount.metadata.name,

0 commit comments

Comments
 (0)