Skip to content
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-compose extension for --pod-args #1057

Open
TheMDev opened this issue Oct 12, 2024 · 0 comments
Open

podman-compose extension for --pod-args #1057

TheMDev opened this issue Oct 12, 2024 · 0 comments
Labels
enhancement New feature or request

Comments

@TheMDev
Copy link

TheMDev commented Oct 12, 2024

The recent PR #964 implemented the ability to set --in-pod in the compose file. However, there still does not appear to be a way to set --pod-args in the compose file.
This would be pretty useful as it would allow for options such as --infra, --infra-command, --infra-image, --infra-name, --share and more to be set in the compose file instead of needing to pass them in with --pod-args.

Compose example:

x-podman:
    in_pod: true
    pod_args: '--infra=true --infra-name=pod_unipi_infra --share=""'

Possible partial implementation:

index 6b974f5..43305fb 100755
--- a/podman_compose.py
+++ b/podman_compose.py
@@ -1762,6 +1762,12 @@ class PodmanCompose:
         # otherwise use `in_pod` value provided by command line
         return self.global_args.in_pod_bool
 
+    def resolve_pod_args(self):
+        if self.global_args.pod_args == "--infra=false --share=":
+            self.global_args.pod_args = self.x_podman.get("pod_args", True)
+        # otherwise use `pod_args` value provided by command line
+        return self.global_args.pod_args
+
     def _parse_compose_file(self):
         args = self.global_args
         # cmd = args.command
@@ -2008,6 +2014,7 @@ class PodmanCompose:
         self.x_podman = compose.get("x-podman", {})
 
         args.in_pod_bool = self.resolve_in_pod()
+        args.pod_args = self.resolve_pod_args()
         pods, containers = transform(args, project_name, given_containers)
         self.pods = pods
         self.containers = containers
@TheMDev TheMDev added the enhancement New feature or request label Oct 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant