Splitting envoy envoy.yaml configuration into multiple files (Docker only)

I am handling four different ports / cases with Envoy:

  • IPv6 http
  • IPv4 http
  • IPv6 https
  • IPv4 https

For IPv6 and IPv4 the configuration is the same, whereas for http there is a different configuration than for https.

To realize this, I have split my envoy configuration into several snippets, and add them together during building of the container.

Here is what my new Dockerfile looks like:

FROM envoyproxy/envoy:latest
COPY config /tmp/config
RUN cat /tmp/config/envoy_head.yaml /tmp/config/http_head_one.yaml /tmp/config/http_body.yaml /tmp/config/http_head_two.yaml /tmp/config/http_body.yaml /tmp/config/https_head_one.yaml /tmp/config/https_body.yaml /tmp/config/https_head_two.yaml /tmp/config/https_body.yaml /tmp/config/envoy_tail.yaml > /etc/envoy/envoy.yaml

my config folder contains several files which are combined into envoy.yaml

No need to search for “how to include files in yaml files” Smile

image

Here is, for example, my envoy_head.yaml:

static_resources:
   listeners:

As you can see, it is rather simple

(NB: it ends with a newline, as do all the other files – when combining, this will give the desired result).

Don’t forget to build your container, running, for example:

docker-compose up –build