Skip to content
This repository was archived by the owner on Sep 30, 2020. It is now read-only.

Commit 7ea5f6b

Browse files
authored
Merge pull request #58 from gianrubio/etcdctl
Easily manage etcd cluster with env vars
2 parents 7237203 + a47d7d6 commit 7ea5f6b

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

config/templates/cloud-config-etcd

+20
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ coreos:
3131
Environment=ETCD_LISTEN_PEER_URLS=https://%H:2380
3232
Environment=ETCD_INITIAL_ADVERTISE_PEER_URLS=https://%H:2380
3333
PermissionsStartOnly=true
34+
ExecStartPre=/usr/bin/bash -c "sed -i \"s/^ETCDCTL_ENDPOINT.*$/ETCDCTL_ENDPOINT=https:\/\/$(hostname):2379/\" /etc/environment"
3435
ExecStartPre=/usr/bin/chown -R etcd:etcd /var/lib/etcd2
3536
enable: true
3637
command: start
@@ -86,6 +87,17 @@ coreos:
8687

8788

8889
write_files:
90+
91+
- path: /etc/environment
92+
permissions: 0644
93+
content: |
94+
COREOS_PUBLIC_IPV4=$public_ipv4
95+
COREOS_PRIVATE_IPV4=$private_ipv4
96+
ETCDCTL_CA_FILE=/etc/etcd2/ssl/ca.pem
97+
ETCDCTL_CERT_FILE=/etc/etcd2/ssl/etcd-client.pem
98+
ETCDCTL_KEY_FILE=/etc/etcd2/ssl/etcd-client-key.pem
99+
ETCDCTL_ENDPOINT=
100+
89101
- path: /opt/bin/ext4-format-volume-once
90102
permissions: 0700
91103
owner: root:root
@@ -120,3 +132,11 @@ write_files:
120132
- path: /etc/etcd2/ssl/etcd.pem.enc
121133
encoding: gzip+base64
122134
content: {{.TLSConfig.EtcdCert}}
135+
136+
- path: /etc/etcd2/ssl/etcd-client.pem.enc
137+
encoding: gzip+base64
138+
content: {{.TLSConfig.EtcdClientCert}}
139+
140+
- path: /etc/etcd2/ssl/etcd-client-key.pem.enc
141+
encoding: gzip+base64
142+
content: {{.TLSConfig.EtcdClientKey}}

0 commit comments

Comments
 (0)