coreos-base/oem-gce: use systemd-nspawn to run the GCE daemon

The GCE daemon container was run with rkt from an ACI tar ball.
To replace rkt with systemd-nspawn, extract the tar ball to an
image and run the daemon as systemd-nspawn container.
This commit is contained in:
Kai Lüke 2021-04-19 17:04:00 +02:00
parent 2ef596ded0
commit bc5e02d65e

View File

@ -4,6 +4,7 @@ After=local-fs.target network-online.target
[Service] [Service]
Type=notify Type=notify
NotifyAccess=all
Restart=always Restart=always
RestartSec=5 RestartSec=5
@ -11,19 +12,18 @@ RestartSec=5
KillMode=process KillMode=process
KillSignal=SIGTERM KillSignal=SIGTERM
ExecStart=/usr/bin/rkt run \ ExecStartPre=/usr/bin/rm -f /var/lib/flatcar-oem-gce.img
--inherit-env=true \ ExecStartPre=/usr/bin/truncate -s 1G /var/lib/flatcar-oem-gce.img
--insecure-options=image \ ExecStartPre=/usr/sbin/mkfs.ext4 /var/lib/flatcar-oem-gce.img
--net=host \ ExecStartPre=/usr/bin/rm -rf /var/lib/flatcar-oem-gce
--stage1-path=/usr/lib/rkt/stage1-images/stage1-fly.aci \ ExecStartPre=/usr/bin/mkdir -p /var/lib/flatcar-oem-gce
--volume=etc,kind=host,source=/etc,readOnly=false \ ExecStartPre=-/usr/bin/umount /var/lib/flatcar-oem-gce.img
--volume=home,kind=host,source=/home,readOnly=false \ ExecStartPre=/usr/bin/mount /var/lib/flatcar-oem-gce.img /var/lib/flatcar-oem-gce
--volume=runsystemd,kind=host,source=/run/systemd,readOnly=false \ ExecStartPre=/usr/bin/tar --directory=/var/lib/flatcar-oem-gce --extract --file=/usr/share/oem/flatcar-oem-gce.aci --strip-components=1 rootfs
--volume=nsswitch,kind=host,source=/usr/share/google-oslogin/nsswitch.conf,readOnly=true \ ExecStartPre=/usr/bin/umount /var/lib/flatcar-oem-gce.img
--mount=volume=nsswitch,target=/usr/share/google-oslogin/nsswitch.conf \ ExecStart=/usr/bin/systemd-nspawn --keep-unit --register=no --link-journal=no \
/usr/share/oem/flatcar-oem-gce.aci --machine=oem-gce --bind=/dev/log --bind=/run/systemd --tmpfs=/run/lock --bind=/etc --bind=/home --bind-ro=/usr/share/google-oslogin/nsswitch.conf \
--read-only --volatile=overlay --image=/var/lib/flatcar-oem-gce.img /init.sh
ExecStopPost=/usr/bin/rkt gc --mark-only
[Install] [Install]
WantedBy=multi-user.target WantedBy=multi-user.target