This repository has been archived by the owner on Sep 30, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 295
Easily manage etcd cluster with env vars #58
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 | ||
|
@@ -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= | ||
|
||
- path: /opt/bin/ext4-format-volume-once | ||
permissions: 0700 | ||
owner: root:root | ||
|
@@ -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}} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Note to self:
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
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
?There was a problem hiding this comment.
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:
etcdctl
ETCDCTL_ENDPOINT
value is always configured on starting/restartingetcd2.service
, automatically.etcd2.service
doesn't break/etc/environment
as we can see in https://github.com/coreos/kube-aws/pull/58/files#diff-c88cb625705bf9711a2f576a1975cb72R34echo ETCDCTL_ENDPOINT="https://$(hostname):2379/" >> /etc/environment
would break, or needlessly bloat the environment file at least, whenetcd2.service
got restarted.