neoave / mrack

Multicloud use-case based multihost async provisioner for CIs and testing during development
Apache License 2.0
11 stars 14 forks source link

feat: Advanced podman support and several minor updates and bugfixes #96

Closed Tiboris closed 3 years ago

Tiboris commented 3 years ago

feat: Add capability to use custom podman options

mrack now support advanced podman provisioning to enable custom way of running pods with podman we should add podman section to provisioning config something like:

podman:
    images:
        # systemd enabled container images from: https://github.com/Tiboris/snappeas
        fedora-32: tdudlak/snappeas:fedora-32
        fedora-33: tdudlak/snappeas:fedora-33
        fedora-rawhide: tdudlak/snappeas:fedora-rawhide

    pubkey: config/id_rsa.pub

    default_network: mrack-network

    podman_options:
        # Mount a temporary filesystems (tmpfs) into a container
        "--tmpfs":
            - "/tmp"
        # Use /sys/fs/cgroup in container as read only volume
        "-v":
            - "/sys/fs/cgroup:/sys/fs/cgroup:ro"
        # Adding ipv6 support to network
        "--network": "enable_ipv6=true"

feat: Use ssh public key to access container instead of podman id

Use ssh to connect to container provisioned by mrack instead of ansible connection to prevent some issues with connection and built in ansible modules so the container acts like a vm.

feat: Use more flexible way of defining podman names

NETWORK: Podman now use network name created by composing default network from provisioning config and domain name. PODS: name of the pod derives from the hostname and network the pod is assigned to.

netoarmando commented 3 years ago

@Tiboris Testing I found that mrack ssh is not working, this is needed:

diff --git a/src/mrack/actions/ssh.py b/src/mrack/actions/ssh.py
index f6b6660..4bee9d4 100644
--- a/src/mrack/actions/ssh.py
+++ b/src/mrack/actions/ssh.py
@@ -127,7 +127,7 @@ class SSH:
         """Simulate SSH by attaching an interactive session to a container."""
         if host.provider.name == "podman":
             podman = Podman()
-            podman.interactive(host.id)
+            podman.interactive(host.host_id)
         else:
             raise NotImplementedError("Docker is not yet supported.")

After it as non-root I could ssh into the container. However, to use 'plain' ssh I had to call mrack as root (and comment a few lines), as already discussed.

Also based on current container image (fedora-rawhide), its user is different (root) from the one in provisioning-config (fedora) for that image name. I guess we need to suffix names with -container or something else.

Rest looks good to me.

Tiboris commented 3 years ago

@Tiboris Testing I found that mrack ssh is not working, this is needed: ...

Nice catch @netoarmando !