Skip to content

Commit

Permalink
[#2282] Hotfix for webhook registration failing despite all services …
Browse files Browse the repository at this point in the history
…healthy (#2283)
  • Loading branch information
chrismatix committed Aug 13, 2021
1 parent 2c1d1bf commit 6f8a765
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.28.0
0.28.1
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ public HealthApi(@Value("${kubernetes.namespace}") String namespace, RestTemplat
public Future<Boolean> isHealthy(String service) {
try {
final ResponseEntity<String> 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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand Down
4 changes: 4 additions & 0 deletions backend/webhook/consumer/pkg/worker/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 6f8a765

Please sign in to comment.