Skip to content
This repository was archived by the owner on Jan 30, 2020. It is now read-only.

Commit aad7239

Browse files
author
Dongsu Park
authored
Merge pull request #1722 from endocode/dongsu/rkt-wrapper
scripts: add fleet-wrapper
2 parents eaf2f7f + 329c306 commit aad7239

File tree

1 file changed

+39
-0
lines changed

1 file changed

+39
-0
lines changed

scripts/fleet-wrapper

+39
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
#!/bin/bash
2+
# Wrapper for launching fleet via rkt-fly.
3+
#
4+
# Users could set FLEET_IMAGE_TAG to an image tag published here:
5+
# https://quay.io/repository/coreos/fleet?tab=tags Alternatively,
6+
# override FLEET_IMAGE to a custom image.
7+
8+
RKT_GLOBAL_ARGS="--insecure-options=image"
9+
10+
FLEET_IMAGE_URL="${FLEET_IMAGE_URL:-quay.io/coreos/fleet}"
11+
FLEET_IMAGE_TAG="${FLEET_IMAGE_TAG:-v1.0.0}"
12+
FLEET_IMAGE="${FLEET_IMAGE:-${FLEET_IMAGE_URL}:${FLEET_IMAGE_TAG}}"
13+
FLEET_USER="${FLEET_USER:-fleet}"
14+
15+
if [[ "${FLEET_IMAGE%%/*}" == "quay.io" ]]; then
16+
RKT_RUN_ARGS="${RKT_RUN_ARGS} --trust-keys-from-https"
17+
fi
18+
19+
mkdir --parents /etc/fleet
20+
mkdir --parents /run/dbus
21+
mkdir --parents /run/fleet
22+
23+
RKT="${RKT:-/usr/bin/rkt}"
24+
RKT_STAGE1_ARG="${RKT_STAGE1_ARG:---stage1-path=/usr/lib/rkt/stage1-images/stage1-fly.aci}"
25+
set -x
26+
exec ${RKT} ${RKT_GLOBAL_ARGS} \
27+
${RKT_STAGE1_ARG} \
28+
run ${RKT_RUN_ARGS} \
29+
--volume etc-fleet,kind=host,source=/etc/fleet,readOnly=true \
30+
--volume machine-id,kind=host,source=/etc/machine-id,readOnly=true \
31+
--volume run,kind=host,source=/run,readOnly=false \
32+
--mount volume=etc-fleet,target=/etc/fleet \
33+
--mount volume=machine-id,target=/etc/machine-id \
34+
--mount volume=run,target=/run \
35+
--inherit-env \
36+
--set-env=DBUS_SYSTEM_BUS_ADDRESS=unix:path=/run/dbus/system_bus_socket \
37+
${FLEET_IMAGE} \
38+
--user=$(id -u "${FLEET_USER}") \
39+
-- "$@"

0 commit comments

Comments
 (0)