Merge pull request #452 from polvi/c10n-fu

C10n fu
This commit is contained in:
polvi 2014-03-18 20:35:17 -07:00
commit e1bf07d74d
4 changed files with 12 additions and 6 deletions

View File

@ -10,7 +10,7 @@ CROS_WORKON_REPO="git://github.com"
if [[ "${PV}" == 9999 ]]; then
KEYWORDS="~amd64 ~arm ~x86"
else
CROS_WORKON_COMMIT="313426fa9b802be7e667817002953a2e9db79234"
CROS_WORKON_COMMIT="f178039e261585b21d2cf7a2c545728cec2031e3"
KEYWORDS="amd64 arm x86"
fi

View File

@ -32,6 +32,7 @@ coreos:
Description=Legacy c10n support from EC2 metadata
Requires=ec2-cloudinit.service
After=ec2-cloudinit.service
ConditionPathIsMountPoint=!/usr
[Service]
Type=oneshot
@ -39,7 +40,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]

View File

@ -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