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

make nerdctl network inspect compatible with Docker #283

Merged
merged 1 commit into from
Jul 7, 2021

Conversation

AkihiroSuda
Copy link
Member

Now nerdctl network inspect uses --mode=dockercompat by default.

$ nerdctl network inspect compose-wordpress_default
[
    {
        "Name": "compose-wordpress_default",
        "Id": "19",
        "IPAM": {
            "Config": [
                {
                    "Subnet": "10.4.19.0/24",
                    "Gateway": "10.4.19.1"
                }
            ]
        },
        "Labels": {
            "com.docker.compose.network": "default",
            "com.docker.compose.project": "compose-wordpress"
        }
    }
]

Can be rolled back to the old behavior by specifying --mode=native.

$ nerdctl network inspect --mode=native compose-wordpress_default
[
    {
        "CNI": {
            "cniVersion": "0.4.0",
            "name": "compose-wordpress_default",
            "nerdctlID": 19,
            "nerdctlLabels": {
                "com.docker.compose.network": "default",
                "com.docker.compose.project": "compose-wordpress"
            },
            "plugins": [
                {
                    "type": "bridge",
                    "bridge": "nerdctl19",
                    "isGateway": true,
                    "ipMasq": true,
                    "hairpinMode": true,
                    "ipam": {
                        "type": "host-local",
                        "routes": [
                            {
                                "dst": "0.0.0.0/0"
                            }
                        ],
                        "ranges": [
                            [
                                {
                                    "subnet": "10.4.19.0/24",
                                    "gateway": "10.4.19.1"
                                }
                            ]
                        ]
                    }
                },
                {
                    "type": "portmap",
                    "capabilities": {
                        "portMappings": true
                    }
                },
                {
                    "type": "firewall"
                },
                {
                    "type": "tuning"
                },
                {
                    "type": "isolation"
                }
            ]
        },
        "NerdctlID": 19,
        "NerdctlLabels": {
            "com.docker.compose.network": "default",
            "com.docker.compose.project": "compose-wordpress"
        },
        "File": "/home/suda/.config/cni/net.d/nerdctl-compose-wordpress_default.conflist"
    }
]

Now `nerdctl network inspect` uses `--mode=dockercompat` by default.

Can be rolled back to the old behavior by specifying `--mode=native`.

Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
@AkihiroSuda AkihiroSuda added enhancement New feature or request impact/major labels Jul 7, 2021
@AkihiroSuda AkihiroSuda added this to the v0.11.0 milestone Jul 7, 2021
@AkihiroSuda
Copy link
Member Author

@fahedouch @ktock PTAL

// Scope, Driver, etc. are omitted
}

func NetworkFromNative(n *native.Network) (*Network, error) {
Copy link
Member

Choose a reason for hiding this comment

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

error doesn't seems to used here?

Copy link
Member Author

Choose a reason for hiding this comment

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

True, but not new in this file. And a future version of this function may return an error.

Copy link
Member

@ktock ktock left a comment

Choose a reason for hiding this comment

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

LGTM

@fahedouch
Copy link
Member

LGTM

@AkihiroSuda AkihiroSuda merged commit f6f48cd into containerd:master Jul 7, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request impact/major
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants