flannel: use rkt to launch flannel on amd64

This commit is contained in:
Andrew Jeddeloh 2016-06-16 14:03:27 -07:00
parent 3b63446bbb
commit c8f0523455
4 changed files with 74 additions and 5 deletions

View File

@ -0,0 +1,38 @@
[Unit]
Description=Network fabric for containers
Documentation=https://github.com/coreos/flannel
After=etcd.service etcd2.service
[Service]
Type=notify
Restart=always
RestartSec=5
Environment="TMPDIR=/var/tmp/"
Environment="FLANNEL_VER={{flannel_ver}}"
Environment="FLANNEL_IMG=quay.io/coreos/flannel"
Environment="ETCD_SSL_DIR=/etc/ssl/etcd"
EnvironmentFile=-/run/flannel/options.env
LimitNOFILE=40000
LimitNPROC=1048576
ExecStartPre=/sbin/modprobe ip_tables
ExecStartPre=/usr/bin/mkdir -p /run/flannel
ExecStartPre=/usr/bin/mkdir -p ${ETCD_SSL_DIR}
ExecStart=/usr/bin/rkt run --net=host \
--stage1-path=/usr/lib/rkt/stage1-images/stage1-fly.aci \
--insecure-options=image \
--set-env=NOTIFY_SOCKET=/run/systemd/notify \
--inherit-env=true \
--volume runsystemd,kind=host,source=/run/systemd,readOnly=false \
--volume runflannel,kind=host,source=/run/flannel,readOnly=false \
--volume ssl,kind=host,source=${ETCD_SSL_DIR},readOnly=true \
--mount volume=runsystemd,target=/run/systemd \
--mount volume=runflannel,target=/run/flannel \
--mount volume=ssl,target=${ETCD_SSL_DIR} \
${FLANNEL_IMG}:${FLANNEL_VER} \
-- --ip-masq=true
ExecStopPost=/usr/bin/rkt gc --mark-only
[Install]
WantedBy=multi-user.target

View File

@ -0,0 +1,31 @@
# Copyright (c) 2014 CoreOS, Inc.. All rights reserved.
# Distributed under the terms of the GNU General Public License v2
EAPI=4
if [[ "${PV}" == 9999 ]]; then
KEYWORDS="~amd64 ~arm64"
else
KEYWORDS="amd64 arm64"
fi
inherit systemd
DESCRIPTION="flannel"
HOMEPAGE="https://github.com/coreos/flannel"
SRC_URI=""
LICENSE="Apache-2.0"
SLOT="0"
IUSE=""
RDEPEND="app-admin/sdnotify-proxy"
S="$WORKDIR"
src_install() {
sed "s/{{flannel_ver}}/${PV}/" "${FILESDIR}"/flanneld.service >"${T}"/flanneld.service
systemd_dounit "${T}"/flanneld.service
insinto /usr/lib/systemd/network
doins "${FILESDIR}"/50-flannel.network
}

View File

@ -0,0 +1 @@
flannel-9999.ebuild

View File

@ -4,9 +4,9 @@
EAPI=4 EAPI=4
if [[ "${PV}" == 9999 ]]; then if [[ "${PV}" == 9999 ]]; then
KEYWORDS="~amd64 ~arm64" KEYWORDS="~amd64"
else else
KEYWORDS="amd64 arm64" KEYWORDS="amd64"
fi fi
inherit systemd inherit systemd
@ -19,11 +19,11 @@ LICENSE="Apache-2.0"
SLOT="0" SLOT="0"
IUSE="" IUSE=""
RDEPEND="app-admin/sdnotify-proxy" RDEPEND="app-emulation/rkt"
S="$WORKDIR" S="$WORKDIR"
src_install() { src_install() {
sed "s/{{flannel_ver}}/${PV}/" "${FILESDIR}"/flanneld.service >"${T}"/flanneld.service sed "s/{{flannel_ver}}/${PV}/" "${FILESDIR}"/flanneld-rkt.service >"${T}"/flanneld.service
systemd_dounit "${T}"/flanneld.service systemd_dounit "${T}"/flanneld.service
insinto /usr/lib/systemd/network insinto /usr/lib/systemd/network