Skip to content

nerdctl network create --ip-range injects a non-existent property ipRange to CNI IPAM config #5068

Description

@AkihiroSuda

type IPAMRange struct {
Subnet string `json:"subnet"`
RangeStart string `json:"rangeStart,omitempty"`
RangeEnd string `json:"rangeEnd,omitempty"`
Gateway string `json:"gateway,omitempty"`
IPRange string `json:"ipRange,omitempty"`
}

nerdctl network --ip-range injects ipRange property in .plugins[0].ipam.ranges[][], but this property does not seem supported by the CNI plugin.

https://github.com/containernetworking/plugins/blob/v1.9.1/plugins/ipam/host-local/backend/allocator/config.go#L68-L73

ipRange could be dynamically computed from rangeStart and rangeEnd.


Reproducer:

$ nerdctl network create  --driver=bridge --subnet=172.28.0.0/16 --ip-range=172.28.5.0/24   --gateway=172.28.5.254 br0

$ cat /etc/cni/net.d/default/nerdctl-br0.conflist 
{
  "cniVersion": "1.0.0",
  "name": "br0",
  "nerdctlID": "0f1575ab177c63b4a9de71c81aaf76cd2680bc20fa9b0ba6444e14e5303803e8",
  "plugins": [
    {
      "type": "bridge",
      "bridge": "br-0f1575ab177c",
      "isGateway": true,
      "ipMasq": true,
      "hairpinMode": true,
      "ipam": {
        "ranges": [
          [
            {
              "gateway": "172.28.5.254",
              "ipRange": "172.28.5.0/24",
              "rangeEnd": "172.28.5.255",
              "rangeStart": "172.28.5.1",
              "subnet": "172.28.0.0/16"
            }
          ]
        ],
        "routes": [
          {
            "dst": "0.0.0.0/0"
          }
        ],
        "type": "host-local"
      }
    },
    {
      "type": "portmap",
      "capabilities": {
        "portMappings": true
      }
    },
    {
      "type": "firewall",
      "ingressPolicy": "same-bridge"
    },
    {
      "type": "tuning"
    }
  ]
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions