konveyor / move2kube

Move2Kube is a command-line tool for automating creation of Infrastructure as code (IaC) artifacts. It has inbuilt support for creating IaC artifacts for replatforming to Kubernetes/Openshift.
https://move2kube.konveyor.io/
Apache License 2.0
380 stars 118 forks source link

Implement Podman support for move2kube #599

Open ashokponkumar opened 2 years ago

ashokponkumar commented 2 years ago

Is your feature request related to a problem? Please describe. Currently running container based transformers requires docker. Podman support would be good too.

Describe the solution you'd like Implement support for podman. This would involve

  1. Completing https://github.com/konveyor/move2kube/blob/main/environment/container/podmanengine.go, which should fully implement the containerengine interface (https://github.com/konveyor/move2kube/blob/a5bf3cd7a8f611792da01c580a171740acc404ce/environment/container/container.go#L36), [An example could be found in https://github.com/konveyor/move2kube/blob/main/environment/container/dockerengine.go for docker]
  2. Adding a condition in https://github.com/konveyor/move2kube/blob/a5bf3cd7a8f611792da01c580a171740acc404ce/environment/container/container.go#L59 stating when to invoke it.

Describe alternatives you've considered Using only docker for containers

rmarting commented 2 years ago

Maybe it could be an argument to request to the user, or a question in the UI to choose the container engine to use in the scripts and deployment artifacts generated by the tool. Then the user could choose the right container engine for his/her environment.

The idea is similar when you choose the platform (k8s or OpenShift). Then the artifacts generated will be aligned with that decession.

Of course, docker could be the default one if the user does not set podman.

ashokponkumar commented 2 years ago

That's a good point @rmarting .

The scope of this issue is about what Container runtime needs to use to run its container based Transformers ( which are custom Transformers that can be built as containers). This can be automatically chosen, first it can try docker and if it does not work, then it can try podman. We havn't yet implemented the support for podman. It requires implementing an interface.

The point you have brought up is also valid. We should support creation of scripts with podman/docker. Can you possibly convert your comment into a new issue, so that we can track it to completion.

ashokponkumar commented 2 years ago

@seshapad When we implement support for podman, consider using libpod (https://github.com/containers/podman/tree/main/libpod) instead of requiring external podman binary.

rmarting commented 2 years ago

That's a good point @rmarting .

The scope of this issue is about what Container runtime needs to use to run its container based Transformers ( which are custom Transformers that can be built as containers). This can be automatically chosen, first it can try docker and if it does not work, then it can try podman. We havn't yet implemented the support for podman. It requires implementing an interface.

The point you have brought up is also valid. We should support creation of scripts with podman/docker. Can you possibly convert your comment into a new issue, so that we can track it to completion.

@ashokponkumar New Enhacement request created here

mohit-marathe commented 5 months ago

Hello! I'm trying to work on this one. If we want to do CopyDirsFromContainer, CopyDirsToContainer, Stat, StopContainer, CopyDirsToImage in podman(podmanengine.go) like we do in docker(dockerengine.go), we would need to have access to container IDs of the container we created. Now, one way of doing that is to list the containers and filtering them out by image names i.e. podman ps -q --filter "ancestor=image_name". But the problem arises when there are multiple containers from the same image. Am I missing something here? @kmehant @HarikrishnanBalagopal @ashokponkumar