-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
FEATURE: Add etcd-metrics-proxy service (#18)
* feat: support etcd-metrics-proxy service * chore: update CHANGELOG.md * docs: update terraform docs
- Loading branch information
Showing
9 changed files
with
200 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
#!/bin/bash | ||
# Wrapper for launching etcd-metrics-proxy via docker. | ||
|
||
set -e | ||
|
||
function require_ev_all() { | ||
for rev in $@ ; do | ||
if [[ -z "${!rev}" ]]; then | ||
echo "${rev}" is not set | ||
exit 1 | ||
fi | ||
done | ||
} | ||
|
||
ETCD_METRICS_PROXY_IMAGE=${ETCD_METRICS_PROXY_IMAGE_REPO}:${ETCD_METRICS_PROXY_IMAGE_TAG} | ||
|
||
if [[ $CLOUD_PROVIDER == "aws" ]]; then | ||
export HOSTNAME=$(curl -s http://169.254.169.254/latest/meta-data/local-hostname) | ||
export HOST_IP=$(curl -s http://169.254.169.254/latest/meta-data/local-ipv4) | ||
fi | ||
|
||
[[ ! -n "$HOSTNAME" ]] && export HOSTNAME=$(hostname) | ||
[[ ! -n "$HOST_IP" ]] && export HOST_IP=$(ip -o route get 8.8.8.8 | sed -e 's/^.* src \([^ ]*\) .*$/\1/') | ||
|
||
DOCKER_RUN_ARGS="${DOCKER_RUN_ARGS} ${DOCKER_OPTS}" | ||
|
||
DOCKER="${DOCKER:-/usr/bin/docker}" | ||
set -x | ||
exec ${DOCKER} run \ | ||
-v ${ETCD_CERT_PATH}:${ETCD_CERT_PATH}:ro \ | ||
--env-file=/etc/etcd/config.env \ | ||
--net=host \ | ||
--pid=host \ | ||
--user=${USER_ID} \ | ||
--name=etcd-metrics-proxy \ | ||
${DOCKER_RUN_ARGS} \ | ||
${ETCD_METRICS_PROXY_IMAGE} \ | ||
-etcd-ca="${ETCD_TRUSTED_CA_FILE}" \ | ||
-etcd-cert="${ETCD_CERT_FILE}" \ | ||
-etcd-key="${ETCD_KEY_FILE}" \ | ||
-port="${ETCD_METRICS_PROXY_PORT}" \ | ||
-upstream-host="${HOST_IP}" \ | ||
-upstream-port="${CLIENT_PORT}" \ | ||
-upstream-server-name="${HOSTNAME}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
[Unit] | ||
Description=etcd-metrics-proxy service | ||
Requires=network-online.target | ||
|
||
[Service] | ||
Environment="PATH=/opt/bin:/opt/etcd/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin" | ||
EnvironmentFile=/etc/etcd/config.env | ||
ExecStartPre=-/usr/bin/docker rm -f etcd-metrics-proxy | ||
ExecStart=/opt/etcd/bin/etcd-metrics-proxy-wrapper | ||
ExecStop=-/usr/bin/docker stop etcd-metrics-proxy | ||
|
||
Restart=always | ||
RestartSec=10 | ||
|
||
[Install] | ||
WantedBy=multi-user.target |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters