Last active
March 28, 2016 22:18
-
-
Save johnbuhay/9673fd0448b6889156ec to your computer and use it in GitHub Desktop.
Configuration for testing confd PR 416 https://github.com/kelseyhightower/confd/pull/416 to solve issue https://github.com/kelseyhightower/confd/issues/386
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
FROM golang | |
WORKDIR /go | |
RUN go get github.com/BurntSushi/toml && \ | |
go get github.com/kelseyhightower/confd && \ | |
cd $GOPATH/src/github.com/kelseyhightower/confd && \ | |
git remote add sort https://github.com/HeavyHorst/confd.git && \ | |
git pull sort sort && git checkout sort && \ | |
find / -type f -name "*confd" -exec rm {} \; && \ | |
./build && ./install | |
RUN mkdir -p /etc/confd/{conf.d,templates} | |
ADD *.tmpl /etc/confd/templates/ | |
ADD *.toml /etc/confd/conf.d/ |
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
etcdctl --endpoint $ETCD_ENDPOINT set /haproxy-mynamespace-api/services/backends/http-backend-80/name http-backend-80 | |
etcdctl --endpoint $ETCD_ENDPOINT set /haproxy-mynamespace-api/services/backends/http-backend-80/servers/backend-80 backend:80 | |
etcdctl --endpoint $ETCD_ENDPOINT set /haproxy-mynamespace-api/services/backends/http-backend-80/claims/-api /api | |
etcdctl --endpoint $ETCD_ENDPOINT set /haproxy-mynamespace-api/services/backends/http-backend-80/claims/-api-v3 /api/v3 | |
etcdctl --endpoint $ETCD_ENDPOINT set /haproxy-mynamespace-api/services/claims/-api/url http-backend-80 | |
etcdctl --endpoint $ETCD_ENDPOINT set /haproxy-mynamespace-api/services/claims/-api/backend fe-myrc-apiv3.mynamespace-api-80 | |
etcdctl --endpoint $ETCD_ENDPOINT set /haproxy-mynamespace-api/services/claims/-api-v3/backend fe-myrc-apiv3.mynamespace-api-80 | |
etcdctl --endpoint $ETCD_ENDPOINT set /haproxy-mynamespace-api/services/claims/-api-v3/url http-backend-80 |
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
# confd -onetime -node http://etcd:4001 -prefix "$KEY_PREFIX" --keep-stage-file=true | |
~~~ | |
frontend http-in | |
bind *:8080 | |
acl fe-api-v3 path_beg -i /api/v3 | |
use_backend http-backend-80-api-v3 if fe-api-v3 | |
acl fe-api path_beg -i /api | |
use_backend http-backend-80-api if fe-api | |
default_backend nomatch | |
~~~ |
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
frontend http-in | |
bind *:8080 | |
{{ range $claim := (lsdir "/services/claims" | sortByLength | reverse) }} | |
{{$url := (printf "/services/claims/%s/url" $claim | getv)}} | |
{{$backend := (printf "/services/claims/%s/backend" $claim | getv)}} | |
acl fe{{$claim}} path_beg -i {{$url}} | |
use_backend {{$backend}}{{$claim}} if fe{{$claim}} | |
{{end}} | |
default_backend nomatch |
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
[template] | |
keys = [ | |
"/services" | |
] | |
owner = "haproxy" | |
mode = "0644" | |
src = "haproxy.cfg.tmpl" | |
dest = "/haproxy.cfg" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment