eparis pushed to flannel (f20). "update to include systemd magic and docker generators"
notifications at fedoraproject.org
notifications at fedoraproject.org
Tue Apr 7 15:06:39 UTC 2015
>From fc80c5bbc4b599708259f223d54f15cd6389be89 Mon Sep 17 00:00:00 2001
From: Eric Paris <eparis at redhat.com>
Date: Tue, 7 Apr 2015 10:50:44 -0400
Subject: update to include systemd magic and docker generators
diff --git a/.gitignore b/.gitignore
index 73724f4..3bb238a 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,2 +1,3 @@
+/clog
/flannel-a7b435a.tar.gz
/v0.2.0.tar.gz
diff --git a/flannel-docker.conf b/flannel-docker.conf
new file mode 100644
index 0000000..8f55177
--- /dev/null
+++ b/flannel-docker.conf
@@ -0,0 +1,2 @@
+[Service]
+EnvironmentFile=-/run/flannel/docker
diff --git a/flannel.spec b/flannel.spec
index 1b47774..cd64456 100644
--- a/flannel.spec
+++ b/flannel.spec
@@ -10,20 +10,24 @@
Name: flannel
Version: 0.2.0
-Release: 7%{?dist}
+Release: 8%{?dist}
Summary: Etcd address management agent for overlay networks
License: ASL 2.0
URL: https://%{import_path}
#Source0: https://%{import_path}/archive/%{commit}/%{repo}-%{shortcommit}.tar.gz
Source0: https://%{import_path}/archive/v%{version}.tar.gz
-Source1: flanneld.service
-Source2: flanneld.sysconf
+Source1: flanneld.sysconf
+Source2: flanneld.service
+Source3: flannel-docker.conf
+Source4: mk-docker-opts.sh
ExclusiveArch: %{ix86} x86_64 %{arm}
Patch0: flannel-remove-third-party-dependency-on-Godeps.patch
BuildRequires: golang >= 1.2.7
BuildRequires: golang-cover
+# accidentally missing in golang-github-coreos-go-etcd
+BuildRequires: golang(github.com/coreos/etcd/etcdserver/etcdhttp/httptypes)
BuildRequires: golang(github.com/coreos/go-systemd/daemon) >= 2-2
BuildRequires: golang(github.com/coreos/go-etcd/etcd)
BuildRequires: golang(github.com/golang/glog)
@@ -43,6 +47,8 @@ that need to communicate with one another.
%package devel
BuildRequires: golang >= 1.2.7
BuildRequires: golang-cover
+# accidentally missing in golang-github-coreos-go-etcd
+BuildRequires: golang(github.com/coreos/etcd/etcdserver/etcdhttp/httptypes)
BuildRequires: golang(github.com/coreos/go-systemd/daemon) >= 2-2
BuildRequires: golang(github.com/coreos/go-etcd/etcd)
BuildRequires: golang(github.com/golang/glog)
@@ -51,6 +57,8 @@ BuildRequires: golang(github.com/vishvananda/netlink)
BuildRequires: pkgconfig(systemd)
Requires: golang >= 1.2.7
Requires: golang-cover
+# accidentally missing in golang-github-coreos-go-etcd
+Requires: golang(github.com/coreos/etcd/etcdserver/etcdhttp/httptypes)
Requires: golang(github.com/coreos/go-systemd/daemon) >= 2-2
Requires: golang(github.com/coreos/go-etcd/etcd)
Requires: golang(github.com/golang/glog)
@@ -92,8 +100,10 @@ GOPATH=${PWD}/_build:%{gopath} gobuild -o bin/flanneld .
%install
# package with binary
install -D -p -m 755 bin/flanneld %{buildroot}%{_bindir}/flanneld
-install -D -p -m 644 %{SOURCE1} %{buildroot}%{_unitdir}/flanneld.service
-install -D -p -m 644 %{SOURCE2} %{buildroot}/etc/sysconfig/flanneld
+install -D -p -m 644 %{SOURCE1} %{buildroot}/etc/sysconfig/flanneld
+install -D -p -m 644 %{SOURCE2} %{buildroot}%{_unitdir}/flanneld.service
+install -D -p -m 644 %{SOURCE3} %{buildroot}%{_unitdir}/docker.service.d/flannel.conf
+install -D -p -m 755 %{SOURCE4} %{buildroot}%{_libexecdir}/flannel/mk-docker-opts.sh
# devel package
install -d -p %{buildroot}/%{gopath}/src/%{import_path}/
cp -pav {backend,pkg,subnet} %{buildroot}/%{gopath}/src/%{import_path}/
@@ -112,6 +122,8 @@ cp -pav {backend,pkg,subnet} %{buildroot}/%{gopath}/src/%{import_path}/
%doc CONTRIBUTING.md LICENSE MAINTAINERS README.md DCO NOTICE
%{_bindir}/flanneld
%{_unitdir}/flanneld.service
+%{_unitdir}/docker.service.d/flannel.conf
+%{_libexecdir}/flannel/mk-docker-opts.sh
%config(noreplace) %{_sysconfdir}/sysconfig/flanneld
%files devel
@@ -121,12 +133,26 @@ cp -pav {backend,pkg,subnet} %{buildroot}/%{gopath}/src/%{import_path}/
%{gopath}/src/%{import_path}/
%changelog
+* Tue Apr 7 2015 Eric Paris <eparis at redhat.com> - 0.2.0-8
+- Update to include systemd service fixes and docker auto-configuration
+
* Mon Mar 30 2015 jchaloup <jchaloup at redhat.com> - 0.2.0-7
- Add debug info
related: #1165688
-* Fri Feb 20 2015 jchaloup <jchaloup at redhat.com> - 0.2.0-3
-- Update [Build]Requires for go-etcd package and go-systemd
+* Fri Feb 20 2015 jchaloup <jchaloup at redhat.com> - 0.2.0-6
+- Update [Build]Requires for go-etcd package
+
+* Wed Jan 21 2015 Eric Paris <eparis at redhat.com> - 0.2.0-5
+- Add generator more like upstream wants to use, use ExecStartPost
+ (https://github.com/coreos/flannel/pull/85)
+
+* Tue Jan 20 2015 Eric Paris <eparis at redhat.com> - 0.2.0-4
+- Add generator to turn flannel env vars into docker flags
+
+* Tue Jan 20 2015 Peter Lemenkov <lemenkov at gmail.com> - 0.2.0-3
+- Change (Build)Requires accordning to the recent changes
+ (http://pkgs.fedoraproject.org/cgit/golang-github-coreos-go-systemd.git/commit/?id=204f61c)
* Fri Jan 16 2015 Peter Lemenkov <lemenkov at gmail.com> - 0.2.0-2
- Change flannel service type to notify. See
diff --git a/flanneld.service b/flanneld.service
index 2c87a0b..5b64a36 100644
--- a/flanneld.service
+++ b/flanneld.service
@@ -1,14 +1,14 @@
-#Systemd unit file for running flanneld
-
- [Unit]
+[Unit]
Description=Flanneld overlay address etcd agent
After=network.target
+Before=docker.service
[Service]
Type=notify
EnvironmentFile=/etc/sysconfig/flanneld
+EnvironmentFile=-/etc/sysconfig/docker-network
ExecStart=/usr/bin/flanneld -etcd-endpoints=${FLANNEL_ETCD} -etcd-prefix=${FLANNEL_ETCD_KEY} $FLANNEL_OPTIONS
+ExecStartPost=/usr/libexec/flannel/mk-docker-opts.sh -k DOCKER_NETWORK_OPTIONS -d /run/flannel/docker
[Install]
-WantedBy=docker.service
-
+RequiredBy=docker.service
diff --git a/mk-docker-opts.sh b/mk-docker-opts.sh
new file mode 100755
index 0000000..41f6022
--- /dev/null
+++ b/mk-docker-opts.sh
@@ -0,0 +1,89 @@
+#!/bin/bash
+
+usage() {
+ echo "$0 [-f FLANNEL-ENV-FILE] [-d DOCKER-ENV-FILE] [-i] [-c] [-m]
+
+Generate Docker daemon options based on flannel env file
+OPTIONS:
+ -f Path to flannel env file. Defaults to /run/flannel/subnet.env
+ -d Path to Docker env file to write to. Defaults to /run/docker_opts.env
+ -i Output each Docker option as individual var. e.g. DOCKER_OPT_MTU=1500
+ -c Output combined Docker options into DOCKER_OPTS var
+ -k Set the combined options key to this value (default DOCKER_OPTS=)
+ -m Do not output --ip-masq (useful for older Docker version)
+" >/dev/stderr
+
+ exit 1
+}
+
+flannel_env="/run/flannel/subnet.env"
+docker_env="/run/docker_opts.env"
+combined_opts_key="DOCKER_OPTS"
+indiv_opts=false
+combined_opts=false
+ipmasq=true
+
+while getopts "f:d:ick:" opt; do
+ case $opt in
+ f)
+ flannel_env=$OPTARG
+ ;;
+ d)
+ docker_env=$OPTARG
+ ;;
+ i)
+ indiv_opts=true
+ ;;
+ c)
+ combined_opts=true
+ ;;
+ m)
+ ipmasq=false
+ ;;
+ k)
+ combined_opts_key=$OPTARG
+ ;;
+ \?)
+ usage
+ ;;
+ esac
+done
+
+if [ $indiv_opts = false ] && [ $combined_opts = false ]; then
+ indiv_opts=true
+ combined_opts=true
+fi
+
+if [ -f "$flannel_env" ]; then
+ source $flannel_env
+fi
+
+if [ -n "$FLANNEL_SUBNET" ]; then
+ DOCKER_OPT_BIP="--bip=$FLANNEL_SUBNET"
+fi
+
+if [ -n "$FLANNEL_MTU" ]; then
+ DOCKER_OPT_MTU="--mtu=$FLANNEL_MTU"
+fi
+
+if [ "$FLANNEL_IPMASQ" = true ] && [ $ipmasq = true ] ; then
+ DOCKER_OPT_IPMASQ="--ip-masq=false"
+fi
+
+eval docker_opts="\$${combined_opts_key}"
+docker_opts+=" "
+
+echo -n "" >$docker_env
+for opt in $(compgen -v DOCKER_OPT_); do
+ eval val=\$$opt
+
+ if [ "$indiv_opts" = true ]; then
+ echo "$opt=\"$val\"" >>$docker_env
+ fi
+
+ docker_opts+="$val "
+done
+
+if [ "$combined_opts" = true ]; then
+ echo "${combined_opts_key}=\"${docker_opts}\"" >>$docker_env
+fi
--
cgit v0.10.2
http://pkgs.fedoraproject.org/cgit/flannel.git/commit/?h=f20&id=fc80c5bbc4b599708259f223d54f15cd6389be89
More information about the scm-commits
mailing list