flannel/flannel.spec

112 lines
3.2 KiB
RPMSpec
Raw Normal View History

#
# spec file for package flannel
#
# Copyright (c) 2017 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
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via http://bugs.opensuse.org/
#
Name: flannel
Version: 0.7.1
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
BuildRequires: golang-packaging
BuildRequires: systemd
BuildRequires: xz
Requires(post): %fillup_prereq
BuildRoot: %{_tmppath}/%{name}-%{version}-build
%{go_nostrip}
%{go_provides}
%{?systemd_requires}
%description
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
%build
gofmt -w -r "x -> \"%{version}\"" version/version.go
%{goprep} github.com/coreos/flannel
%{gobuild}
%install
%{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}%{_localstatedir}/adm/fillup-templates/sysconfig.flanneld
install -D -p -m 0644 %{SOURCE4} %{buildroot}%{_tmpfilesdir}/%{name}.conf
# Additional
install -D -p -m 0755 dist/mk-docker-opts.sh %{buildroot}%{_libexecdir}/flannel/mk-docker-opts.sh
# Move
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 LICENSE DCO NOTICE
%{_sbindir}/flanneld
# Service
%dir %{_unitdir}/docker.service.d
%{_unitdir}/docker.service.d/flannel.conf
%{_unitdir}/flanneld.service
%{_sbindir}/rcflanneld
# Sysconfig
%{_localstatedir}/adm/fillup-templates/sysconfig.flanneld
%{_tmpfilesdir}/%{name}.conf
%attr(0750,root,root) %dir %ghost %{_rundir}/%{name}
# Additional
%dir %{_libexecdir}/flannel
%{_libexecdir}/flannel/mk-docker-opts.sh
%changelog