K8s Plugin Network CRD

The purpose of this CRD is to create and delete dynamic network. For updating, delete is required followed by "create". 

Spec for K8s Plugin Network CRD

Spec
NetworkSpec 
    CniType         string        // Ovn4nfv is the only supported type 
    Ipv4Subnets     []Ip4Subnet   // Some CNI may support only one subnet
    Ipv6Subnets     []Ip6Subnet   // Optional 
    Route           []Routes      // Optional - List of Routes for this Network
    Dns             DnsSpec       // Optional


Ipv4Subnet   
    Name           string      // Name of the subnet
	Subnet         string      // Subnet CIDR
	Gateway        string      // Optional Gateway CIDR if not provided assumed it is the first address in subnet
	ExcludeIps     string      // Optional list of IP address in a comma sperated list

Ipv6Subnet
    Name           string      // Name of the subnet
    Prefix         string      // Prefix for Ipv6
    Gateway        string      // Optional Gateway
    ExcludeIps     string      // Optional list of IP address in a comma sperated list

Routes
   Destination     string      // Destination CIDR
   Gateway         string      // IP of next hop

Dns
    NameServers    []string    // List of nameservers        
    Domain         string      // Name of local domain
    Search         []string    // List of search domains
    Options        []string    // List of options


Network CRD

Network CRD
apiVersion: apiextensions.k8s.io/v1beta1
kind: CustomResourceDefinition
metadata:
  name: networks.k8s.plugin.opnfv.org
spec:
  group: k8s.plugin.opnfv.org
  version: v1
  names:
    kind: Network
    plural: networks
  scope: Namespaced
  subresources:
    # status enables the status subresource.
    status: {}
  validation:
    openAPIV3Schema:
      type: object
      properties:
        spec:
          type: object
          properties:
            cniType:
              type: string
            ipv4Subnets:
              description: 'List of subnets for the network'
              type: array
              items:
                properties:
                  name:
                    type: string
                  subnet:
                    type: string

Example CR for Network CRD

Network CR Example
apiVersion: k8s.plugin.opnfv.org/v1
kind: Network
metadata:
  name: ovn-priv-net
spec:
  cniType: Ovn4nfv
  ipv4subnets:
  - subnet: 172.16.33.0/24
    name: subnet1
    gateway: 172.16.33.1/24
    excludeIps: 172.16.33.2 172.16.33.5..172.16.33.10

Provider Network CRD

This CRD is to create a provider network on one or more nodes in the cluster. 

Spec for Provider Network CRD

Spec
ProviderNetworkSpec 
    CniType                   string       // Ovn4nfv is the only supported type 
    ProviderNetworkType       string       // VLAN is the only supported type
    Vlan                      VlanSpec
    Ip4Subnets                []Ip4Subnet  // Some CNI may support only one subnet
    Ip6Subnets                []Ip6Subnet  // Optional 
    Route                     []Routes      // Optional - List of Routes for this Network
    Dns                       DnsSpec        // Optional
	
VlanSpec
    VlanID                    string      // VLAN ID
    ProviderInterfaceName     string      // Interface name to create VLAN on
    VlanNodeSelector          string      // "all"/"any"(in which case a node will be randomly selected)/"specific"(see below)
    NodeNameList              []string    // if VlanNodeSelector is value "specific" then this array provides a list of nodes 
    LogicalInterfaceName      string      // Optional if not provide InterfaceName.VlanID Used

Ip4Subnet   
    Name                      string      // Name of the subnet
	Subnet                    string      // Subnet CIDR
	Gateway                   string      // Optional Gateway CIDR if not provided assumed it is the first address in subnet
	ExcludeIps                string      // Optional list of IP address in a comma sperated list

Ip6Subnet
    Name                      string      // Name of the subnet
    Prefix                    string      // Prefix for Ipv6
    Gateway                   string      // Optional Gateway
    ExcludeIps                string      // Optional list of IP address in a comma sperated list

Route
   Destination     string      // Destination CIDR
   Gateway         string      // IP of next hop

DnsSpec
    NameServers    []string    // List of nameservers        
    Domain         string      // Name of local domain
    Search         []string    // List of search domains
    Options        []string    // List of options

Provider Network CRD

Provider Network CRD
apiVersion: apiextensions.k8s.io/v1beta1
kind: CustomResourceDefinition
metadata:
  name: providernetworks.k8s.plugin.opnfv.org
spec:
  group: k8s.plugin.opnfv.org
  version: v1
  names:
    kind: ProviderNetwork
    plural: providernetworks
  scope: Namespaced
  subresources:
    # status enables the status subresource.
    status: {}
  validation:
    openAPIV3Schema:
      type: object
      properties:
        spec:
          type: object
          properties:
            cniType:
              type: string
            ipv4Subnets:
              description: 'List of subnets for the network'
              type: array
              items:
                properties:
                  name:
                    type: string
                  subnet:
                    type: string

Example CR for Provider Network CRD

Provider Network CR Example
apiVersion: k8s.plugin.opnfv.org/v1beta1
kind: OvnProviderNetwork
metadata:
  name: ovn-provider-net
spec:
  cniType: Ovn4nfv
  ipv4subnets:
  - subnet: 172.16.33.0/24
    name: subnet1
    gateway: 172.16.33.1/24
    excludeIps: 172.16.33.2 172.16.33.5..172.16.33.10
  providerNetworkType: vlan
  vlan:
    vlanId: 100
    providerInterfaceName: eth0
    Node: node1,node2
    logicalInterfaceName: eth0.100 

Network Chaining CRD

The purpose of this CRD is to specify a chain of deployments to create a service chain. The order of the deployments in the list depicts the topology. For example the 

Spec for Network Chaining CRD

Spec
NetworkChainSpec
    ChainType       string              // Currently only Routing type is supported 
	RoutingSpec     RouteSpec           // Spec for Routing type

RouteSpec
   LeftNetwork      []RoutingNetwork    // Info on Network on the left side
   RightNetwork     []RoutingNetwork    // Info on Network on the right side
   NetworkChain     string              // Left and Right networks are derived from Leftnetwork and RightNetwork respectively. 
                                        // NetworkChain is a comma seprated list with format DeploymentName, middle Network Name, DeploymentName 
RoutingNetwork
    NetworkName     string              // Name of the network 
    SubnetInfo      []Subnet            // Subnet information

SubnetInfo
    Name            string              // Name of the subnet
    GatewayIp       string              // Gateway IP Address

Network CRD

Network Chaining CRD
apiVersion: apiextensions.k8s.io/v1beta1
kind: CustomResourceDefinition
metadata:
  name: networkchainings.k8s.plugin.opnfv.org
spec:
  group: k8s.plugin.opnfv.org
  version: v1
  names:
    kind: NetworkChaining
    plural: networkchainings
  scope: Namespaced
  subresources:
    # status enables the status subresource.
    status: {}
  validation:
    openAPIV3Schema:
      type: object
      properties:
        spec:
          type: object
          properties:
            type:
              type: string

Example CR for NetworkChaining CRD

Network Chaining CR Example
apiVersion: k8s.plugin.opnfv.org/v1
kind: NetworkChaining
metadata:
  name: chain1
spec:
  type: Routing
  routingSpec:
    leftNetwork:
      - networkName: ovn-provider1
        subnetInfo:
          - name: subnet1
            gatewayIP: 10.1.5.1
    rightNetwork:
      - networkName: ovn-provider1
        subnetInfo:
          - name: subnet2
            gatewayIP: 10.1.10.1
    networkChain: vFw, ovn-net1, webcache, ovn-net2, sdwan
 
  • No labels

1 Comment

  1. Hi , do we have sample VSP onboarding package for custom resource definitions (CRD)? does ONAP support CRD creation ?