From 7205ac1457a7c6b5333bc5fc4913d6d124499222 Mon Sep 17 00:00:00 2001 From: Russ Allbery Date: Tue, 10 Dec 2024 16:43:02 -0800 Subject: [PATCH] Fix JSON serialization of Kopf healt probe 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. --- changelog.d/20241210_164212_rra_DM_47986.md | 3 +++ src/gafaelfawr/operator/health.py | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) create mode 100644 changelog.d/20241210_164212_rra_DM_47986.md diff --git a/changelog.d/20241210_164212_rra_DM_47986.md b/changelog.d/20241210_164212_rra_DM_47986.md new file mode 100644 index 000000000..2398ef09d --- /dev/null +++ b/changelog.d/20241210_164212_rra_DM_47986.md @@ -0,0 +1,3 @@ +### Bug fixes + +- Return a JSON-serializable object from the health probe for the Kubernetes operator. diff --git a/src/gafaelfawr/operator/health.py b/src/gafaelfawr/operator/health.py index a9762a539..956e42f1a 100644 --- a/src/gafaelfawr/operator/health.py +++ b/src/gafaelfawr/operator/health.py @@ -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")