-
Notifications
You must be signed in to change notification settings - Fork 23.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
podman support (podman_container) #46362
Comments
@dprince Greetings! Thanks for taking the time to open this issue. In order for the community to handle your issue effectively, we need a bit more information. Here are the items we could not find in your description:
Please set the description of this issue with this template: |
I am working on the following modules for inclusion in TripleO:
I also plan to write a |
A The modules @samdoran mentioned are available here: https://github.com/openstack/tripleo-ansible/tree/master/tripleo_ansible/library |
I created a role for myself to do that until there is such systemd enabled podman module. It would be great to have such feature as this issue is asking. My role here: https://github.com/ikke-t/podman-container-systemd But that won't take parameters for podman like docker_container does for docker. But that has what such podman_container should do for systemd. |
Started to work on this |
I also spend a moment looking at this at some point, looking for time to do it, which never happened. There would be a way to re-use the awx kubernetes templates, and build it all with podman play kube. At the time I got stopped due podman didn't do volumes from play kube, but they fixed it after I created ticket about it. Good luck! |
Created a PR #57956, still polishing it and testing. Will appreciate any help with reviews and/or testing. |
Never mind my previous comment, I didn't read the topic. I was thinking of another issue, it was about awx and podman. Regarding calculations, this issue was made for it, perhaps there is something for you: containers/podman#2600 |
Is there any update on |
@felixfontein isn't it merged and therefore fixed already? |
@alexanderadam it has been merged prematurely and has been reverted (#58422). @samdoran and @sshnaidm were talking on IRC about creating a new PR eventually, so that the module will be there for 2.9, but I haven't seen anything and was wondering what the current state is. Especially since feature freeze for 2.9 is in about one month. |
When reverted my patch @samdoran said he has something WIP that he's working on his own, you can ask him. I didn't hear anything since then. |
@felixfontein ah okay, I didn't know that. Thank you for updating me! 👍 |
I have a very early WIP here. It's pretty much a skeleton that needs to be filled out. Lots of work to be done still. |
@samdoran do you plan to have this done before 2.9 feature freeze? |
@felixfontein No, I am not actively working on that module. |
I would use this, if available. |
The TripleO community is continuing work on a |
Spontaneously, it looks like the version you have is similar to the one from #57956. How (and where) should development proceed? I can help reviewing, but for that I need to know where I can write something :) Also, as we were discussing in various places (issues/PRs here and IRC), there are some design issues with the current module which should be discussed first before more implementation is done - especially with regard to idempotency. From how docker_container works internally, I've learned that it would be very nice if the code for handling all aspects for one option - parsing (if necessary), checking idempotency and making sure a container is created / changed that way - are close together. Otherwise, you end up with a rather big mess (like docker_container :) ). |
@felixfontein you're right, I used #57956 as a base for this module. I think it definitely has 95% of all functionality, except of idempotency of running containers. Now we develop it in tripleo - Openstack Gerrit. It looks like more comfortable place for collaboration and reviews, unlike here. Also we start to use it in tripleo and it will be well tested. For anybody that want to review or contribute, just send patches or review: https://review.opendev.org/#/q/project:openstack/tripleo-ansible |
I would say that idempotency is at least 2/3 of the whole functionality.
Idempotency is for me the most basic part of a module, especially for a module of this size. To decide how the module works, you first need to find out how to handle idempotency, everything else is rather straightforward after that.
Definitely. The main question is: how?
Exactly. I still think it is better to start with a subset of the module which covers some of the most important and interesting options, completely implement that, and then add all the other options. That will make implementation a lot easier.
Assuming that the podman team really made podman behave like docker, everything important should already be there.
My personal idea on how to implement it in a better way is as follows. I would have a class instance per option which handles:
There should be some utilities (classes and functions to instantiate them) so that for most options, this can be done in 1-2 lines. Also, there's the question on whether you want the module to behave like the docker_container module with all its quirks (I tried to sum them up here: https://github.com/ansible/ansible/blob/devel/lib/ansible/modules/cloud/docker/docker_container.py#L28-L36), or differently. (I would definitely stop using default values for container-affecting options, these really only cause problems. See the notes there.) Doing this differently also has its own dangers. This is something that should be discussed before discussing any implementation. |
I agree with @felixfontein on the design goals of We will also have to account for differences in Podman versions. I have already been bit by that with We could start with the most common attributes, such as ports and mounts, and build from there.
My original intent was to allow playbook authors to switch from I vote we make |
The module that is located currently in tripleo-ansible package is different from that was merged and reverted here. I'd suggest to check its code to see what we discuss here at all: podman_container.py |
@sshnaidm I did look at its current state, it still had a big TODO where the idempotency code should be. Your WIP patch will work, but also doesn't scale very well. Think about how you would add And finally, what about container differences which can be changed without needing to restart the container? I don't know what that would be for podman, but for docker_container there are several ones ( And this approach also opens up the possibility of forgetting something / something getting out of sync. The docker_container module had multiple options which never worked properly (because they were forgotten in idempotence checks), or weren't even used at all (neither for container creation/startup nor for idempotence). |
I added diff support in current revision: https://review.opendev.org/#/c/688574/ Fortunately it was easy, just create text with "before" and "after" and then "diff" callback will do all for you. Difference is collected in the same place where it's checked for difference, I think it's quite logical to do.
As was discussed in IRC podman doesn't support it and it's not in current roadmap.
I hope when we arrange all arguments work in one place it would be easy to add/remove various arguments, I'll try to do some examples of newly added arguments like "env-host". |
Yes, that's what the docker_container module is doing as well.
And I hope
I agree. (The docker_container module doesn't do that either. I think it simply returns the current container's inspect results, or none in case the container currently doesn't exist.)
That would definitely be a good thing. BTW, I noticed that you didn't address a lot of things I pointed out in the review in June (#57956 (review)), like Also, is it not possible to connect a container to multiple networks (like in docker)? The module accepts only one network (as a |
If it's gonna change, then yes :)
and as you can see, it's not always a dict. It could be just I've added a check about podman version like that: def addparam_env_host(self, c):
self.check_version('--env-host', minv='1.5.0')
return c + ['--env-host=%s' % self.params['env_host']] that way module with throw class PodmanDefaults:
def __init__(self, module, podman_version):
self.module = module
self.version = podman_version
self.defaults = {
............skipped
"oom_score_adj": 0,
"workdir": "/",
}
def default_dict(self):
# make here any changes to self.defaults related to podman version
if version.parse(self.version) > version.parse('1.6.5'):
self.defaults.update({'some_param': 'new_default_value'})
return self.defaults But I hope we'll never use it, because changing defaults in different versions is really bad pattern.
No, not at this moment. But actually we can do it as a list, just in case it will be supported someday. |
Well, a little fix, it's possible, just need to specify a comma separated string: |
Can you also do things like specify an IP address the container should use in a network, which hostname / aliases it should have in there, ...? (Docker allows you to do that.)
In that case, list makes sense. For idempotence checking, you'd want to accept different orders of the list, though. (Or just check for subset.)
Modules should call |
@felixfontein @samdoran please look at new version of podman_container with idempotency: https://opendev.org/openstack/tripleo-ansible/src/branch/master/tripleo_ansible/ansible_plugins/modules/podman_container.py#L1341 |
Hi all, thanks for getting this moving, is this module planned to support creation of pods or should there be another one dedicated solely for it, like |
Lets try to march currently existing docker modules in order to
|
In module that I prepared there is an option |
yeah agree with it
ok awesome! ❤️ |
As I understand from the current roadmap there are the plans to extract all community modules, including containers ones, to collections and external repos. Not sure it even will be under ansible umbrella. |
Hi. Is there any progress recently? Or is this issue being tracked in some other place? |
As all community modules will go from ansible in 2.10, podman modules are going to be in repository https://github.com/containers/ansible-podman-collections This is tracked in issue containers/podman#4654 |
This may be late to the party, but couldn't we make |
@aitorpazos that won't work this simply, since |
@felixfontein fair enough. That makes sense, thanks |
According to 1.7.1 podman RELEASE_NOTES currently in master (not released at the time of writing) |
SUMMARY
We desire a module to interact with podman on the CLI via Ansible.
This would be similar to ./modules/cloud/docker/docker_container.py which has similar features to podman's CLI. Podman also supports some new "pod like" syntax which would also be nice to support.
ISSUE TYPE
The text was updated successfully, but these errors were encountered: