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

Easily manage etcd cluster with env vars #58

Merged
merged 1 commit into from
Nov 17, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions config/templates/cloud-config-etcd
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ coreos:
Environment=ETCD_LISTEN_PEER_URLS=https://%H:2380
Environment=ETCD_INITIAL_ADVERTISE_PEER_URLS=https://%H:2380
PermissionsStartOnly=true
ExecStartPre=/usr/bin/bash -c "sed -i \"s/^ETCDCTL_ENDPOINT.*$/ETCDCTL_ENDPOINT=https:\/\/$(hostname):2379/\" /etc/environment"
ExecStartPre=/usr/bin/chown -R etcd:etcd /var/lib/etcd2
enable: true
command: start
Expand Down Expand Up @@ -86,6 +87,17 @@ coreos:


write_files:

- path: /etc/environment
permissions: 0644
content: |
COREOS_PUBLIC_IPV4=$public_ipv4
COREOS_PRIVATE_IPV4=$private_ipv4
ETCDCTL_CA_FILE=/etc/etcd2/ssl/ca.pem
ETCDCTL_CERT_FILE=/etc/etcd2/ssl/etcd-client.pem
ETCDCTL_KEY_FILE=/etc/etcd2/ssl/etcd-client-key.pem
ETCDCTL_ENDPOINT=
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm just curious but may I ask why you've explicitly emptied ETCD_ENDPOINT here?
Just to note that we have to explicitly set it when running etcdctl?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I realized that this line is the "marker" for https://github.com/coreos/kube-aws/pull/58/files#diff-c88cb625705bf9711a2f576a1975cb72R34.
Doing this makes it possible to:

  • Mention that we have to provided an actual value when running etcdctl
  • Ensure two things:


- path: /opt/bin/ext4-format-volume-once
permissions: 0700
owner: root:root
Expand Down Expand Up @@ -120,3 +132,11 @@ write_files:
- path: /etc/etcd2/ssl/etcd.pem.enc
encoding: gzip+base64
content: {{.TLSConfig.EtcdCert}}

- path: /etc/etcd2/ssl/etcd-client.pem.enc
encoding: gzip+base64
content: {{.TLSConfig.EtcdClientCert}}

- path: /etc/etcd2/ssl/etcd-client-key.pem.enc
encoding: gzip+base64
content: {{.TLSConfig.EtcdClientKey}}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note to self:

  • This would make user-data much bigger than before... Oh, we now have the --s3-uri option to workaround that. No problem 😃
  • This does add additional credentials we didn't have in etcd nodes before. Any security concerns for saving more credentials in etcd nodes? No.