diff --git a/.flannel.metadata b/.flannel.metadata new file mode 100644 index 0000000..ee1604d --- /dev/null +++ b/.flannel.metadata @@ -0,0 +1 @@ +1687e75367c05f3aea2397dd4ada0cfe062dee19 SOURCES/flannel-683c6e9.tar.gz diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..e74cd31 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +SOURCES/flannel-683c6e9.tar.gz diff --git a/README.md b/README.md deleted file mode 100644 index 98f42b4..0000000 --- a/README.md +++ /dev/null @@ -1,4 +0,0 @@ -The master branch has no content - -Look at the c7 branch if you are working with CentOS-7, or the c4/c5/c6 branch for CentOS-4, 5 or 6 -If you find this file in a distro specific branch, it means that no content has been checked in yet 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..0a5847a --- /dev/null +++ b/SOURCES/change-4001-to-2379-in-help-and-README.patch @@ -0,0 +1,39 @@ +From ddafb2f121148b778081c5c934032870e755c59f Mon Sep 17 00:00:00 2001 +From: Jan Chaloupka +Date: Fri, 16 Dec 2016 17:01:13 +0100 +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 dffd3ad..6e691c6 100644 +--- a/README.md ++++ b/README.md +@@ -182,7 +182,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 d6dc894..b6493e0 100644 +--- a/main.go ++++ b/main.go +@@ -61,7 +61,7 @@ type CmdLineOpts struct { + var opts CmdLineOpts + + func init() { +- 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") +-- +2.7.4 + 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..99cfafc --- /dev/null +++ b/SOURCES/change-coreos.com-network-to-atomic.io-network-in-he.patch @@ -0,0 +1,243 @@ +From a9ca02c0e9ec58f86171a1bf9d122bd1d1656d01 Mon Sep 17 00:00:00 2001 +From: Jan Chaloupka +Date: Fri, 16 Dec 2016 17:07:05 +0100 +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 +- + subnet/mock_etcd_test.go | 34 +++++++++++++++++----------------- + subnet/registry.go | 2 +- + subnet/registry_test.go | 8 ++++---- + 7 files changed, 30 insertions(+), 30 deletions(-) + +diff --git a/Documentation/aws-vpc-backend.md b/Documentation/aws-vpc-backend.md +index 357c9e9..68217d4 100644 +--- a/Documentation/aws-vpc-backend.md ++++ b/Documentation/aws-vpc-backend.md +@@ -116,7 +116,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 35ed8b4..675c4b0 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 6e691c6..7b05d41 100644 +--- a/README.md ++++ b/README.md +@@ -43,7 +43,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: + +@@ -147,9 +147,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: +@@ -183,7 +183,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 b6493e0..5adfb55 100644 +--- a/main.go ++++ b/main.go +@@ -62,7 +62,7 @@ var opts CmdLineOpts + + func init() { + 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") +diff --git a/subnet/mock_etcd_test.go b/subnet/mock_etcd_test.go +index 8927cd2..e838282 100644 +--- a/subnet/mock_etcd_test.go ++++ b/subnet/mock_etcd_test.go +@@ -70,17 +70,17 @@ func watchMockEtcd(ctx context.Context, watcher etcd.Watcher, result chan error) + } + + expected := []evt{ +- {"/coreos.com/network/foobar/config", "create", false}, +- {"/coreos.com/network/blah/config", "create", false}, +- {"/coreos.com/network/blah/config", "update", false}, +- {"/coreos.com/network/foobar/config", "delete", false}, +- {"/coreos.com/network/foobar", "delete", false}, ++ {"/atomic.io/network/foobar/config", "create", false}, ++ {"/atomic.io/network/blah/config", "create", false}, ++ {"/atomic.io/network/blah/config", "update", false}, ++ {"/atomic.io/network/foobar/config", "delete", false}, ++ {"/atomic.io/network/foobar", "delete", false}, + } + +- // Wait for delete events on /coreos.com/network/foobar and its ++ // Wait for delete events on /atomic.io/network/foobar and its + // 'config' child, and for the update event on +- // /coreos.com/network/foobar (for 'config' delete) and on +- // /coreos.com/network (for 'foobar' delete) ++ // /atomic.io/network/foobar (for 'config' delete) and on ++ // /atomic.io/network (for 'foobar' delete) + numEvents := 0 + for { + resp, err := watcher.Next(ctx) +@@ -134,24 +134,24 @@ func TestMockEtcd(t *testing.T) { + + // Create base test keys + sopts := &etcd.SetOptions{Dir: true} +- r, err = m.Set(ctx, "/coreos.com/network", "", sopts) ++ r, err = m.Set(ctx, "/atomic.io/network", "", sopts) + e = &etcd.Response{Action: "create", Index: 1002} + expectSuccess(t, r, err, e, "") + + wopts := &etcd.WatcherOptions{AfterIndex: m.index, Recursive: true} +- watcher := m.Watcher("/coreos.com/network", wopts) ++ watcher := m.Watcher("/atomic.io/network", wopts) + + result := make(chan error, 1) + go watchMockEtcd(ctx, watcher, result) + + // Populate etcd with some keys +- netKey1 := "/coreos.com/network/foobar/config" ++ netKey1 := "/atomic.io/network/foobar/config" + netValue := "{ \"Network\": \"10.1.0.0/16\", \"Backend\": { \"Type\": \"host-gw\" } }" + r, err = m.Create(ctx, netKey1, netValue) + e = &etcd.Response{Action: "create", Index: 1004} + expectSuccess(t, r, err, e, netValue) + +- netKey2 := "/coreos.com/network/blah/config" ++ netKey2 := "/atomic.io/network/blah/config" + netValue = "{ \"Network\": \"10.1.1.0/16\", \"Backend\": { \"Type\": \"host-gw\" } }" + r, err = m.Create(ctx, netKey2, netValue) + e = &etcd.Response{Action: "create", Index: 1006} +@@ -178,7 +178,7 @@ func TestMockEtcd(t *testing.T) { + + // test directory listing + opts = &etcd.GetOptions{Recursive: true, Quorum: true} +- r, err = m.Get(ctx, "/coreos.com/network/", opts) ++ r, err = m.Get(ctx, "/atomic.io/network/", opts) + e = &etcd.Response{Action: "get", Index: 1007} + expectSuccess(t, r, err, e, "") + +@@ -191,9 +191,9 @@ func TestMockEtcd(t *testing.T) { + if child.Dir != true { + t.Fatalf("Unexpected non-directory child %s", child.Key) + } +- if child.Key == "/coreos.com/network/foobar" { ++ if child.Key == "/atomic.io/network/foobar" { + node1Found = true +- } else if child.Key == "/coreos.com/network/blah" { ++ } else if child.Key == "/atomic.io/network/blah" { + node2Found = true + } else { + t.Fatalf("Unexpected child %s found", child.Key) +@@ -208,14 +208,14 @@ func TestMockEtcd(t *testing.T) { + + // Delete a key + dopts := &etcd.DeleteOptions{Recursive: true, Dir: false} +- r, err = m.Delete(ctx, "/coreos.com/network/foobar", dopts) ++ r, err = m.Delete(ctx, "/atomic.io/network/foobar", dopts) + if err == nil { + t.Fatalf("Unexpected success deleting a directory") + } + + // Delete a key + dopts = &etcd.DeleteOptions{Recursive: true, Dir: true} +- r, err = m.Delete(ctx, "/coreos.com/network/foobar", dopts) ++ r, err = m.Delete(ctx, "/atomic.io/network/foobar", dopts) + e = &etcd.Response{Action: "delete", Index: 1010} + expectSuccess(t, r, err, e, "") + +diff --git a/subnet/registry.go b/subnet/registry.go +index dd8083b..42cbfb0 100644 +--- a/subnet/registry.go ++++ b/subnet/registry.go +@@ -384,7 +384,7 @@ func (esr *etcdSubnetRegistry) parseNetworkWatchResponse(resp *etcd.Response) (E + return evt, index, nil + } + +-// Returns network name from config key (eg, /coreos.com/network/foobar/config), ++// Returns network name from config key (eg, /atomic.io/network/foobar/config), + // if the 'config' key isn't present we don't consider the network valid + func (esr *etcdSubnetRegistry) parseNetworkKey(s string) (string, bool) { + if parts := esr.networkRegex.FindStringSubmatch(s); len(parts) == 3 { +diff --git a/subnet/registry_test.go b/subnet/registry_test.go +index 8d7524f..4c64423 100644 +--- a/subnet/registry_test.go ++++ b/subnet/registry_test.go +@@ -29,7 +29,7 @@ import ( + func newTestEtcdRegistry(t *testing.T) (Registry, *mockEtcd) { + cfg := &EtcdConfig{ + Endpoints: []string{"http://127.0.0.1:4001", "http://127.0.0.1:2379"}, +- Prefix: "/coreos.com/network", ++ Prefix: "/atomic.io/network", + } + + r, err := newEtcdSubnetRegistry(cfg, func(c *EtcdConfig) (etcd.KeysAPI, error) { +@@ -105,7 +105,7 @@ func TestEtcdRegistry(t *testing.T) { + } + + // Populate etcd with a network +- netKey := "/coreos.com/network/foobar/config" ++ netKey := "/atomic.io/network/foobar/config" + netValue := "{ \"Network\": \"10.1.0.0/16\", \"Backend\": { \"Type\": \"host-gw\" } }" + m.Create(ctx, netKey, netValue) + +@@ -155,7 +155,7 @@ func TestEtcdRegistry(t *testing.T) { + } + + // Make sure the lease got created +- resp, err := m.Get(ctx, "/coreos.com/network/foobar/subnets/10.1.5.0-24", nil) ++ resp, err := m.Get(ctx, "/atomic.io/network/foobar/subnets/10.1.5.0-24", nil) + if err != nil { + t.Fatal("Failed to verify subnet lease directly in etcd: %v", err) + } +@@ -185,7 +185,7 @@ func TestEtcdRegistry(t *testing.T) { + } + + // Make sure the lease got deleted +- resp, err = m.Get(ctx, "/coreos.com/network/foobar/subnets/10.1.5.0-24", nil) ++ resp, err = m.Get(ctx, "/atomic.io/network/foobar/subnets/10.1.5.0-24", nil) + if err == nil { + t.Fatal("Unexpected success getting deleted subnet") + } +-- +2.7.4 + diff --git a/SOURCES/flannel-docker.conf b/SOURCES/flannel-docker.conf new file mode 100644 index 0000000..8f55177 --- /dev/null +++ b/SOURCES/flannel-docker.conf @@ -0,0 +1,2 @@ +[Service] +EnvironmentFile=-/run/flannel/docker 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/flanneld-start b/SOURCES/flanneld-start new file mode 100644 index 0000000..e119b6b --- /dev/null +++ b/SOURCES/flanneld-start @@ -0,0 +1,7 @@ +#!/bin/sh + +exec /usr/bin/flanneld \ + -etcd-endpoints=${FLANNEL_ETCD_ENDPOINTS:-${FLANNEL_ETCD}} \ + -etcd-prefix=${FLANNEL_ETCD_PREFIX:-${FLANNEL_ETCD_KEY}} \ + "$@" + diff --git a/SOURCES/flanneld.service b/SOURCES/flanneld.service new file mode 100644 index 0000000..968e4ea --- /dev/null +++ b/SOURCES/flanneld.service @@ -0,0 +1,19 @@ +[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] +Type=notify +EnvironmentFile=/etc/sysconfig/flanneld +EnvironmentFile=-/etc/sysconfig/docker-network +ExecStart=/usr/bin/flanneld-start $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 new file mode 100644 index 0000000..a0f6848 --- /dev/null +++ b/SOURCES/flanneld.sysconf @@ -0,0 +1,12 @@ +# Flanneld configuration options + +# etcd url location. Point this to the server where etcd runs +FLANNEL_ETCD_ENDPOINTS="http://127.0.0.1:2379" + +# etcd config key. This is the configuration key that flannel queries +# For address range assignment +FLANNEL_ETCD_PREFIX="/atomic.io/network" + +# Any additional options that you want to pass +#FLANNEL_OPTIONS="" + diff --git a/SPECS/flannel.spec b/SPECS/flannel.spec new file mode 100644 index 0000000..a0a9fa6 --- /dev/null +++ b/SPECS/flannel.spec @@ -0,0 +1,366 @@ +%global with_devel 0 +%global with_bundled 1 +%global with_debug 1 +%global with_check 0 + +%if 0%{?with_debug} +# https://bugzilla.redhat.com/show_bug.cgi?id=995136#c12 +%global _dwz_low_mem_die_limit 0 +%else +%global debug_package %{nil} +%endif +%global provider github +%global provider_tld com +%global project coreos +%global repo flannel +%global import_path %{provider}.%{provider_tld}/%{project}/%{repo} +%global commit 683c6e9eb06d0f49c43eef9ecbb777a3adaeda88 +%global shortcommit %(c=%{commit}; echo ${c:0:7}) + +%global devel_main flannel-devel + +Name: flannel +Version: 0.7.1 +Release: 3%{?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.sysconf +Source2: flanneld.service +Source3: flannel-docker.conf +Source4: flannel-tmpfiles.conf +Source5: flanneld-start + +Patch0: change-4001-to-2379-in-help-and-README.patch +Patch1: change-coreos.com-network-to-atomic.io-network-in-he.patch + +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 +Requires(preun): systemd +Requires(postun): systemd + +%description +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}-%{commit} +%patch0 -p1 +%patch1 -p1 + +%if ! 0%{?with_bundled} +find . -name "*.go" \ + -print |\ + xargs sed -i 's/github.com\/coreos\/flannel\/Godeps\/_workspace\/src\///g' +%endif + +%build +mkdir -p src/github.com/coreos +ln -s ../../../ src/github.com/coreos/flannel + +%if ! 0%{?with_bundled} +export GOPATH=$(pwd):%{gopath} +%else +export GOPATH=$(pwd):%{buildroot}/%{gopath}:$(pwd)/Godeps/_workspace +%endif + +%if ! 0%{?gobuild:1} +%define gobuild(o:) go build -buildmode pie -tags=rpm_crashtraceback -ldflags "${LDFLAGS:-} -B 0x$(head -c20 /dev/urandom|od -An -tx1|tr -d ' \\n') -extldflags '-Wl,-z,relro,-z,now'" -a -v -x %{?**}; +%endif + +export LDFLAGS="-X github.com/coreos/flannel/version.Version=%{version}" + +%gobuild -o bin/flanneld %{import_path} + +%install +# package with binary +install -D -p -m 755 bin/flanneld %{buildroot}%{_bindir}/flanneld +install -D -p -m 755 %{SOURCE5} %{buildroot}%{_bindir}/flanneld-start +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 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 + +%preun +# clean tempdir and workdir on removal or upgrade +%systemd_preun flanneld.service + +%postun +%systemd_postun_with_restart flanneld.service + +%files +%doc CONTRIBUTING.md LICENSE MAINTAINERS README.md DCO NOTICE +%{_bindir}/flanneld +%{_bindir}/flanneld-start +%{_unitdir}/flanneld.service +%{_unitdir}/docker.service.d/flannel.conf +%{_libexecdir}/flannel/mk-docker-opts.sh +%dir %{_libexecdir}/flannel +%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 +* Tue Feb 06 2018 Jan Chaloupka - 0.7.1-3 +- Rebuild for 7.5.0 + resolves: #1542530 + +* Tue Jun 06 2017 Jan Chaloupka - 0.7.1-2 +- Bump and build for secondary architectures + +* Wed May 31 2017 Jan Chaloupka - 0.7.1-1 +- Update to flannel v0.7.1 + resolves: #1457094 + +* Mon Feb 06 2017 Jan Chaloupka - 0.7.0-1 +- Update to flannel v0.7.0 + resolves: #1419750 + +* Tue Dec 13 2016 Jan Chaloupka - 0.5.5-2 +- Use non-canonicalized etcd endpoints and prefix if canonicalized are not set + resolves: #1341223 + +* Wed Sep 07 2016 jchaloup - 0.5.5-1 +- Update to flannel v5.5.0 + resolves: #1373915 + +* Wed Jun 29 2016 jchaloup - 0.5.3-10 +- Own /usr/libexec/flannel directory +- make envs in service and config file canonical + resolves: #1341223 + +* Thu Jan 14 2016 jchaloup - 0.5.3-9 +- Build with debug-info support + resolves: #1298728 + +* 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 +- Polish spec file + +* 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.5.1-1 +- Update to 0.5.1 + +* Fri Jul 10 2015 jchaloup - 0.5.0-3 +- Add After=etcd.service to flanneld.service + +* 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 + +* Mon Mar 30 2015 jchaloup - 0.2.0-7 +- Add debug info + related: #1165688 + +* 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 + (https://github.com/coreos/flannel/pull/85) + +* Tue Jan 20 2015 Eric Paris - 0.2.0-4 +- Add generator to turn flannel env vars into docker flags + +* Tue Jan 20 2015 Peter Lemenkov - 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 - 0.2.0-2 +- Change flannel service type to notify. See + https://github.com/coreos/flannel/blob/v0.2.0/main.go#L213 + +* Tue Dec 23 2014 Lokesh Mandvekar - 0.2.0-1 +- update to upstream v0.2.0 +- append FLANNEL_OPTIONS variable to unitfile command +- systemd-units merged into systemd for fedora18+ + +* Tue Dec 2 2014 John W. Linville - 0.1.0-8.gita7b435a +- Remove patches related to out-of-tree slice backend +- Update to latest upstream + +* Thu Nov 20 2014 jchaloup - 0.1.0-7.git071d778 +- Removing deps on Godeps and adding deps on golang-github packages +- Removing wait-online service and changing Type of flannel.service from simple to notify +- Adding README and other doc files +- Adding spec file header with commit, import_path, ... +- Adding devel subpackage +- spec polished based on Lokesh' notes (3 lines below) +- modify summary in specfile as in bug description (capitalize if needed) +- might need to enforce NVR for coreos/go-systemd in deps +- pkgconfig(systemd) is preferable to systemd in BR (I think) + resolves: #1165688 + +* Fri Nov 07 2014 - Neil Horman +- Updating to latest upstream + +* Fri Nov 07 2014 - Neil Horman +- Added wait-online service to sync with docker + +* Thu Nov 06 2014 - Neil Horman +- Fixed flanneld.service file +- Added linvilles slice type patch + +* Tue Nov 04 2014 - Neil Horman - 0.1.0-20141104gitdc530ce +- Initial Build +