Hi,
I’ve been taking a look at the new docs on health checks in pebble and thought I’d try it out.
I took the sidecar version of the mattermost-k8s charm and applied the following diff:
diff --git a/src/charm.py b/src/charm.py
index 6eb523b..0d402a9 100755
--- a/src/charm.py
+++ b/src/charm.py
@@ -135,6 +135,14 @@ class MattermostK8sCharm(CharmBase):
"environment": env_config,
}
},
+ "checks": {
+ "ready": {
+ "override": "replace",
+ "http": {
+ "url": "http://localhost:{}/api/v4/system/ping".format(CONTAINER_PORT),
+ }
+ }
+ },
}
return pebble_config
I then built the charm and deployed it in microk8s. The pebble plan looks okay:
root@mattermost-k8s-0:/mattermost# /charm/bin/pebble plan
services:
mattermost:
summary: Mattermost service
startup: enabled
override: replace
command: /mattermost/bin/mattermost
environment:
[...]
checks:
ready:
override: replace
threshold: 3
http:
url: http://localhost:8065/api/v4/system/ping
By inspecting the deployed pod in k8s I can see a readiness check is configured as:
http-get http://:38813/v1/health%3Flevel=ready delay=30s timeout=1s period=5s #success=1 #failure=1
If I query that endpoint I see the following:
{"type":"sync","status-code":200,"status":"OK","result":{"healthy":true}}
Is this the expected result? I was expecting to see something in the endpoint output that corresponded to the check I’d defined.