Skip to content
This repository was archived by the owner on Feb 10, 2021. It is now read-only.
This repository was archived by the owner on Feb 10, 2021. It is now read-only.

No option to publish ports on pod #64

Open

Description

@AstraLuma

Looking at the varlink schema, there's an option to set the published ports when creating a pod.

https://github.com/containers/libpod/blob/9758a975e67bb9d681d351aea0d858ace598dcdf/cmd/podman/varlink/io.podman.varlink#L451-L460

This library doesn't seem to expose that.

def create(self,
ident=None,
cgroupparent=None,
labels=None,
share=None,
infra=False):
"""Create a new empty pod."""
config = ConfigDict(
name=ident,
cgroupParent=cgroupparent,
labels=labels,
share=share,
infra=infra,
)
with self._client() as podman:
result = podman.CreatePod(config)
details = podman.GetPod(result['pod'])
return Pod(self._client, result['pod'], details['pod'])

Activity

  1. AstraLuma commented on Jan 6, 2020

    @AstraLuma
    Author

    The work-around I'm using for this is:

    def create_pod(client, ident=None, cgroupparent=None, labels=None, share=None,
                   infra=False, publish=[]):
        """Create a new empty pod."""
        infra = infra or bool(publish)
        if not share and infra:
            share = ['cgroup', 'ipc', 'net', 'uts']
        config = ConfigDict(
            name=ident,
            cgroupParent=cgroupparent,
            labels=labels,
            share=share,
            infra=infra,
            publish=publish
        )
    
        with client._client() as podman:
            result = podman.CreatePod(config)
            details = podman.GetPod(result['pod'])
        return Pod(client._client, result['pod'], details['pod'])
  2. AstraLuma commented on Jan 8, 2020

    @AstraLuma
    Author

    Also, the default container network configuration interferes with this.

  3. 4383 commented on Jan 8, 2020

    @4383
    Collaborator

    It seems you are right the publish param is not exposed.

    I think it's weird because python-podman is aligned with libpod 1.6.0 who was released on the last October (3-4 months ago) and the publish param was added to the varlink interface more than 1 years ago, so I think it's part to the libpod 1.6.0.

    I think it's an issue and it need to be available in python-podman 1.6.0

  4. 4383 commented on Jan 8, 2020

    @4383
    Collaborator

    I proposed a fix to realign the master with the latest signature of this interface.

    Anyway it will part of a future release (surely 1.6.1)

  5. 4383 commented on Jan 8, 2020

    @4383
    Collaborator

    It can be interesting to implement some automatized check to verify if python-podman implementation differ from defined interfaces on libpod.

    These check could be either triggered on pushed changes on the interface description file on the libpod side or triggered daily on the python-podman side trough some cron job and travis-ci.

    I will try to spend time in the next weeks to propose this kind of feature.

  6. self-assigned this
    on Jan 8, 2020
  7. 4383 commented on Jan 8, 2020

    @4383
    Collaborator

    We can refer to this proposal to manage this kind of issue in the future.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions