Skip to content

Commit

Permalink
use the healthcheck filter and gracefully terminate Envoy with a pres…
Browse files Browse the repository at this point in the history
…top hook
  • Loading branch information
driev committed Jan 15, 2025
1 parent 616cddc commit 566d792
Show file tree
Hide file tree
Showing 8 changed files with 56 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -944,6 +944,15 @@ spec:
image: '{{ .Values.envoy.image.registry }}/{{ .Values.envoy.image.repository
}}:{{ .Values.envoy.image.tag }}'
imagePullPolicy: '{{ .Values.envoy.image.pullPolicy }}'
lifecycle:
preStop:
exec:
command:
- /bin/sh
- -c
- |
echo -ne "POST /healthcheck/fail HTTP/1.1\r\nHost: localhost\r\nConnection: close\r\n\r\n" > /dev/tcp/localhost/9901
sleep 30
name: envoy
ports:
- containerPort: 9000
Expand Down
9 changes: 9 additions & 0 deletions k8s/kustomize/helm-components-sc/patch_envoy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,12 @@ spec:
name: '{{ .Values.security.controlplane.ssl.client.serverValidationSecret }}'
key: ca.crt
optional: true
lifecycle:
preStop:
exec:
command:
- /bin/sh
- -c
- |
echo -ne "POST /healthcheck/fail HTTP/1.1\r\nHost: localhost\r\nConnection: close\r\n\r\n" > /dev/tcp/localhost/9901
sleep 30
9 changes: 9 additions & 0 deletions k8s/yaml/components.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -785,6 +785,15 @@ spec:
optional: true
image: 'docker.io/seldonio/seldon-envoy:latest'
imagePullPolicy: 'IfNotPresent'
lifecycle:
preStop:
exec:
command:
- /bin/sh
- -c
- |
echo -ne "POST /healthcheck/fail HTTP/1.1\r\nHost: localhost\r\nConnection: close\r\n\r\n" > /dev/tcp/localhost/9901
sleep 30
name: envoy
ports:
- containerPort: 9000
Expand Down
11 changes: 7 additions & 4 deletions scheduler/config/envoy-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,13 @@ static_resources:
port_value: 9003
filter_chains:
- filters:
- name: envoy.filters.http.health_check
typed_config:
"@type": type.googleapis.com/envoy.extensions.filters.http.health_check.v3.HealthCheck
pass_through_mode: false
headers:
- exact_match: /ready
name: :path
- name: envoy.http_connection_manager
typed_config:
"@type": type.googleapis.com/envoy.extensions.filters.network.http_connection_manager.v3.HttpConnectionManager
Expand All @@ -57,10 +64,6 @@ static_resources:
prefix: /stats
route:
cluster: admin_interface_cluster
- match:
prefix: /ready
route:
cluster: admin_interface_cluster
dynamic_resources:
ads_config:
api_type: DELTA_GRPC
Expand Down
11 changes: 7 additions & 4 deletions scheduler/config/envoy-local.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,13 @@ static_resources:
port_value: 9003
filter_chains:
- filters:
- name: envoy.filters.http.health_check
typed_config:
"@type": type.googleapis.com/envoy.extensions.filters.http.health_check.v3.HealthCheck
pass_through_mode: false
headers:
- exact_match: /ready
name: :path
- name: envoy.http_connection_manager
typed_config:
"@type": type.googleapis.com/envoy.extensions.filters.network.http_connection_manager.v3.HttpConnectionManager
Expand All @@ -57,10 +64,6 @@ static_resources:
prefix: /stats
route:
cluster: admin_interface_cluster
- match:
prefix: /ready
route:
cluster: admin_interface_cluster
dynamic_resources:
ads_config:
api_type: DELTA_GRPC
Expand Down
11 changes: 7 additions & 4 deletions scheduler/config/envoy-tls.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,13 @@ static_resources:
port_value: 9003
filter_chains:
- filters:
- name: envoy.filters.http.health_check
typed_config:
"@type": type.googleapis.com/envoy.extensions.filters.http.health_check.v3.HealthCheck
pass_through_mode: false
headers:
- exact_match: /ready
name: :path
- name: envoy.http_connection_manager
typed_config:
"@type": type.googleapis.com/envoy.extensions.filters.network.http_connection_manager.v3.HttpConnectionManager
Expand All @@ -70,10 +77,6 @@ static_resources:
prefix: /stats
route:
cluster: admin_interface_cluster
- match:
prefix: /ready
route:
cluster: admin_interface_cluster
dynamic_resources:
ads_config:
api_type: DELTA_GRPC
Expand Down
11 changes: 7 additions & 4 deletions scheduler/config/envoy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,13 @@ static_resources:
"@type": type.googleapis.com/envoy.extensions.filters.network.http_connection_manager.v3.HttpConnectionManager
stat_prefix: util_endpoint_http
http_filters:
- name: envoy.filters.http.health_check
typed_config:
"@type": type.googleapis.com/envoy.extensions.filters.http.health_check.v3.HealthCheck
pass_through_mode: false
headers:
- exact_match: /ready
name: :path
- name: envoy.filters.http.router
typed_config:
"@type": type.googleapis.com/envoy.extensions.filters.http.router.v3.Router
Expand All @@ -57,10 +64,6 @@ static_resources:
prefix: /stats
route:
cluster: admin_interface_cluster
- match:
prefix: /ready
route:
cluster: admin_interface_cluster
dynamic_resources:
ads_config:
api_type: DELTA_GRPC
Expand Down
2 changes: 1 addition & 1 deletion scheduler/k8s/envoy/envoy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -47,4 +47,4 @@ spec:
containerPort: 9000
- name: envoy-stats
containerPort: 9003
terminationGracePeriodSeconds: 5
terminationGracePeriodSeconds: 120

0 comments on commit 566d792

Please sign in to comment.