Skip to content

Commit

Permalink
Fix JSON serialization of Kopf healt probe
Browse files Browse the repository at this point in the history
The object returned from the health probe for Kopf couldn't be
serialized as JSON. This was harmless but produced error messages
in the logs. Return the model dumped in JSON format instead.
  • Loading branch information
rra committed Dec 11, 2024
1 parent f4bcbea commit 7205ac1
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
3 changes: 3 additions & 0 deletions changelog.d/20241210_164212_rra_DM_47986.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
### Bug fixes

- Return a JSON-serializable object from the health probe for the Kubernetes operator.
2 changes: 1 addition & 1 deletion src/gafaelfawr/operator/health.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,4 @@ async def get_health(memo: kopf.Memo, **_: Any) -> dict[str, Any]:
health_check_service = factory.create_health_check_service()
await health_check_service.check(check_user_info=False)
await factory.session.remove()
return HealthCheck(status=HealthStatus.HEALTHY).model_dump()
return HealthCheck(status=HealthStatus.HEALTHY).model_dump(mode="json")

0 comments on commit 7205ac1

Please sign in to comment.