Skip to content

Commit

Permalink
Changed config of envoy to a template, and added a start-envoy.sh scr…
Browse files Browse the repository at this point in the history
…ipt that is run on initialization that creates the actual config file using the template and the env config variables

Signed-off-by: Alfredo Gutierrez <[email protected]>
  • Loading branch information
AlfredoG87 committed Mar 30, 2024
1 parent dc87d2f commit d0a1898
Show file tree
Hide file tree
Showing 2 changed files with 62 additions and 0 deletions.
55 changes: 55 additions & 0 deletions auth-layer-proxy/configs/envoy-auth-template.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
static_resources:
listeners:
- name: listener_0
address:
socket_address:
address: 0.0.0.0
port_value: ${PROXY_PORT}
filter_chains:
- filters:
- name: envoy.filters.network.http_connection_manager
typed_config:
"@type": type.googleapis.com/envoy.extensions.filters.network.http_connection_manager.v3.HttpConnectionManager
stat_prefix: edge
http_filters:
- name: envoy.filters.http.lua
typed_config:
"@type": type.googleapis.com/envoy.extensions.filters.http.lua.v3.Lua
default_source_code:
filename: /etc/envoy/filters/TokenVerificationFilter.lua

- name: envoy.filters.http.router
typed_config:
"@type": type.googleapis.com/envoy.extensions.filters.http.router.v3.Router
route_config:
virtual_hosts:
- name: all_domains
domains: ["*"]
routes:
- match:
prefix: "/"
headers:
name: ":method"
exact_match: "POST"
route:
cluster: upstream_service

clusters:
- name: upstream_service
connect_timeout: 5s
type: ${SERVICE_TYPE}
load_assignment:
cluster_name: upstream_service
endpoints:
- lb_endpoints:
- endpoint:
address:
socket_address:
address: ${SERVICE_ADDRESS}
port_value: ${SERVICE_PORT}

admin:
address:
socket_address:
address: 0.0.0.0
port_value: ${ENVOY_ADMIN_PORT}
7 changes: 7 additions & 0 deletions auth-layer-proxy/scripts/start-envoy.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/sh
# Use envsubst to replace environment variables in the template
envsubst < /etc/envoy/configs/envoy-auth-template.yaml > /etc/envoy/envoy-config.yaml
# cat /etc/envoy/envoy-config.yaml
cat /etc/envoy/envoy-config.yaml
# Now start Envoy with the processed configuration
envoy -c /etc/envoy/envoy-config.yaml

0 comments on commit d0a1898

Please sign in to comment.