Accepting request 692810 from home:kukuk:container

OBS-URL: https://build.opensuse.org/request/show/692810
OBS-URL: https://build.opensuse.org/package/show/devel:kubic/flannel?expand=0&rev=1
This commit is contained in:
Richard Brown 2019-04-10 09:08:35 +00:00 committed by Git OBS Bridge
parent 78f6ef7d35
commit 9c2ff41790
11 changed files with 57 additions and 139 deletions

View File

@ -1,7 +0,0 @@
<constraints>
<hardware>
<disk>
<size unit="G">6</size>
</disk>
</hardware>
</constraints>

View File

@ -1,16 +0,0 @@
<services>
<service name="tar_scm" mode="disabled">
<param name="scm">git</param>
<param name="url">git@github.com:coreos/flannel.git</param>
<param name="exclude">.git</param>
<param name="filename">flannel</param>
<param name="versionformat">0.9.1</param>
<param name="revision">v0.9.1</param>
<param name="changesgenerate">enable</param>
</service>
<service name="recompress" mode="disabled">
<param name="file">*.tar</param>
<param name="compression">xz</param>
</service>
<service mode="disabled" name="set_version"/>
</services>

3
flannel-0.11.0.tar.gz Normal file
View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:476c886ddc06a8afcf54e181ac55579224c6be424089567a0b8d9e93dd08a053
size 6443391

View File

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:1b4beb5f5b477ae8b7efc6d7c63db075afef0ae04a03a427160191aaf75244ab
size 5114448

View File

@ -1,2 +0,0 @@
[Service]
EnvironmentFile=-/run/flannel/docker

View File

@ -1 +0,0 @@
d /run/flannel 0755 root root -

View File

@ -1,3 +1,21 @@
-------------------------------------------------------------------
Tue Apr 9 11:45:05 CEST 2019 - kukuk@suse.de
- Require minimal set of used network utilities
-------------------------------------------------------------------
Mon Apr 8 13:56:16 CEST 2019 - kukuk@suse.de
- Add flannel-k8s-yaml sub-package with the yaml file to deploy
flannel.
-------------------------------------------------------------------
Mon Apr 8 13:24:07 CEST 2019 - kukuk@suse.de
- Update to flannel 0.11.0
- Drop standalone support, it's only for containers
- Drop use-32-prefix-udp-backend.patch, included upstream
-------------------------------------------------------------------
Wed Dec 19 16:55:33 UTC 2018 - clee@suse.com

View File

@ -1,7 +1,7 @@
#
# spec file for package flannel
#
# Copyright (c) 2017 SUSE LINUX GmbH, Nuernberg, Germany.
# Copyright (c) 2017, 2019 SUSE LINUX GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@ -15,37 +15,31 @@
# Please submit bugfixes or comments via http://bugs.opensuse.org/
#
#Compat macro for new _fillupdir macro introduced in Nov 2017
%if ! %{defined _fillupdir}
%define _fillupdir /var/adm/fillup-templates
%endif
Name: flannel
Version: 0.9.1
Version: 0.11.0
Release: 0
Summary: An etcd backed network fabric for containers
License: Apache-2.0
Group: System/Management
Url: https://github.com/coreos/flannel
Source: %{name}-%{version}.tar.xz
Source1: flanneld.sysconf
Source2: flanneld.service
Source3: flannel-docker.conf
Source4: flannel-tmpfiles.conf
Patch1: use-32-prefix-udp-backend.patch
Source: %{name}-%{version}.tar.gz
Requires: iproute2
# arp is used:
Requires: net-tools-deprecated
Requires: iptables
BuildRequires: golang-packaging
BuildRequires: systemd
BuildRequires: xz
BuildRequires: golang(API) >= 1.11
# go1.11.3 contains sec. fixes bsc#1118897(CVE-2018-16873) bsc#1118897(CVE-2018-16873) bsc#1118899(CVE-2018-16875)
BuildRequires: go1.11 >= 1.11.3
Requires(post): %fillup_prereq
BuildRoot: %{_tmppath}/%{name}-%{version}-build
ExcludeArch: s390
%{go_nostrip}
%{go_provides}
%{?systemd_requires}
%description
flannel is a virtual network that gives a subnet to each host for use with
@ -55,9 +49,26 @@ Platforms like Google's Kubernetes assume that each container (pod) has a
unique, routable IP inside the cluster. The advantage of this model is that it
reduces the complexity of doing port mapping.
This package contains the binary to be included into a container image
%package k8s-yaml
Summary: Kubernetes yaml file to run flannel container
Group: System/Management
BuildArch: noarch
%description k8s-yaml
This package contains the yaml file requried to download and run the
flannel container in a kubernetes cluster.
flannel is a virtual network that gives a subnet to each host for use with
container runtimes.
Platforms like Google's Kubernetes assume that each container (pod) has a
unique, routable IP inside the cluster. The advantage of this model is that it
reduces the complexity of doing port mapping.
%prep
%setup -q
%patch1 -p1
%build
gofmt -w -r "x -> \"%{version}\"" version/version.go
@ -68,56 +79,31 @@ gofmt -w -r "x -> \"%{version}\"" version/version.go
%{goinstall}
rm -rf %{buildroot}/%{_libdir}/go/contrib
# Service
install -D -p -m 0644 %{SOURCE3} %{buildroot}%{_unitdir}/docker.service.d/flannel.conf
install -D -p -m 0644 %{SOURCE2} %{buildroot}%{_unitdir}/flanneld.service
install -d %{buildroot}/%{_sbindir}
ln -sf %{_sbindir}/service %{buildroot}%{_sbindir}/rcflanneld
# Sysconfig
install -D -p -m 0644 %{SOURCE1} %{buildroot}%{_fillupdir}/sysconfig.flanneld
install -D -p -m 0644 %{SOURCE4} %{buildroot}%{_tmpfilesdir}/%{name}.conf
# Install provided yaml file to download and run the flannel container
mkdir -p %{buildroot}%{_datadir}/k8s-yaml/flannel
install -m 0644 Documentation/kube-flannel.yml %{buildroot}%{_datadir}/k8s-yaml/flannel/kube-flannel.yaml
sed -i -e 's|image: quay.io/coreos/flannel:.*|image: registry.opensuse.org/home/kukuk/container/container/kubic/flannel:%{version}|g' %{buildroot}%{_datadir}/k8s-yaml/flannel/kube-flannel.yaml
# Additional
install -D -p -m 0755 dist/mk-docker-opts.sh %{buildroot}%{_libexecdir}/flannel/mk-docker-opts.sh
# Move
mkdir -p %{buildroot}%{_sbindir}
mv %{buildroot}%{_bindir}/flannel %{buildroot}%{_sbindir}/flanneld
%pre
%service_add_pre flanneld.service
%post
%service_add_post flanneld.service
%{_bindir}/systemd-tmpfiles --create %{_tmpfilesdir}/%{name}.conf
%{fillup_only -n flanneld}
%preun
%service_del_preun flanneld.service
%postun
%service_del_postun flanneld.service
%files
%defattr(-,root,root)
%doc CONTRIBUTING.md README.md DCO NOTICE
%doc README.md DCO NOTICE
%license LICENSE
%{_sbindir}/flanneld
# Service
%dir %{_unitdir}/docker.service.d
%{_unitdir}/docker.service.d/flannel.conf
%{_unitdir}/flanneld.service
%{_sbindir}/rcflanneld
# Sysconfig
%{_fillupdir}/sysconfig.flanneld
%{_tmpfilesdir}/%{name}.conf
%attr(0750,root,root) %dir %ghost %{_rundir}/%{name}
# Additional
%dir %{_libexecdir}/flannel
%{_libexecdir}/flannel/mk-docker-opts.sh
%files k8s-yaml
%dir %{_datarootdir}/k8s-yaml
%dir %{_datarootdir}/k8s-yaml/flannel
%{_datarootdir}/k8s-yaml/flannel/kube-flannel.yaml
%changelog

View File

@ -1,19 +0,0 @@
[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/sbin/flanneld -etcd-endpoints=${FLANNEL_ETCD_ENDPOINTS} -etcd-prefix=${FLANNEL_ETCD_KEY} $FLANNEL_OPTIONS
ExecStartPost=/usr/lib/flannel/mk-docker-opts.sh -k DOCKER_NETWORK_OPTIONS -d /run/flannel/docker
Restart=on-failure
[Install]
WantedBy=multi-user.target
RequiredBy=docker.service

View File

@ -1,7 +0,0 @@
# Flanneld configuration options
# etcd url location. Point this to the server where etcd runs
FLANNEL_ETCD_ENDPOINTS="http://127.0.0.1:2379"
# Any additional options that you want to pass
#FLANNEL_OPTIONS=""

View File

@ -1,34 +0,0 @@
From ed425bdd6fefacb0f06b35fa8f4caedf042dc84d Mon Sep 17 00:00:00 2001
From: "Cel A. Skeggs" <cela@mit.edu>
Date: Thu, 1 Feb 2018 17:49:12 -0500
Subject: [PATCH] backend/udp: Use a /32 prefix for the flannel0 interface
This avoids the kernel's creation of broadcast routes, which prevent
communication from the host with the zeroth subnet to containers on any
other hosts.
---
backend/udp/udp_network.go | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/backend/udp/udp_network.go b/backend/udp/udp_network.go
index 1f9752f8..242ebf49 100644
--- a/backend/udp/udp_network.go
+++ b/backend/udp/udp_network.go
@@ -153,9 +153,15 @@ func configureIface(ifname string, ipn ip.IP4Net, mtu int) error {
return fmt.Errorf("failed to lookup interface %v", ifname)
}
- err = netlink.AddrAdd(iface, &netlink.Addr{IPNet: ipn.ToIPNet(), Label: ""})
+ // Ensure that the device has a /32 address so that no broadcast routes are created.
+ // This IP is just used as a source address for host to workload traffic (so
+ // the return path for the traffic has an address on the flannel network to use as the destination)
+ ipnLocal := ipn
+ ipnLocal.PrefixLen = 32
+
+ err = netlink.AddrAdd(iface, &netlink.Addr{IPNet: ipnLocal.ToIPNet(), Label: ""})
if err != nil {
- return fmt.Errorf("failed to add IP address %v to %v: %v", ipn.String(), ifname, err)
+ return fmt.Errorf("failed to add IP address %v to %v: %v", ipnLocal.String(), ifname, err)
}
err = netlink.LinkSetMTU(iface, mtu)