summaryrefslogtreecommitdiff
path: root/contrib
diff options
context:
space:
mode:
authorValentin Rothberg <vrothberg@redhat.com>2022-05-11 15:02:06 +0200
committerValentin Rothberg <vrothberg@redhat.com>2022-05-17 10:18:58 +0200
commit8684d41e387ae40cc64cd513bbc3f7ac319360f4 (patch)
tree11bcd5086463c93ec5f14de10d47fff85ffa26eb /contrib
parenteb26fa45f1326191dea27f2afabf82cb8b934140 (diff)
downloadpodman-8684d41e387ae40cc64cd513bbc3f7ac319360f4.tar.gz
podman-8684d41e387ae40cc64cd513bbc3f7ac319360f4.tar.bz2
podman-8684d41e387ae40cc64cd513bbc3f7ac319360f4.zip
k8systemd: run k8s workloads in systemd
Support running `podman play kube` in systemd by exploiting the previously added "service containers". During `play kube`, a service container is started before all the pods and containers, and is stopped last. The service container communicates its conmon PID via sdnotify. Add a new systemd template to dispatch such k8s workloads. The argument of the template is the path to the k8s file. Note that the path must be escaped for systemd not to bark: Let's assume we have a `top.yaml` file in the home directory: ``` $ escaped=$(systemd-escape ~/top.yaml) $ systemctl --user start podman-play-kube@$escaped.service ``` Closes: https://issues.redhat.com/browse/RUN-1287 Signed-off-by: Valentin Rothberg <vrothberg@redhat.com>
Diffstat (limited to 'contrib')
-rw-r--r--contrib/systemd/system/podman-play-kube@.service.in18
1 files changed, 18 insertions, 0 deletions
diff --git a/contrib/systemd/system/podman-play-kube@.service.in b/contrib/systemd/system/podman-play-kube@.service.in
new file mode 100644
index 000000000..824f71eb0
--- /dev/null
+++ b/contrib/systemd/system/podman-play-kube@.service.in
@@ -0,0 +1,18 @@
+[Unit]
+Description=A template for running K8s workloads via podman-play-kube
+Documentation=man:podman-play-kube(1)
+Wants=network-online.target
+After=network-online.target
+RequiresMountsFor=%t/containers
+
+[Service]
+Environment=PODMAN_SYSTEMD_UNIT=%n
+Restart=never
+TimeoutStopSec=70
+ExecStart=@@PODMAN@@ play kube --replace --service-container=true %I
+ExecStop=@@PODMAN@@ play kube --down %I
+Type=notify
+NotifyAccess=all
+
+[Install]
+WantedBy=default.target