summaryrefslogtreecommitdiff
path: root/cmd/podman/networks/create.go
diff options
context:
space:
mode:
Diffstat (limited to 'cmd/podman/networks/create.go')
-rw-r--r--cmd/podman/networks/create.go12
1 files changed, 10 insertions, 2 deletions
diff --git a/cmd/podman/networks/create.go b/cmd/podman/networks/create.go
index 8cf9bcada..84c58d4dc 100644
--- a/cmd/podman/networks/create.go
+++ b/cmd/podman/networks/create.go
@@ -33,6 +33,8 @@ var (
networkCreateOptions entities.NetworkCreateOptions
labels []string
opts []string
+ ipamDriverFlagName = "ipam-driver"
+ ipamDriver string
)
func networkCreateFlags(cmd *cobra.Command) {
@@ -66,8 +68,8 @@ func networkCreateFlags(cmd *cobra.Command) {
flags.StringArrayVar(&labels, labelFlagName, nil, "set metadata on a network")
_ = cmd.RegisterFlagCompletionFunc(labelFlagName, completion.AutocompleteNone)
- // TODO not supported yet
- // flags.StringVar(&networkCreateOptions.IPamDriver, "ipam-driver", "", "IP Address Management Driver")
+ flags.StringVar(&ipamDriver, ipamDriverFlagName, "", "IP Address Management Driver")
+ _ = cmd.RegisterFlagCompletionFunc(ipamDriverFlagName, common.AutocompleteNetworkIPAMDriver)
flags.BoolVar(&networkCreateOptions.IPv6, "ipv6", false, "enable IPv6 networking")
@@ -112,6 +114,12 @@ func networkCreate(cmd *cobra.Command, args []string) error {
Internal: networkCreateOptions.Internal,
}
+ if cmd.Flags().Changed(ipamDriverFlagName) {
+ network.IPAMOptions = map[string]string{
+ types.Driver: ipamDriver,
+ }
+ }
+
// old --macvlan option
if networkCreateOptions.MacVLAN != "" {
logrus.Warn("The --macvlan option is deprecated, use `--driver macvlan --opt parent=<device>` instead")