Skip to content

Commit fa6726f

Browse files
authored
fix: envoy proxy health check (#1001)
* fix: envoy proxy health check * chore: add changeset
1 parent 0e6cd66 commit fa6726f

3 files changed

Lines changed: 12 additions & 18 deletions

File tree

.changeset/warm-bikes-shave.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"setup-gap": patch
3+
---
4+
5+
fix: health check for K8s API when enabled

actions/setup-gap/action.yml

Lines changed: 5 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -360,29 +360,18 @@ runs:
360360
361361
echo "Checking if the ${name} proxy is up and running on [https://localhost:${port}]"
362362
for attempt in {1..10}; do
363-
# Get the status code using curl
364-
status_code=$(curl --silent --cacert "${PATH_CERTS_DIR}/ca.crt" \
365-
-o /dev/null -w "%{http_code}" https://localhost:${port})
366-
367-
echo "Attempt ${attempt}/10: Status code: ${status_code}"
368-
369-
if [[ $status_code -eq 200 ]]; then
370-
echo "${name} proxy is up, and the HTTPS connection is successful with status code 200."
363+
# Check if we can establish a connection to the proxy
364+
if curl --silent --max-time 5 --cacert "${PATH_CERTS_DIR}/ca.crt" \
365+
-o /dev/null https://localhost:${port}/ 2>/dev/null; then
366+
echo "${name} proxy is up, TLS connection established with valid certificate!"
371367
return 0
372-
elif [[ $status_code -ne 000 ]]; then
373-
echo "WARNING: ${name} proxy returned non-200 status code: ${status_code}"
374-
if [[ $attempt -eq 10 ]]; then
375-
echo "::error:: ${name} proxy is responding but with unexpected status code: ${status_code}"
376-
return 1
377-
fi
378-
sleep 3
379368
else
380369
echo "Waiting for the ${name} proxy to start... Attempt ${attempt}/10"
381370
sleep 3
382371
fi
383372
done
384373
385-
echo "Timed out waiting for the ${name} proxy to start."
374+
echo "::error::Timed out waiting for the ${name} proxy to start. Connection could not be established."
386375
return 1
387376
}
388377

actions/setup-gap/envoy.yaml.gotmpl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ static_resources:
149149
domains: ["localhost", "127.0.0.1", "localhost:{{ getenv "DYNAMIC_PROXY_PORT" }}", "127.0.0.1:{{ getenv "DYNAMIC_PROXY_PORT" }}"]
150150
routes:
151151
- match:
152-
prefix: /
152+
prefix: '/'
153153
direct_response:
154154
status: 200
155155
body:
@@ -272,7 +272,7 @@ static_resources:
272272
domains: [ "localhost", "127.0.0.1", "localhost:{{ getenv "WEBSOCKETS_PROXY_PORT" }}", "127.0.0.1:{{ getenv "WEBSOCKETS_PROXY_PORT" }}"]
273273
routes:
274274
- match:
275-
prefix: /
275+
prefix: '/'
276276
direct_response:
277277
status: 200
278278
body:

0 commit comments

Comments
 (0)