Skip to content

Commit

Permalink
Merge pull request #340 from AkihiroSuda/dev
Browse files Browse the repository at this point in the history
CI: add EL9 + Podman, Fedora + Podman
  • Loading branch information
AkihiroSuda authored Dec 2, 2024
2 parents 1c1f475 + be9c4d3 commit 5deee9c
Show file tree
Hide file tree
Showing 5 changed files with 45 additions and 8 deletions.
9 changes: 3 additions & 6 deletions .github/workflows/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -68,13 +68,10 @@ jobs:
include:
- lima-template: template://ubuntu-24.04
engine: docker
- lima-template: template://ubuntu-24.04
- lima-template: template://centos-stream-9
engine: podman
- lima-template: template://fedora
engine: podman
# FIXME: Flannel seems to fail with Fedora + Podman:
# https://github.com/rootless-containers/usernetes/pull/339#issuecomment-2511139718
# > plugin type=\\\"flannel\\\" failed (add): loadFlannelSubnetEnv failed:
# > open /run/flannel/subnet.env: no such file or directory\""
# > pod="kube-system/coredns-6f6b679f8f-p9spl"
env:
LIMA_TEMPLATE: "${{ matrix.lima-template }}"
CONTAINER_ENGINE: "${{ matrix.engine }}"
Expand Down
19 changes: 19 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,25 @@ EOF
sudo sysctl --system
```

- slirp4netns, not Pasta:
```
# Podman v5 (or later) users have to change the network mode from pasta to slirp4netns.
# This step is not needed for Docker, nerdctl, and Podman v4.
mkdir -p "$HOME/.config/containers/containers.conf.d"
cat <<EOF >"$HOME/.config/containers/containers.conf.d/slirp4netns.conf"
[network]
default_rootless_network_cmd="slirp4netns"
EOF
```
<!--
pasta does not seem to work well
> 2024-12-02T17:15:40.070018488Z stderr F E1202 17:15:40.068621 1 main.go:228] Failed to create SubnetManager:
> error retrieving pod spec for 'kube-flannel/kube-flannel-ds-ms2d9': Get "https://10.96.0.1:443/api/v1/namespaces/kube-flannel/pods/kube-flannel-ds-ms2d9":
> dial tcp 10.96.0.1:443: i/o timeout
-->

Use scripts in [`./init-host`](./init-host) for automating these steps.

## Usage
Expand Down
10 changes: 8 additions & 2 deletions init-host/init-host.root.d/install-podman.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,15 @@ if [ "$(id -u)" != "0" ]; then
exit 1
fi

# Needs slirp4netns, not pasta:
#
# > 2024-12-02T17:15:40.070018488Z stderr F E1202 17:15:40.068621 1 main.go:228] Failed to create SubnetManager:
# > error retrieving pod spec for 'kube-flannel/kube-flannel-ds-ms2d9': Get "https://10.96.0.1:443/api/v1/namespaces/kube-flannel/pods/kube-flannel-ds-ms2d9":
# > dial tcp 10.96.0.1:443: i/o timeout

if command -v dnf >/dev/null 2>&1; then
dnf install -y podman podman-compose
dnf install -y podman podman-compose slirp4netns
else
apt-get update -qq
apt-get -qq -y install podman podman-compose
apt-get -qq -y install podman podman-compose slirp4netns
fi
5 changes: 5 additions & 0 deletions init-host/init-host.root.sh
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,11 @@ sysctl --system

if command -v dnf >/dev/null 2>&1; then
dnf install -y git shadow-utils make jq
# podman-compose requires EPEL
if grep -q centos /etc/os-release; then
# Works with Rocky and Alma too
dnf -y install epel-release
fi
else
apt-get update
apt-get install -y git uidmap make jq
Expand Down
10 changes: 10 additions & 0 deletions init-host/init-host.rootless.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,21 @@ if [ "$(id -u)" == "0" ]; then
fi

: "${CONTAINER_ENGINE:=docker}"
: "${XDG_CONFIG_HOME:=${HOME}/.config}"
case "${CONTAINER_ENGINE}" in
"docker")
dockerd-rootless-setuptool.sh install || (journalctl --user --since "10 min ago"; exit 1)
;;
"podman")
# pasta does not seem to work well
# > 2024-12-02T17:15:40.070018488Z stderr F E1202 17:15:40.068621 1 main.go:228] Failed to create SubnetManager:
# > error retrieving pod spec for 'kube-flannel/kube-flannel-ds-ms2d9': Get "https://10.96.0.1:443/api/v1/namespaces/kube-flannel/pods/kube-flannel-ds-ms2d9":
# > dial tcp 10.96.0.1:443: i/o timeout
mkdir -p "${XDG_CONFIG_HOME}/containers/containers.conf.d"
cat <<EOF >"${XDG_CONFIG_HOME}/containers/containers.conf.d/slirp4netns.conf"
[network]
default_rootless_network_cmd="slirp4netns"
EOF
systemctl --user enable --now podman-restart
;;
*)
Expand Down

0 comments on commit 5deee9c

Please sign in to comment.