Skip to main content

How to make packit-service-tests-openshift OpenShift-less?

The way we run the packit-service-tests-openshift via oc cluster up was added a long time ago (a3f5336, 11ca8d5) and has been pretty much used the same way since then. The solution has some limitations, like:

Do we really need a full-blown OpenShift to run these tests? Wouldn't a few containers do the trick as well? I think the tests need to run just the worker, service, postgres and probably redis. Then there are a few extra volumes, pods and jobs. IMHO nothing which couldn't be done directly on the node with podman.

There are a few ways how to orchestrate them:

With podman kube play you give podman your existing k8s/openshift workloads in YAML and podman "deploys" them to your local machine (instead of to a cluster).

$ git clone
$ cd deployment/openshift
$ podman kube play redis.yml

$ podman ps
2f65ece7e362 run-redis 28 seconds ago Up 28 seconds>6379/tcp redis-pod-redis

$ podman kube down redis.yml
Pods stopped:
Pods removed:

There's also an ansible module for it.

You can also run it as a systemd service

$ cd deployment/openshift
$ escaped=$(systemd-escape `pwd`/redis.yml)
$ systemctl --user start podman-kube@$escaped.service
$ systemctl --user status podman-kube@$escaped.service
● podman-kube@-home-jpopelka-git-packit-deployment-openshift-redis.yml.service - A template for running K8s workloads via podman-kube-play
Loaded: loaded (/usr/lib/systemd/user/podman-kube@.service; disabled; preset: disabled)
Active: active (running) since Tue 2023-02-14 17:55:23 CET; 7s ago
Docs: man:podman-kube-play(1)
Main PID: 78308 (podman)
Tasks: 31 (limit: 38173)
Memory: 29.9M
CPU: 380ms
CGroup: /user.slice/user-1000.slice/user@1000.service/app.slice/app-podman\x2dkube.slice/podman-kube@-home-jpopelka-git-packit-deployment-openshift-redis.yml.service
├─78308 /usr/bin/podman kube play --replace --service-container=true /home/jpopelka/git/packit/deployment/openshift/redis.yml

$ podman ps
340d065ba1eb run-redis 2 minutes ago Up 2 minutes>6379/tcp redis-pod-redis

$ systemctl --user stop podman-kube@$escaped.service