ChargeTimeEU / Java-OCA-OCPP

Open source client and server library of Open Charge-Point Protocol (OCPP) defined by openchargealliance.org (OCA)
MIT License
274 stars 176 forks source link

Cloud HTTP health check of LoadBalancer keep UNHEALTHY #181

Open danielcaro opened 2 years ago

danielcaro commented 2 years ago

Problem:

When the service is deployed to GKE or any K8s behind load balancer with health check, the validator will try fetch HTTP response or TCP (https://cloud.google.com/load-balancing/docs/health-check-concepts#criteria-protocol-ssl-tcp) , but the Java Websocket implementations make fail the health check, and the service keep UNHEALTHY .

Solution:

Implement a Draft_HttpHealthCheck using the suggestion proposed by @SerVB at https://github.com/TooTallNate/Java-WebSocket/issues/1077 becauseJava_Websocket owner said that will not provide a draft to support http health check.

PS: If you like I can send a PR with my approach solution, that already works well :D .

TVolden commented 2 years ago

Hi @danielcaro

Yes please set up a PR, I'll gladly review your code and merge it if it passes the automated tests.

Sincerely, Thomas

danielcaro commented 2 years ago

Hi, I found some problems now, I gonna test the solution at production first. Then I'll sent the PR.

danielcaro commented 2 years ago

The solution was tested on production, but I would like to hear your advice.

https://github.com/ChargeTimeEU/Java-OCA-OCPP/pull/189

TVolden commented 2 years ago

Okay, the PR is merged. Please check if it works as intended and close the issue :)

fabiangr commented 1 month ago

Hi @TVolden , hi @danielcaro ,

I would like to use your library within a Spring Boot Project and use Spring's implementation for health checks etc (Actuator). As far as I understand it, the current implementation answers 200 OK on every possible HTTP route I could call. Is there a way to deactivate this behaviour or limit it to certain routes to be able to use my own implementation?