cni icon indicating copy to clipboard operation
cni copied to clipboard

CNI v2/ export CNI service via gRPC

Open robberphex opened this issue 3 years ago • 3 comments

Provide CNI service via gRPC.

  • [ ] If we define NetworkConfigList with Any field, could we change the format of config file?
  • [ ] Currently, AddNetwork accept NetworkConfig and RuntimeConf, could we just omit NetworkConfig, and use name of NetworkConfig? We could provide List/Add/Del methods for NetworkConfig.

robberphex avatar Jan 03 '22 15:01 robberphex

Example network configuration could be like:

{
  "cniVersion": "1.0.0",
  "name": "dbnet",
  "plugins": [
    {
      "type": "bridge",
      "bridge": "cni0",
      "extra": [
        {
          // **plugin specific parameters for nerdctl**
          "@type": "type.googleapis.com/helloworld.NerdctlNetworkConfig",
          "NerdctlID": 112233,
          "NerdctlLabels": {
            "bob": "11"
          }
        },
        {
          // **plugin specific parameters for bridge**
          "@type": "type.googleapis.com/k8s.cni.cncf.io/v1.0.0.BridgeNetworkConfig",
          "configKey": "configValue"
        }
      ],
      "ipam": {
        "type": "host-local",
        // ipam specific
        "subnet": "10.1.0.0/16",
        "gateway": "10.1.0.1",
        "routes": [
          {
            "dst": "0.0.0.0/0"
          }
        ]
      },
      "dns": {
        "nameservers": [
          "10.1.0.1"
        ]
      }
    },
    {
      "type": "tuning",
      "capabilities": {
        "mac": true
      },
      "sysctl": {
        "net.core.somaxconn": "500"
      }
    },
    {
      "type": "portmap",
      "capabilities": {
        "portMappings": true
      }
    }
  ]
}

And this kind of config can be decoded to protobuf/json format.

@squeed Any ideas?

robberphex avatar Jan 04 '22 04:01 robberphex

Hi @robberphex , thanks for your effort, but CNI v2 is not just a simple migration from v1, even SPEC may change. We need more discussions before reaching implementation, even a detailed enhancement proposal.

mars1024 avatar Jan 05 '22 02:01 mars1024

@robberphex I was just trying to do this and realized you had done some of the work. I am trying to get the gRPC conversations moving again.

MikeZappa87 avatar Nov 23 '23 02:11 MikeZappa87