diff --git a/.flannel.metadata b/.flannel.metadata index 96d706b..5d70a2d 100644 --- a/.flannel.metadata +++ b/.flannel.metadata @@ -1 +1 @@ -38c21cae429b2104a285309983e51d835140a765 SOURCES/v0.2.0.tar.gz +758f851bc0910a31837664fee04a0a8b14cc4cf3 SOURCES/flannel-29ffccc.tar.gz diff --git a/.gitignore b/.gitignore index bc5d287..caead23 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1 @@ -SOURCES/v0.2.0.tar.gz +SOURCES/flannel-29ffccc.tar.gz diff --git a/SOURCES/Notify-systemd-service-when-server-is-ready-to-liste.patch b/SOURCES/Notify-systemd-service-when-server-is-ready-to-liste.patch new file mode 100644 index 0000000..22655a3 --- /dev/null +++ b/SOURCES/Notify-systemd-service-when-server-is-ready-to-liste.patch @@ -0,0 +1,33 @@ +From c623d5666ef076de1b79c7b86d72a9d68847f672 Mon Sep 17 00:00:00 2001 +From: Jan Chaloupka +Date: Wed, 23 Sep 2015 09:40:46 +0200 +Subject: [PATCH] Notify systemd service when server is ready to listen + +--- + remote/server.go | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/remote/server.go b/remote/server.go +index a39f80c..6d6fb05 100644 +--- a/remote/server.go ++++ b/remote/server.go +@@ -26,6 +26,7 @@ import ( + + "github.com/coreos/flannel/Godeps/_workspace/src/github.com/coreos/etcd/pkg/transport" + "github.com/coreos/flannel/Godeps/_workspace/src/github.com/coreos/go-systemd/activation" ++ "github.com/coreos/flannel/Godeps/_workspace/src/github.com/coreos/go-systemd/daemon" + log "github.com/coreos/flannel/Godeps/_workspace/src/github.com/golang/glog" + "github.com/coreos/flannel/Godeps/_workspace/src/github.com/gorilla/mux" + "github.com/coreos/flannel/Godeps/_workspace/src/golang.org/x/net/context" +@@ -276,6 +277,8 @@ func RunServer(ctx context.Context, sm subnet.Manager, listenAddr, cafile, certf + c <- http.Serve(l, httpLogger(r)) + }() + ++ daemon.SdNotify("READY=1") ++ + select { + case <-ctx.Done(): + l.Close() +-- +1.9.3 + diff --git a/SOURCES/change-4001-to-2379-in-help-and-README.patch b/SOURCES/change-4001-to-2379-in-help-and-README.patch new file mode 100644 index 0000000..4716763 --- /dev/null +++ b/SOURCES/change-4001-to-2379-in-help-and-README.patch @@ -0,0 +1,39 @@ +From 3bc5bbbee3fdedcd26047c5aaaa8c6b3d68503b9 Mon Sep 17 00:00:00 2001 +From: Jan Chaloupka +Date: Thu, 10 Sep 2015 16:38:02 +0200 +Subject: [PATCH] change 4001 to 2379 in help and README + +--- + README.md | 2 +- + main.go | 2 +- + 2 files changed, 2 insertions(+), 2 deletions(-) + +diff --git a/README.md b/README.md +index 65b0c1f..d27d954 100644 +--- a/README.md ++++ b/README.md +@@ -178,7 +178,7 @@ $ flanneld --remote=10.0.0.3:8888 --networks=blue,green + + ``` + --public-ip="": IP accessible by other nodes for inter-host communication. Defaults to the IP of the interface being used for communication. +---etcd-endpoints=http://127.0.0.1:4001: a comma-delimited list of etcd endpoints. ++--etcd-endpoints=http://127.0.0.1:2379: a comma-delimited list of etcd endpoints. + --etcd-prefix=/coreos.com/network: etcd prefix. + --etcd-keyfile="": SSL key file used to secure etcd communication. + --etcd-certfile="": SSL certification file used to secure etcd communication. +diff --git a/main.go b/main.go +index 9e10455..88298bc 100644 +--- a/main.go ++++ b/main.go +@@ -62,7 +62,7 @@ var opts CmdLineOpts + + func init() { + flag.StringVar(&opts.publicIP, "public-ip", "", "IP accessible by other nodes for inter-host communication") +- flag.StringVar(&opts.etcdEndpoints, "etcd-endpoints", "http://127.0.0.1:4001,http://127.0.0.1:2379", "a comma-delimited list of etcd endpoints") ++ flag.StringVar(&opts.etcdEndpoints, "etcd-endpoints", "http://127.0.0.1:2379", "a comma-delimited list of etcd endpoints") + flag.StringVar(&opts.etcdPrefix, "etcd-prefix", "/coreos.com/network", "etcd prefix") + flag.StringVar(&opts.etcdKeyfile, "etcd-keyfile", "", "SSL key file used to secure etcd communication") + flag.StringVar(&opts.etcdCertfile, "etcd-certfile", "", "SSL certification file used to secure etcd communication") +-- +1.9.3 + diff --git a/SOURCES/change-coreos.com-network-to-atomic.io-network-in-he.patch b/SOURCES/change-coreos.com-network-to-atomic.io-network-in-he.patch new file mode 100644 index 0000000..f3022fa --- /dev/null +++ b/SOURCES/change-coreos.com-network-to-atomic.io-network-in-he.patch @@ -0,0 +1,90 @@ +From 0c636fe977a4503dd2ff6ec6d1316606f9d7ff44 Mon Sep 17 00:00:00 2001 +From: Jan Chaloupka +Date: Thu, 17 Sep 2015 14:44:33 +0200 +Subject: [PATCH] change coreos.com/network to atomic.io/network in help and + docs + +--- + Documentation/aws-vpc-backend.md | 2 +- + Documentation/gce-backend.md | 2 +- + README.md | 10 +++++----- + main.go | 2 +- + 4 files changed, 8 insertions(+), 8 deletions(-) + +diff --git a/Documentation/aws-vpc-backend.md b/Documentation/aws-vpc-backend.md +index abd6218..bf045bb 100644 +--- a/Documentation/aws-vpc-backend.md ++++ b/Documentation/aws-vpc-backend.md +@@ -114,7 +114,7 @@ $ etcd2 -advertise-client-urls http://$INTERNAL_IP:2379 -listen-client-urls http + - Publish configuration in etcd (ensure that the network range does not overlap with the one configured for the VPC) + + ``` +-$ etcdctl set /coreos.com/network/config '{"Network":"10.20.0.0/16", "Backend": {"Type": "aws-vpc"}}' ++$ etcdctl set /atomic.io/network/config '{"Network":"10.20.0.0/16", "Backend": {"Type": "aws-vpc"}}' + ``` + - Fetch the latest release using wget from [here](https://github.com/coreos/flannel/releases/download/v0.5.0/flannel-0.5.0-linux-amd64.tar.gz) + - Run flannel daemon: +diff --git a/Documentation/gce-backend.md b/Documentation/gce-backend.md +index 50245b4..595839b 100644 +--- a/Documentation/gce-backend.md ++++ b/Documentation/gce-backend.md +@@ -44,7 +44,7 @@ $ etcd2 -advertise-client-urls http://$INTERNAL_IP:2379 -listen-client-urls http + - Publish configuration in etcd (ensure that the network range does not overlap with the one configured for the GCE network) + + ``` +-$ etcdctl set /coreos.com/network/config '{"Network":"10.40.0.0/16", "Backend": {"Type": "gce"}}' ++$ etcdctl set /atomic.io/network/config '{"Network":"10.40.0.0/16", "Backend": {"Type": "gce"}}' + ``` + + - Fetch the 0.5 release using wget from [here](https://github.com/coreos/flannel/releases/download/v0.5.0/flannel-0.5.0-linux-amd64.tar.gz) +diff --git a/README.md b/README.md +index d27d954..f31552b 100644 +--- a/README.md ++++ b/README.md +@@ -41,7 +41,7 @@ docker run -v $SRC:/opt/flannel -i -t google/golang /bin/bash -c "cd /opt/flanne + ## Configuration + + flannel reads its configuration from etcd. +-By default, it will read the configuration from `/coreos.com/network/config` (can be overridden via `--etcd-prefix`). ++By default, it will read the configuration from `/atomic.io/network/config` (can be overridden via `--etcd-prefix`). + You can use `etcdctl` utility to set values in etcd. + The value of the config is a JSON dictionary with the following keys: + +@@ -143,9 +143,9 @@ Multi-network mode allows a single flannel daemon to join multiple networks. + Each network is independent from each other and has its own configuration, IP space, interfaces. + To configure three networks -- in this example named `blue`, `green`, and `red` -- start by publishing their configurations to etcd in different locations: + ``` +-$ etcdctl set /coreos.com/network/blue/config '{ "Network": "10.1.0.0/16", "Backend": { "Type": "vxlan", "VNI": 1 } }' +-$ etcdctl set /coreos.com/network/green/config '{ "Network": "10.2.0.0/16", "Backend": { "Type": "vxlan", "VNI": 2 } }' +-$ etcdctl set /coreos.com/network/red/config '{ "Network": "10.3.0.0/16", "Backend": { "Type": "vxlan", "VNI": 3 } }' ++$ etcdctl set /atomic.io/network/blue/config '{ "Network": "10.1.0.0/16", "Backend": { "Type": "vxlan", "VNI": 1 } }' ++$ etcdctl set /atomic.io/network/green/config '{ "Network": "10.2.0.0/16", "Backend": { "Type": "vxlan", "VNI": 2 } }' ++$ etcdctl set /atomic.io/network/red/config '{ "Network": "10.3.0.0/16", "Backend": { "Type": "vxlan", "VNI": 3 } }' + ``` + + Next, start the flannel daemon, specifying the networks to join: +@@ -179,7 +179,7 @@ $ flanneld --remote=10.0.0.3:8888 --networks=blue,green + ``` + --public-ip="": IP accessible by other nodes for inter-host communication. Defaults to the IP of the interface being used for communication. + --etcd-endpoints=http://127.0.0.1:2379: a comma-delimited list of etcd endpoints. +---etcd-prefix=/coreos.com/network: etcd prefix. ++--etcd-prefix=/atomic.io/network: etcd prefix. + --etcd-keyfile="": SSL key file used to secure etcd communication. + --etcd-certfile="": SSL certification file used to secure etcd communication. + --etcd-cafile="": SSL Certificate Authority file used to secure etcd communication. +diff --git a/main.go b/main.go +index 88298bc..e0ccd22 100644 +--- a/main.go ++++ b/main.go +@@ -63,7 +63,7 @@ var opts CmdLineOpts + func init() { + flag.StringVar(&opts.publicIP, "public-ip", "", "IP accessible by other nodes for inter-host communication") + flag.StringVar(&opts.etcdEndpoints, "etcd-endpoints", "http://127.0.0.1:2379", "a comma-delimited list of etcd endpoints") +- flag.StringVar(&opts.etcdPrefix, "etcd-prefix", "/coreos.com/network", "etcd prefix") ++ flag.StringVar(&opts.etcdPrefix, "etcd-prefix", "/atomic.io/network", "etcd prefix") + flag.StringVar(&opts.etcdKeyfile, "etcd-keyfile", "", "SSL key file used to secure etcd communication") + flag.StringVar(&opts.etcdCertfile, "etcd-certfile", "", "SSL certification file used to secure etcd communication") + flag.StringVar(&opts.etcdCAFile, "etcd-cafile", "", "SSL Certificate Authority file used to secure etcd communication") +-- +1.9.3 + diff --git a/SOURCES/flannel-Clarify-the-logging-when-VXLAN-interface-creation-fa.patch b/SOURCES/flannel-Clarify-the-logging-when-VXLAN-interface-creation-fa.patch deleted file mode 100644 index 12070ac..0000000 --- a/SOURCES/flannel-Clarify-the-logging-when-VXLAN-interface-creation-fa.patch +++ /dev/null @@ -1,27 +0,0 @@ -From b3a68558eecd794d7d27af50e0afbc6736939c9e Mon Sep 17 00:00:00 2001 -From: "John W. Linville" -Date: Fri, 6 Mar 2015 14:49:20 -0500 -Subject: [PATCH] Clarify the logging when VXLAN interface creation fails - ---- - backend/vxlan/vxlan.go | 3 ++- - 1 file changed, 2 insertions(+), 1 deletion(-) - -diff --git a/backend/vxlan/vxlan.go b/backend/vxlan/vxlan.go -index fb0c91f201fa..a6fa77905440 100644 ---- a/backend/vxlan/vxlan.go -+++ b/backend/vxlan/vxlan.go -@@ -79,7 +79,8 @@ func (vb *VXLANBackend) Init(extIface *net.Interface, extIP net.IP) (*backend.Su - if err == nil { - break - } else { -- log.Warning("Failed to create VXLAN interface, retrying...") -+ log.Error("VXLAN init: ", err) -+ log.Info("Retrying in 1 second...") - - // wait 1 sec before retrying - time.Sleep(1*time.Second) --- -2.1.0 - - diff --git a/SOURCES/flannel-tmpfiles.conf b/SOURCES/flannel-tmpfiles.conf new file mode 100644 index 0000000..1516e44 --- /dev/null +++ b/SOURCES/flannel-tmpfiles.conf @@ -0,0 +1 @@ +d /run/flannel 0755 root root - diff --git a/SOURCES/flannel-vxlan-create-retry.patch b/SOURCES/flannel-vxlan-create-retry.patch deleted file mode 100644 index 5a679ad..0000000 --- a/SOURCES/flannel-vxlan-create-retry.patch +++ /dev/null @@ -1,46 +0,0 @@ -From e246b8a9f6837ae6466c5822ede2e92b157e2d6a Mon Sep 17 00:00:00 2001 -From: Jan Chaloupka -Date: Sun, 8 Mar 2015 21:15:43 +0100 -Subject: [PATCH] flannel-vxlan-create-retry.patch - -Original author is John W. Linville. I have updated the patch to fit for rhel. - ---- - backend/vxlan/vxlan.go | 14 +++++++++++--- - 1 file changed, 11 insertions(+), 3 deletions(-) - -diff --git a/backend/vxlan/vxlan.go b/backend/vxlan/vxlan.go -index 93977b4..d50f520 100644 ---- a/backend/vxlan/vxlan.go -+++ b/backend/vxlan/vxlan.go -@@ -5,6 +5,7 @@ import ( - "fmt" - "net" - "sync" -+ "time" - - log "github.com/coreos/flannel/Godeps/_workspace/src/github.com/golang/glog" - "github.com/coreos/flannel/Godeps/_workspace/src/github.com/vishvananda/netlink" -@@ -73,9 +74,16 @@ func (vb *VXLANBackend) Init(extIface *net.Interface, extIP net.IP, ipMasq bool) - } - - var err error -- vb.dev, err = newVXLANDevice(&devAttrs) -- if err != nil { -- return nil, err -+ for { -+ vb.dev, err = newVXLANDevice(&devAttrs) -+ if err == nil { -+ break -+ } else { -+ log.Warning("Failed to create VXLAN interface, retrying...") -+ -+ // wait 1 sec before retrying -+ time.Sleep(1*time.Second) -+ } - } - - sa, err := newSubnetAttrs(extIP, vb.dev.MACAddr()) --- -1.9.3 - diff --git a/SOURCES/flanneld.service b/SOURCES/flanneld.service index 5b64a36..c60a72b 100644 --- a/SOURCES/flanneld.service +++ b/SOURCES/flanneld.service @@ -1,6 +1,9 @@ [Unit] Description=Flanneld overlay address etcd agent After=network.target +After=network-online.target +Wants=network-online.target +After=etcd.service Before=docker.service [Service] @@ -9,6 +12,8 @@ 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 +Restart=on-failure [Install] +WantedBy=multi-user.target RequiredBy=docker.service diff --git a/SOURCES/flanneld.sysconf b/SOURCES/flanneld.sysconf index 2b4d7b8..dde67f5 100644 --- a/SOURCES/flanneld.sysconf +++ b/SOURCES/flanneld.sysconf @@ -5,7 +5,7 @@ FLANNEL_ETCD="http://127.0.0.1:2379" # etcd config key. This is the configuration key that flannel queries # For address range assignment -FLANNEL_ETCD_KEY="/coreos.com/network" +FLANNEL_ETCD_KEY="/atomic.io/network" # Any additional options that you want to pass #FLANNEL_OPTIONS="" diff --git a/SOURCES/mk-docker-opts.sh b/SOURCES/mk-docker-opts.sh deleted file mode 100755 index 41f6022..0000000 --- a/SOURCES/mk-docker-opts.sh +++ /dev/null @@ -1,89 +0,0 @@ -#!/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 diff --git a/SPECS/flannel.spec b/SPECS/flannel.spec index 51e12d8..49e0f6e 100644 --- a/SPECS/flannel.spec +++ b/SPECS/flannel.spec @@ -1,30 +1,57 @@ +%global with_devel 0 +%global with_bundled 1 +%global with_debug 0 +%global with_check 0 + %global debug_package %{nil} %global provider github %global provider_tld com %global project coreos %global repo flannel %global import_path %{provider}.%{provider_tld}/%{project}/%{repo} -%global commit 52c3c4fb51109fdbb09a0d002ac35606f4a773ae +%global commit 29ffccc484cd46b6bc2d5a5b9d23e3e2f3f2851c %global shortcommit %(c=%{commit}; echo ${c:0:7}) +%global devel_main flannel-devel + Name: flannel -Version: 0.2.0 -Release: 10%{?dist} +Version: 0.5.3 +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 +Source0: https://%{import_path}/archive/%{commit}/%{repo}-%{shortcommit}.tar.gz +#Source0: https://%{import_path}/archive/v%{version}.tar.gz Source1: flanneld.sysconf Source2: flanneld.service Source3: flannel-docker.conf -Source4: mk-docker-opts.sh -ExclusiveArch: %{ix86} x86_64 %{arm} +Source4: flannel-tmpfiles.conf -Patch0: flannel-vxlan-create-retry.patch -Patch1: flannel-Clarify-the-logging-when-VXLAN-interface-creation-fa.patch +Patch0: change-4001-to-2379-in-help-and-README.patch +Patch1: change-coreos.com-network-to-atomic.io-network-in-he.patch +Patch2: Notify-systemd-service-when-server-is-ready-to-liste.patch + +ExclusiveArch: %{ix86} x86_64 %{arm} BuildRequires: golang >= 1.2.7 +%if ! 0%{?with_bundled} +BuildRequires: golang(code.google.com/p/goauth2/compute/serviceaccount) +BuildRequires: golang(code.google.com/p/google-api-go-client/compute/v1) +BuildRequires: golang(code.google.com/p/google-api-go-client/googleapi) +BuildRequires: golang(github.com/coreos/etcd/client) +BuildRequires: golang(github.com/coreos/etcd/pkg/transport) +BuildRequires: golang(github.com/coreos/go-iptables/iptables) +BuildRequires: golang(github.com/coreos/go-systemd/activation) +BuildRequires: golang(github.com/coreos/go-systemd/daemon) >= 2-2 +BuildRequires: golang(github.com/coreos/pkg/flagutil) +BuildRequires: golang(github.com/golang/glog) +BuildRequires: golang(github.com/gorilla/mux) +BuildRequires: golang(github.com/mitchellh/goamz/aws) +BuildRequires: golang(github.com/mitchellh/goamz/ec2) +BuildRequires: golang(github.com/vishvananda/netlink) +BuildRequires: golang(github.com/vishvananda/netlink/nl) +BuildRequires: golang(golang.org/x/net/context) +%endif BuildRequires: pkgconfig(systemd) Requires: systemd Requires(post): systemd @@ -36,13 +63,95 @@ Flannel is an etcd driven address management agent. Most commonly it is used to manage the ip addresses of overlay networks between systems running containers that need to communicate with one another. +%if 0%{?with_devel} +%package devel +Summary: %{summary} +BuildRequires: golang >= 1.2.7 + +BuildRequires: golang(code.google.com/p/goauth2/compute/serviceaccount) +BuildRequires: golang(code.google.com/p/google-api-go-client/compute/v1) +BuildRequires: golang(code.google.com/p/google-api-go-client/googleapi) +BuildRequires: golang(github.com/coreos/etcd/client) +BuildRequires: golang(github.com/coreos/etcd/pkg/transport) +BuildRequires: golang(github.com/coreos/go-iptables/iptables) +BuildRequires: golang(github.com/coreos/go-systemd/activation) +BuildRequires: golang(github.com/golang/glog) +BuildRequires: golang(github.com/gorilla/mux) +BuildRequires: golang(github.com/mitchellh/goamz/aws) +BuildRequires: golang(github.com/mitchellh/goamz/ec2) +BuildRequires: golang(github.com/vishvananda/netlink) +BuildRequires: golang(github.com/vishvananda/netlink/nl) +BuildRequires: golang(golang.org/x/net/context) + +Requires: golang(code.google.com/p/goauth2/compute/serviceaccount) +Requires: golang(code.google.com/p/google-api-go-client/compute/v1) +Requires: golang(code.google.com/p/google-api-go-client/googleapi) +Requires: golang(github.com/coreos/etcd/client) +Requires: golang(github.com/coreos/etcd/pkg/transport) +Requires: golang(github.com/coreos/go-iptables/iptables) +Requires: golang(github.com/coreos/go-systemd/activation) +Requires: golang(github.com/golang/glog) +Requires: golang(github.com/gorilla/mux) +Requires: golang(github.com/mitchellh/goamz/aws) +Requires: golang(github.com/mitchellh/goamz/ec2) +Requires: golang(github.com/vishvananda/netlink) +Requires: golang(github.com/vishvananda/netlink/nl) +Requires: golang(golang.org/x/net/context) + +Provides: golang(%{import_path}/backend) = %{version}-%{release} +Provides: golang(%{import_path}/backend/alloc) = %{version}-%{release} +Provides: golang(%{import_path}/backend/awsvpc) = %{version}-%{release} +Provides: golang(%{import_path}/backend/gce) = %{version}-%{release} +Provides: golang(%{import_path}/backend/hostgw) = %{version}-%{release} +Provides: golang(%{import_path}/backend/udp) = %{version}-%{release} +Provides: golang(%{import_path}/backend/vxlan) = %{version}-%{release} +Provides: golang(%{import_path}/network) = %{version}-%{release} +Provides: golang(%{import_path}/pkg/ip) = %{version}-%{release} +Provides: golang(%{import_path}/remote) = %{version}-%{release} +Provides: golang(%{import_path}/subnet) = %{version}-%{release} + +%description devel +Flannel is an etcd driven address management agent. Most commonly it is used to +manage the ip addresses of overlay networks between systems running containers +that need to communicate with one another. + +This package contains library source intended for +building other packages which use %{project}/%{repo}. +%endif + %prep -%setup -q -n %{repo}-%{version} +%setup -q -n %{repo}-%{commit} %patch0 -p1 %patch1 -p1 +%patch2 -p1 + +%if ! 0%{?with_bundled} +find . -name "*.go" \ + -print |\ + xargs sed -i 's/github.com\/coreos\/flannel\/Godeps\/_workspace\/src\///g' +%endif %build +%if ! 0%{?with_bundled} +rm -rf Godeps +mkdir _build +pushd _build + mkdir -p src/github.com/coreos + ln -s $(dirs +1 -l) src/github.com/coreos/flannel +popd + +%if 0%{?with_debug} +function gobuild { go build -a -ldflags "-B 0x$(head -c20 /dev/urandom|od -An -tx1|tr -d ' \n')" -v -x "$@"; } +%else +function gobuild { go build -a -v -x "$@"; } +%endif + +mkdir bin +export GOPATH=${PWD}/_build:%{gopath} +gobuild -o bin/flanneld . +%else ./build +%endif %install # package with binary @@ -50,7 +159,25 @@ install -D -p -m 755 bin/flanneld %{buildroot}%{_bindir}/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 +install -D -p -m 755 dist/mk-docker-opts.sh %{buildroot}%{_libexecdir}/flannel/mk-docker-opts.sh +install -D -p -m 0755 %{SOURCE4} %{buildroot}%{_tmpfilesdir}/%{name}.conf + +mkdir -p %{buildroot}/run +install -d -m 0755 %{buildroot}/run/%{name}/ + +%if 0%{?with_devel} +# devel package +install -d -p %{buildroot}/%{gopath}/src/%{import_path}/ +cp -pav {backend,pkg,subnet} %{buildroot}/%{gopath}/src/%{import_path}/ +%endif + +%check +%if 0%{?with_check} +export GOPATH=${PWD}/_build:%{gopath} +go test %{import_path}/pkg/ip +#go test %{import_path}/remote +go test %{import_path}/subnet +%endif %post %systemd_post flanneld.service @@ -69,28 +196,91 @@ install -D -p -m 755 %{SOURCE4} %{buildroot}%{_libexecdir}/flannel/mk-docker-opt %{_unitdir}/docker.service.d/flannel.conf %{_libexecdir}/flannel/mk-docker-opts.sh %config(noreplace) %{_sysconfdir}/sysconfig/flanneld +%dir /run/%{name}/ +%{_tmpfilesdir}/%{name}.conf + +%if 0%{?with_devel} +%files devel +%doc CONTRIBUTING.md LICENSE MAINTAINERS README.md DCO NOTICE +%dir %{gopath}/src/%{provider}.%{provider_tld}/%{project} +%dir %{gopath}/src/%{import_path}/ +%{gopath}/src/%{import_path}/ +%endif %changelog -* Mon Jul 20 2015 jchaloup - 0.2.0-10 -- Revert changes not for AH 7.1.4 +* Fri Oct 30 2015 jchaloup - 0.5.3-8 +- Add After=network-online.target and Wants=network-online.target + to actively wait for network to get on + resolves: #1275837 + +* Fri Oct 30 2015 jchaloup - 0.5.3-7 +- Add Restart=on-failure to flanned.service file + +* Thu Oct 08 2015 jchaloup - 0.5.3-6 +- Make flannel start after the network is ready + resolves: #1269291 + +* Wed Sep 23 2015 jchaloup - 0.5.3-5 +- Flannel now owns /run/flannel directory + +* Wed Sep 23 2015 jchaloup - 0.5.3-4 +- Send systemd notification when -listen is used +- Create /run/flannel directory for mk-docker-opts.sh + +* Thu Sep 17 2015 jchaloup - 0.5.3-3 +- Change coreos.com/network to atomic.io/network in help and docs + related: #1261756 + +* Thu Sep 10 2015 jchaloup - 0.5.3-2 +- Change 4001 port in flannel --help and README.md as well + resolves: #1261756 + +* Mon Aug 31 2015 jchaloup - 0.5.3-1 +- Update to 0.5.3 + resolves: #1258876 + +* Tue Jul 21 2015 jchaloup - 0.5.1-3 - Change etcd port from 4001 to 2379 - resolves: #1244626 +- Polish spec file -* Fri Jul 10 2015 jchaloup - 0.2.0-9 +* Fri Jul 10 2015 jchaloup - 0.5.1-2 - Change flannel prefix from /coreos.com/network to /atomic.io/network -* Fri Jul 10 2015 jchaloup - 0.2.0-8 +* Fri Jul 10 2015 jchaloup - 0.5.1-1 +- Update to 0.5.1 + +* Fri Jul 10 2015 jchaloup - 0.5.0-3 - Add After=etcd.service to flanneld.service -* Sun Mar 08 2015 jchaloup - 0.2.0-7 -- flanneld fails to start on boot - resolves: #1184579 +* Fri Jun 26 2015 jchaloup - 0.5.0-2 +- Add missing Requires: golang(github.com/gorilla/mux) to devel subpackage + +* Fri Jun 26 2015 jchaloup - 0.5.0-1 +- Update to 0.5.0 + +* Wed Jun 17 2015 Fedora Release Engineering - 0.4.1-3 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild + +* Fri May 22 2015 jchaloup - 0.4.1-2 +- Bump to upstream 9180d9a37e2ae6d7fceabea51c6416767c6b50f6 + related: #1223445 + +* Wed May 20 2015 jchaloup - 0.4.1-1 +- Bump to upstream 4ab27ddd3e87eb2daf152513c0b1dc22879393a8 + resolves: #1223445 + +* Fri Apr 10 2015 Eric Paris - 0.3.1-1 +- Bump to version 0.3.1 + +* Tue Apr 7 2015 Eric Paris - 0.3.0-1 +- Bump to version 0.3.0 -* Thu Mar 5 2015 Eric Paris -- remove {} around FLANNEL_OPTIONS so you can use more than 1 +* Mon Mar 30 2015 jchaloup - 0.2.0-7 +- Add debug info + related: #1165688 -* Fri Jan 30 2015 jchaloup - 0.2.0-6 -- remove devel subpackage +* Fri Feb 20 2015 jchaloup - 0.2.0-6 +- Update [Build]Requires for go-etcd package * Wed Jan 21 2015 Eric Paris - 0.2.0-5 - Add generator more like upstream wants to use, use ExecStartPost