From 6f8a765cf26b83390e938174a82609722378f688 Mon Sep 17 00:00:00 2001 From: Christoph Proeschel Date: Fri, 13 Aug 2021 10:46:36 +0200 Subject: [PATCH] [#2282] Hotfix for webhook registration failing despite all services healthy (#2283) --- VERSION | 2 +- .../src/main/java/co/airy/core/api/config/HealthApi.java | 1 - .../main/java/co/airy/core/api/config/ServiceDiscovery.java | 2 +- backend/webhook/consumer/pkg/worker/server.go | 4 ++++ 4 files changed, 6 insertions(+), 3 deletions(-) diff --git a/VERSION b/VERSION index 697f087f37..48f7a71df4 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -0.28.0 +0.28.1 diff --git a/backend/api/admin/src/main/java/co/airy/core/api/config/HealthApi.java b/backend/api/admin/src/main/java/co/airy/core/api/config/HealthApi.java index ecf6506cce..63de5e65e3 100644 --- a/backend/api/admin/src/main/java/co/airy/core/api/config/HealthApi.java +++ b/backend/api/admin/src/main/java/co/airy/core/api/config/HealthApi.java @@ -29,7 +29,6 @@ public HealthApi(@Value("${kubernetes.namespace}") String namespace, RestTemplat public Future isHealthy(String service) { try { final ResponseEntity response = restTemplate.getForEntity(String.format("http://%s.%s/actuator/health", service, namespace), String.class); - log.info("response body {}", response.getBody()); final JsonNode jsonNode = objectMapper.readTree(response.getBody()); return new AsyncResult<>("UP".equalsIgnoreCase(jsonNode.get("status").textValue())); } catch (Exception e) { diff --git a/backend/api/admin/src/main/java/co/airy/core/api/config/ServiceDiscovery.java b/backend/api/admin/src/main/java/co/airy/core/api/config/ServiceDiscovery.java index dbe753e5b2..5505e58a9f 100644 --- a/backend/api/admin/src/main/java/co/airy/core/api/config/ServiceDiscovery.java +++ b/backend/api/admin/src/main/java/co/airy/core/api/config/ServiceDiscovery.java @@ -46,7 +46,7 @@ public ComponentInfo getComponent(String componentName) { componentInfo = Optional.ofNullable(componentInfo).orElse(new ComponentInfo(false, true)); componentInfo.setEnabled(serviceInfo.isEnabled()); // One unhealthy service means that the component is unhealthy - componentInfo.setEnabled(componentInfo.isHealthy() && serviceInfo.isHealthy()); + componentInfo.setHealthy(componentInfo.isHealthy() && serviceInfo.isHealthy()); return componentInfo; }, (v1, v2) -> { v1.setHealthy(v1.isHealthy() && v2.isHealthy()); diff --git a/backend/webhook/consumer/pkg/worker/server.go b/backend/webhook/consumer/pkg/worker/server.go index 00197292b3..002c106991 100644 --- a/backend/webhook/consumer/pkg/worker/server.go +++ b/backend/webhook/consumer/pkg/worker/server.go @@ -28,6 +28,10 @@ func (worker *Worker) StartServer(ctx context.Context, wg *sync.WaitGroup) { w.WriteHeader(200) }) + http.HandleFunc("/actuator/health", func(w http.ResponseWriter, r *http.Request) { + w.Write([]byte("{\"status\":\"UP\"}")) + }) + go func() { log.Println("serving on 8080") err := http.ListenAndServe(":8080", nil)