Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Automatic env var substitution in linkerd config files #1450

Open
kevholditch opened this issue Jun 28, 2017 · 3 comments
Open

Automatic env var substitution in linkerd config files #1450

kevholditch opened this issue Jun 28, 2017 · 3 comments

Comments

@kevholditch
Copy link

Support automatic replacement of environment variables in the linkerd.conf file when linkerd starts up.

This is useful in a number of scenarios when parts of the config are not known until runtime especially when running in a docker container (see my blog post for a real world scenario).

The format of the variable in the config file could be prefixed with a '$' for example:

interpreter:
kind: default
    transformers:
    – kind: io.l5d.specificHost
    host: $LOCAL_IP

Here $LOCAL_IP would be replaced with the value found at runtime in the environment variable LOCAL_IP.

@olix0r
Copy link
Member

olix0r commented Jun 28, 2017

the way i've done this sort of thing in the past is passing in the config on stdin like:

./genconfig.sh |./linkerd -

where genconfig.sh has something like:

#!/bin/sh

set -eu

cat <<EOF
interpreter:
  kind: default
    transformers:
    – kind: io.l5d.specificHost
      host: $LOCAL_IP
EOF

@kevholditch
Copy link
Author

If you see my blog post that is how I've done it except using envsubst. William tweeted saying it sounded like a reasonable request to have it built in natively.

At the moment the only solution when needing env vars in your config is to derive from the official container and do some config manipulation yourself which is a bit cumbersome.

@wmorgan
Copy link
Member

wmorgan commented Jun 28, 2017

Thanks for submitting this @kevholditch!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants