Skip to content

Commit 097e87d

Browse files
committed
Merge pull request #3415 from aledbf/router_update_confd
ref(router): update confd to 0.90
2 parents 12e79a4 + 3bc6e44 commit 097e87d

8 files changed

Lines changed: 86 additions & 108 deletions

File tree

router/boot.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ func waitForInitialConfd(etcd string, timeout time.Duration) {
115115
var buffer bytes.Buffer
116116
output := bufio.NewWriter(&buffer)
117117
log.Debugf("Connecting to etcd server %s", etcd)
118-
cmd := exec.Command("confd", "-onetime", "-node", etcd, "-config-file", "/app/confd.toml", "-debug", "-verbose")
118+
cmd := exec.Command("confd", "-node", etcd, "--confdir", "/app", "-onetime", "--log-level", "error")
119119
cmd.Stdout = output
120120
cmd.Stderr = output
121121

@@ -132,7 +132,7 @@ func waitForInitialConfd(etcd string, timeout time.Duration) {
132132
}
133133

134134
func launchConfd(etcd string) {
135-
cmd := exec.Command("confd", "-node", etcd, "-config-file", "/app/confd.toml")
135+
cmd := exec.Command("confd", "-node", etcd, "--confdir", "/app", "--log-level", "error", "--interval", "5")
136136
cmd.Stdout = os.Stdout
137137
cmd.Stderr = os.Stderr
138138

router/image/Dockerfile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@ ENV DEBIAN_FRONTEND noninteractive
55
# install common packages
66
RUN apt-get update && apt-get install -y curl net-tools sudo
77

8-
# install confd from https://github.com/deis/confd/tree/deis
9-
RUN curl -sSL -o /usr/local/bin/confd https://s3-us-west-2.amazonaws.com/opdemand/confd-git-4c50136 \
10-
&& chmod +x /usr/local/bin/confd
8+
# install confd
9+
RUN curl -sSL -o /usr/local/bin/confd https://s3-us-west-2.amazonaws.com/opdemand/confd-git-73f7489 \
10+
&& chmod +x /usr/local/bin/confd
1111

1212
# install common packages
1313
RUN apt-get update && apt-get install -y libgeoip1 cron

router/image/confd.toml

Lines changed: 0 additions & 6 deletions
This file was deleted.

router/image/templates/deis.cert

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{{ .deis_router_sslCert }}
1+
{{ getv "/deis/router/sslCert" }}

router/image/templates/deis.conf

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
server_name_in_redirect off;
22
port_in_redirect off;
3-
listen 80{{ if .deis_router_proxyProtocol }} proxy_protocol{{ end }};
3+
listen 80{{ if exists "/deis/router/proxyProtocol" }} proxy_protocol{{ end }};
44

5-
{{ if .deis_router_sslCert }}
6-
listen 443 ssl spdy{{ if .deis_router_proxyProtocol }} proxy_protocol{{ end }};
5+
{{ if exists "/deis/router/sslCert" }}
6+
listen 443 ssl spdy{{ if exists "/deis/router/proxyProtocol" }} proxy_protocol{{ end }};
77
ssl_certificate /etc/ssl/deis.cert;
88
ssl_certificate_key /etc/ssl/deis.key;
99
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;

router/image/templates/deis.key

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{{ .deis_router_sslKey }}
1+
{{ getv "/deis/router/sslKey" }}

router/image/templates/generate-certs

Lines changed: 10 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
# create or truncate the file
44
> /etc/ssl/deis_certs
55

6-
{{ range $cert := .deis_certs }}
7-
echo {{ $cert.Key }} >> /etc/ssl/deis_certs
6+
{{ range $cert := ls "/deis/certs" }}
7+
echo {{ $cert }} >> /etc/ssl/deis_certs
88
{{ end }}
99

1010
CERT_PATH=/etc/ssl/deis/certs
@@ -19,26 +19,14 @@ mkdir -p $CERT_PATH
1919
mkdir -p $KEY_PATH
2020

2121
while read etcd_path; do
22-
ETCD_SLUG=".$(echo $etcd_path | sed s/\\/// | sed s/\\//_/g)"
23-
ETCD_CERT_SLUG="${ETCD_SLUG}_cert"
24-
ETCD_KEY_SLUG="${ETCD_SLUG}_key"
25-
26-
# cert template
27-
{{ range $cert := .deis_certs }}{{ if $cert.Nodes }}
28-
{{ range $certFields := $cert.Nodes }}
29-
{{ if eq (Base $certFields.Key) "cert" }}
30-
if [[ "$(basename $etcd_path)" == "{{ Base $cert.Key }}" ]]; then
31-
cat << EOF > "$CERT_PATH/$(basename $etcd_path).cert"
32-
{{ $certFields.Value }}
22+
{{ range $cert := ls "/deis/certs" }}
23+
if [[ "$etcd_path" == "{{ $cert }}" ]]; then
24+
cat << EOF > "$CERT_PATH/$etcd_path.cert"
25+
{{ getv (printf "/deis/certs/%s/cert" $cert) }}
3326
EOF
34-
fi
35-
{{ else if eq (Base $certFields.Key) "key" }}
36-
if [[ "$(basename $etcd_path)" == "{{ Base $cert.Key }}" ]]; then
37-
cat << EOF > "$KEY_PATH/$(basename $etcd_path).key"
38-
{{ $certFields.Value }}
27+
cat << EOF > "$KEY_PATH/$etcd_path.key"
28+
{{ getv (printf "/deis/certs/%s/key" $cert) }}
3929
EOF
40-
fi
41-
{{ end }}
42-
{{ end }}
43-
{{ end }}{{ end }}
30+
fi{{ end }}
4431
done < /etc/ssl/deis_certs
32+

0 commit comments

Comments
 (0)