Skip to content

feat: Add support for 'podman-compose' in sugar #167

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

Merged
merged 42 commits into from
Apr 6, 2025

Conversation

sanjay7178
Copy link
Contributor

@sanjay7178 sanjay7178 commented Mar 11, 2025

This PR implements support for podman-compose commands in Sugar, expanding its capabilities beyond Docker Compose.

Solve #166

How to test these changes

poetry install 
sugar podman-ext --help 

This PR is a:

  • new feature

environment :

podman-compose version 1.3.0
podman version 3.4.4

Reference :

PR Checklist:

  • Add unit tests for swarm functionality (tests/unit/extensions/test_podman_ext.py)
  • Add smoke tests for podman_ext commands in .makim.yaml
  • Updated core.py to integrate the podman-ext (podman-compose) extension
  • Added proper documentation for all commands.
  • Add podman-compose pypi package to poetry

Sugar Podman-Ext CLI Specific Checklist :

  • attach Attach to a service.
  • build Build or rebuild services.
  • config Parse, resolve and render compose file in canonical format.
  • cp Copy files/folders between a service container.
  • create Create services.
  • down Stop and remove containers, networks.
  • events Receive real time events from containers.
  • exec Execute a command in a running container.
  • images List images used by the created containers.
  • kill Kill containers.
  • logs View output from containers.
    - [ ] ls List running compose projects.
  • pause Pause services.
  • port Print the public port for a port binding.
  • ps List containers.
  • pull Pull service images.
  • push Push service images.
  • restart Restart services.
  • rm Remove stopped containers.
  • run Run a one-off command on a service.
  • scale Scale services.
  • start Start services.
  • stop Stop services.
    - [ ] top Display the running processes.
  • unpause Unpause services.
  • up Create and start containers.
  • version Show the podman-compose version information.
  • wait Block until the first service container stops.
  • watch Watch build context for service source code changes and.

Observation from podman-compose and docker-compose :

  • Podman-compose ps doesn't support service names as arguments
  • top command does'nt work in podman-compose , so stats is used instead in podman-compose
  • podman-compose doesn't accept service names as arguments for the config command.
  • podman compose ls is hard to integrate , it doesnt seems to be run

@xmnlab
Copy link
Member

xmnlab commented Mar 13, 2025

@sanjay7178 , do we really need to have a new extension for podman? or could we just add support to it with backend and change the current compose and compose-ext to work with both?

@sanjay7178
Copy link
Contributor Author

@sanjay7178 , do we really need to have a new extension for podman? or could we just add support to it with backend and change the current compose and compose-ext to work with both?

Actually I found out few interesting things that really required the podman as seperate command in sugar

  1. If docker sock and podman sock both were running at same time as mentioned in this pr sugar podman-ext can used to run especially on podman sock
  2. for point 1. if we can achieve doing that we can run sugar config as daemonless and rootless containers
  3. When I tried implementing this pr , I found a issue ie .. while a running a podman-compose to run compose file it requires the absolute path , not relative path . Otherwise it throws file doesnt exists error (Screenshot attached below)
  4. from point 3. while i tried podman compose command to run as well with same flags , it looks for docker daemon sock (I see this error would especially comes with podman and docker socks running at same time)
  5. On comparing podman compose or podman-compose and docker-compose I seen more few arguments/features are lacking such as ignore orphaned containers , experimental docker commands such as alpha , disabling helper menu ,compatibility mode

image
image

conclusion :

  • for point 2 and 3 I've made working proof of concept
  • so making podman-ext as separate command would be beneficial and we can have a feature to export sugar config files to kubernetes manifests which runs on a podman pod .

@xmnlab
Copy link
Member

xmnlab commented Mar 18, 2025

@sanjay7178 , I will review that tomorrow. thanks!

Copy link

This pull request has been marked as stale because it has been
inactive for more than 5 days. Please update this pull request
or it will be automatically closed in 5 days.

@github-actions github-actions bot added the stale label Mar 24, 2025
@github-actions github-actions bot removed the stale label Mar 25, 2025
Copy link
Member

@xmnlab xmnlab left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks for working on that @sanjay7178 !
in general it looks good to me.

I just added comments about some code that was commented out .. that probably should be removed.

please ping me on discord when you have fixed the commented code.

@sanjay7178
Copy link
Contributor Author

thanks for working on that @sanjay7178 ! in general it looks good to me.

I just added comments about some code that was commented out .. that probably should be removed.

please ping me on discord when you have fixed the commented code.

sure

@sanjay7178
Copy link
Contributor Author

sanjay7178 commented Mar 26, 2025

Pending Chores :

  • Need to check again all the podman extension commands are working
  • Need to add smoke tests for podman similar docker compose in .makim.yml
  • Need to add unitest for podman_ext.py in test/test_podman_ext.py

@sanjay7178
Copy link
Contributor Author

here is the mkdocs live preview this PR https://sugar-podman.pages.dev/podman-ext/

@xmnlab
Copy link
Member

xmnlab commented Mar 31, 2025

@sanjay7178 , the documentation looks great.

please let me know on inc-sugar where this PR is ready for a review. thanks!

@xmnlab
Copy link
Member

xmnlab commented Apr 3, 2025

@sanjay7178 could you rebase your branch on top of the upstream/main?

@sanjay7178
Copy link
Contributor Author

@sanjay7178 could you rebase your branch on top of the upstream/main?

Sure

@xmnlab xmnlab merged commit 0e4ee08 into osl-incubator:main Apr 6, 2025
9 checks passed
@xmnlab
Copy link
Member

xmnlab commented Apr 6, 2025

LGTM! thanks @sanjay7178 for working on that. appreciate it

Copy link

github-actions bot commented May 3, 2025

🎉 This PR is included in version 1.17.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants