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

Support docker-specific network create options via CLI #1320

Merged
merged 1 commit into from
Feb 14, 2023

Conversation

hasan4791
Copy link
Contributor

Signed-off-by: T K Chandra Hasan t.k.chandra.hasan@ibm.com

Following docker specific network options are supported via CLI

  1. com.docker.network.driver.mtu
  2. com.docker.network.bridge.name

Fixes containers/podman#15830

@hasan4791 hasan4791 changed the title Closes containers/podman#15830 Support docker-specific network create options via CLI Support docker-specific network create options via CLI Feb 9, 2023
@rhatdan
Copy link
Member

rhatdan commented Feb 9, 2023

LGTM
@Luap99 PTAL

@hasan4791
Copy link
Contributor Author

I'm not sure why this is failing, even though both the actual & expected is equal
https://cirrus-ci.com/task/6371368061632512

Copy link

@dpward dpward left a comment

Choose a reason for hiding this comment

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

One nit here

err = internalutil.CreateBridge(n, newNetwork, usedNetworks, n.defaultsubnetPools)
if err != nil {
return nil, err
}
// validate the given options, we do not need them but just check to make sure they are valid
Copy link

@dpward dpward Feb 9, 2023

Choose a reason for hiding this comment

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

I assume this comment is outdated? The code after it used to just parse the options as-is, and stop if an error occurred. But now we are actually adapting the options as necessary.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thank you @dpward , addressed the same.

@rhatdan
Copy link
Member

rhatdan commented Feb 9, 2023

/approve

@openshift-ci openshift-ci bot added the approved label Feb 9, 2023
@hasan4791
Copy link
Contributor Author

For Doc update,
containers/podman#17457

@rhatdan
Copy link
Member

rhatdan commented Feb 9, 2023

@hasan4791 Please combine the two PRs together into this PR and fix @dpward comment #1320 (review) and then we can merge.

@hasan4791
Copy link
Contributor Author

@rhatdan But the doc update PR is on podman repo and it can be merged when we update the containers/common version.

@rhatdan
Copy link
Member

rhatdan commented Feb 9, 2023

@hasan4791 Thanks I missed that.

/approve
/lgtm
/hold

@openshift-ci
Copy link
Contributor

openshift-ci bot commented Feb 9, 2023

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: hasan4791, rhatdan

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

Copy link
Member

@Luap99 Luap99 left a comment

Choose a reason for hiding this comment

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

I think this should be put in a separate function which maps the docker key to the podman keys one to one and then removes the docker key from the map. I suggest you put this in libnetwork/util

Right now this completely ignores the cni backend and drivers other than bridge, if you move this into the separate package you can just import it in both the netavark and cni code and call it before the driver switch case.

Comment on lines 161 to 164
case "com.docker.network.driver.mtu":
newNetwork.Options[types.MTUOption] = value
fallthrough

Copy link
Member

Choose a reason for hiding this comment

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

you should to remove the docker option from the map otherwise we end up with two times the same option in the config which is undesirable.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

these docker options are applicable only for bridge drivers right?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Addressed review comments. PTAL

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I've added only to the bridge driver option as per this doc
https://docs.docker.com/engine/reference/commandline/network_create/#bridge-driver-options

Signed-off-by: T K Chandra Hasan <t.k.chandra.hasan@ibm.com>
@hasan4791
Copy link
Contributor Author

This particular testcase is randomly failing, "return the same network when creating two networks with the same name and ignore"
https://api.cirrus-ci.com/v1/task/4626113603829760/logs/test.log

@rhatdan
Copy link
Member

rhatdan commented Feb 14, 2023

/lgtm
/hold cancel

@openshift-merge-robot openshift-merge-robot merged commit 9c1b8d9 into containers:main Feb 14, 2023
@hasan4791 hasan4791 deleted the issue-15830 branch February 21, 2023 15:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

RFE: Expose docker-specific network create options via the CLI
5 participants