foundation-model-stack / multi-nic-cni

https://foundation-model-stack.github.io/multi-nic-cni/
Apache License 2.0
33 stars 5 forks source link

Multi-config IPAM feature #155

Closed sunya-ch closed 9 months ago

sunya-ch commented 9 months ago

Is your feature request related to a problem? Please describe. A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

For L2 mode, there is no need to use host-interface block IP allocation. Instead, the existing single-NIC IPAM such as whereabouts provides more flexibility. However, the current design does not support defining multiple config (such as different subnet for different interface name) for single-NIC IPAM.

Describe the solution you'd like A clear and concise description of what you want to happen.

Multi-config IPAM is a feature to allow that in multinicnetwork IPAM definition. I define a new IPAM type called multi-config which has struct as below:

    Name     string
    Type     string                            `json:"type"`
    IpamType string                            `json:"ipam_type"`
    Args     map[string]map[string]interface{} `json:"args"`
    Routes   []*types.Route                    `json:"routes"`

The multinicnetwork IPAM should be defined like:

apiVersion: multinic.fms.io/v1
kind: MultiNicNetwork
metadata:
  name: multinic-ipvlanl2
spec:
  subnet: "172.31.49.0/24"
  ipam: |
    { 
      "type": "multi-config",
      "ipam_type": "whereabouts",
       "args": {
            "eth1": {
                  "range": "192.168.0.0/18"
             },
            "eth2": {
                  "range": "192.168.64.0/18"
             }
        }
    }
  multiNICIPAM: false
  plugin:
    cniVersion: "0.3.0"
    type: ipvlan
    args: 
      mode: l2

note: As with L2 on some system, there is no IP address assigned to the host interface. So that, we use master name instead of the network address.

Describe alternatives you've considered A clear and concise description of any alternative solutions or features you've considered.

Additional context Add any other context or screenshots about the feature request here.