Skip to content

Commit

Permalink
Update flannel to use sd-notify
Browse files Browse the repository at this point in the history
Remove hacky loop to check for Docker configs, and update to use
sd-notify instead to alert systemd when flannel is ready.

Signed-off-by: Yu Qi Zhang <jerzhang@redhat.com>

Closes: #24
Approved by: giuseppe
  • Loading branch information
yuqi-zhang authored and rh-atomic-bot committed May 16, 2017
1 parent 5dd5221 commit fb82b8b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
4 changes: 3 additions & 1 deletion flannel/flanneld-run.sh
Expand Up @@ -7,7 +7,7 @@ echo "EnvironmentFile=-/run/$NAME/docker" >> /etc/systemd/system/docker.service.
# Ensure this file doesn't already exist.
rm -f run/flannel/subnet.env

/usr/bin/flanneld &
NOTIFY_SOCKET=/dev/null /usr/bin/flanneld &
child=$!

while test \! -e /run/flannel/subnet.env
Expand All @@ -17,4 +17,6 @@ done

/usr/libexec/flannel/mk-docker-opts.sh -k DOCKER_NETWORK_OPTIONS -d /run/flannel/docker

systemd-notify --ready

wait $child
3 changes: 2 additions & 1 deletion flannel/service.template
Expand Up @@ -7,9 +7,10 @@ After=$AFTER
Before=docker.service

[Service]
Type=notify
NotifyAccess=all
ExecStart=$EXEC_START
ExecStop=$EXEC_STOP
ExecStartPost=/usr/bin/sh -c "while test \! -s ${RUN_DIRECTORY}/${NAME}/docker; do sleep 0.1; done"
ExecStopPost=/bin/rm /etc/systemd/system/docker.service.d/$NAME.conf
Restart=on-failure
WorkingDirectory=$DESTDIR
Expand Down

0 comments on commit fb82b8b

Please sign in to comment.