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

Fix container inspect endpoint returning null for network settings / ports #6852

Merged

Conversation

skorhone
Copy link

@skorhone skorhone commented Jul 3, 2020

Fixes compatibility issue with testcontainers.

This pull requests adds list of ports to NetworkSettings.Ports

Docker inspect returns Ports:

        "NetworkSettings": {
            "Bridge": "",
            "SandboxID": "8481a8888bee4be0737c003ab80224e8bbcf22064e55a19e93a7eb33f253fd9c",
            "HairpinMode": false,
            "LinkLocalIPv6Address": "",
            "LinkLocalIPv6PrefixLen": 0,
            "Ports": {
                "2222/tcp": [
                    {
                        "HostIp": "0.0.0.0",
                        "HostPort": "32770"
                    }
                ]
            },

After this change podman returns ports from compat API interface:

  "NetworkSettings": {
    "Bridge": "",
    "SandboxID": "",
    "HairpinMode": false,
    "LinkLocalIPv6Address": "",
    "LinkLocalIPv6PrefixLen": 0,
    "Ports": {
      "2222/tcp": [
        {
          "HostIp": "",
          "HostPort": "38947"
        }
      ]
    },

Incorrect HostIp is out of scope for this pull request. I think that mapping empty string to 0.0.0.0 should be done in libpod/container_inspect.go rather than doing it in api/compat/container.go. Considering that I don't fully understand side effects that change to container_inspect could have caused, I decided to not to implement it.

… NetworkSettings/Ports

Implement mapping for NetworkSettings/Ports for Container inspect endpoint

Signed-off-by: Sami Korhonen <[email protected]>
@openshift-ci-robot openshift-ci-robot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Jul 3, 2020
@openshift-ci-robot
Copy link
Collaborator

Hi @skorhone. Thanks for your PR.

I'm waiting for a containers member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@openshift-ci-robot openshift-ci-robot added the needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. label Jul 3, 2020
@skorhone skorhone changed the title WIP: Fix container inspect endpoint returning null for network settings / ports Fix container inspect endpoint returning null for network settings / ports Jul 3, 2020
@openshift-ci-robot openshift-ci-robot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Jul 3, 2020
@rhatdan rhatdan removed the needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. label Jul 4, 2020
@rhatdan
Copy link
Member

rhatdan commented Jul 4, 2020

/ok-to-test

@rhatdan
Copy link
Member

rhatdan commented Jul 4, 2020

LGTM
@mheon @baude PTAL

@baude
Copy link
Member

baude commented Jul 5, 2020

lgtm, @mheon ptal

@baude
Copy link
Member

baude commented Jul 5, 2020

/approve

@openshift-ci-robot
Copy link
Collaborator

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: baude, skorhone

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-ci-robot openshift-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jul 5, 2020
@mheon
Copy link
Member

mheon commented Jul 5, 2020

/lgtm

@openshift-ci-robot openshift-ci-robot added the lgtm Indicates that a PR is ready to be merged. label Jul 5, 2020
@openshift-merge-robot openshift-merge-robot merged commit 41ccc04 into containers:master Jul 5, 2020
@github-actions github-actions bot added the locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments. label Sep 24, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 24, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. lgtm Indicates that a PR is ready to be merged. locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments. ok-to-test
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants