From eee92b76b3fbe9dbcd6523c5cd14523cd0b40af2 Mon Sep 17 00:00:00 2001 From: Alex Polvi Date: Wed, 19 Mar 2014 03:12:03 +0000 Subject: [PATCH] fix(c10n): fix a few c10n errors --- .../coreos-base/oem-ami/files/cloud-config.yml | 4 +++- .../coreos-base/oem-ami/files/coreos-c10n | 13 +++++++++---- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/sdk_container/src/third_party/coreos-overlay/coreos-base/oem-ami/files/cloud-config.yml b/sdk_container/src/third_party/coreos-overlay/coreos-base/oem-ami/files/cloud-config.yml index 1f8e941114..96773f935e 100644 --- a/sdk_container/src/third_party/coreos-overlay/coreos-base/oem-ami/files/cloud-config.yml +++ b/sdk_container/src/third_party/coreos-overlay/coreos-base/oem-ami/files/cloud-config.yml @@ -32,6 +32,8 @@ coreos: Description=Legacy c10n support from EC2 metadata Requires=ec2-cloudinit.service After=ec2-cloudinit.service + # hack: This only runs on the generic images + ConditionPathExists=/media/state/overlays/home [Service] Type=oneshot @@ -39,7 +41,7 @@ coreos: ExecStart=/usr/share/oem/bin/coreos-c10n write_files: - - path: /etc/systemd/system/etcd.service.d/10-oem.conf + - path: /run/systemd/system/etcd.service.d/10-oem.conf permissions: 0644 content: | [Service] diff --git a/sdk_container/src/third_party/coreos-overlay/coreos-base/oem-ami/files/coreos-c10n b/sdk_container/src/third_party/coreos-overlay/coreos-base/oem-ami/files/coreos-c10n index c34db26bcd..4090add55d 100755 --- a/sdk_container/src/third_party/coreos-overlay/coreos-base/oem-ami/files/coreos-c10n +++ b/sdk_container/src/third_party/coreos-overlay/coreos-base/oem-ami/files/coreos-c10n @@ -5,6 +5,7 @@ depwarn() { echo "DEPRECATION WARNING! $1 See docs for the new cloud-config format here: $DOCS" 1>&2; } +# this will only run on generic images C10N_ENDPOINT=https://core-api.appspot.com/v1/c10n/group META_URL="http://169.254.169.254/latest" @@ -86,8 +87,7 @@ fi if [ -n "${ETCD_DISCOVERY_URL}" ]; then echo "Using '${ETCD_DISCOVERY_URL}' as etcd discovery url" echo "[Service] -Environment=ETCD_DISCOVERY=${ETCD_DISCOVERY_URL} -Environment=ETCD_NAME=${IP}" > ${ETCD_SERVICE_D}/21-c10n.conf +Environment=ETCD_DISCOVERY=${ETCD_DISCOVERY_URL}" > ${ETCD_SERVICE_D}/21-c10n.conf # ...otherwise, we treat the provided user-data as a legacy c10n URL elif [ -n "${C10N_TOKEN}" ]; then depwarn "Bootstrapping etcd with the c10n service is deprecated." @@ -98,8 +98,7 @@ elif [ -n "${C10N_TOKEN}" ]; then /usr/bin/block-until-url $C10N_ENDPOINT ETCD_PEERS=$(curl -s $C10N_ENDPOINT -d "c10n_url=$C10N_TOKEN" -d"ip_list=$IP") - echo "[Service] -Environment=ETCD_NAME=${IP}" > ${ETCD_SERVICE_D}/22-c10n.conf + echo "[Service]" > ${ETCD_SERVICE_D}/22-c10n.conf for peer in $ETCD_PEERS; do echo "Environment=ETCD_PEERS=${peer}" >> ${ETCD_SERVICE_D}/22-c10n.conf done @@ -109,3 +108,9 @@ if [ "$START_FLEET" = "1" ]; then echo "Starting fleet" systemctl start --no-block fleet fi + +# on generic images, we only set the name to the internal IP +echo "[Service] +Environment=ETCD_NAME=${IP} +Environment=ETCD_ADDR=${IP}:4001 +Environment=ETCD_PEER_ADDR=${IP}:7001" > ${ETCD_SERVICE_D}/23-c10n.conf