nokia / danm

TelCo grade network management in a Kubernetes cluster
BSD 3-Clause "New" or "Revised" License
373 stars 81 forks source link

Danm Service for IPv6 End points #235

Closed sriramec closed 4 years ago

sriramec commented 4 years ago

Is this a BUG REPORT or FEATURE REQUEST?:

feature

What happened:

I created Danm service and mapped to the pod's additional interface having both IPv6 and IPv4. But service mapping happens only to IPv4 address. Below are the yaml files.

1) clusterNetwork yaml Source: nwsvcchart/charts/danmnetwork/templates/danm.yaml K8s CRD DanmNet API schema description

apiVersion: danm.k8s.io/v1
kind: ClusterNetwork
metadata:
  name: datanw
  namespace: default
spec:
  NetworkID: datanw
  NetworkType: ipvlan
  Options:
    host_device: enp59s0f0
    cidr: 10.211.21.0/24
    net6: 2001:db8:aaaa:bbbb::/64
    allocation_pool:
      start: 10.211.21.101
      end: 10.211.21.120
    container_prefix: az
    rt_tables: 214
    routes:
       10.222.222.0/24: 10.211.21.254
    vlan: 903

2) pod yaml $ cat busybox.yaml

apiVersion: v1
kind: Pod
metadata:
  name: busybox
  labels:
    app: busybox
    identity: busyboxpod
  annotations:
    danm.k8s.io/interfaces: |
      [
        { "clusterNetwork":"default","ip": "dynamic" },
        { "clusterNetwork":"datanw", "ip": "dynamic" ,"ip6": "dynamic"}
      ]
spec:
  containers:
  - image: registry.kube-system.svc.rec.io:5555/busybox
    command:
      - sleep
      - "3600"
    imagePullPolicy: IfNotPresent
    name: busybox
  nodeSelector:
    vishalIpv6: imgDep3
  restartPolicy: Always

3) service yaml

apiVersion: v1
kind: Service
metadata:
  name: busyboxheadless
  namespace: default
  annotations:
    danm.k8s.io/selector: '{"identity": "busyboxpod" }'
    danm.k8s.io/clusterNetwork: datanw
spec:
  clusterIP: None
  ports:
  - name: danmnetdataport
    port: 7001
    targetPort: 7001
    protocol: TCP

But service maps only to IPv4 address output of below command shows'

$ kubectl describe svc busyboxheadless
Name:              busyboxheadless
Namespace:         default
Labels:            <none>
Annotations:       danm.k8s.io/clusterNetwork: datanw
                   danm.k8s.io/selector: {"identity": "busyboxpod" }
                   kubectl.kubernetes.io/last-applied-configuration:
                     {"apiVersion":"v1","kind":"Service","metadata":{"annotations":{"danm.k8s.io/clusterNetwork":"datanw","danm.k8s.io/selector":"{\"identity\"...
Selector:          <none>
Type:              ClusterIP
IP:                None
Port:              danmnetdataport  7001/TCP
TargetPort:        7001/TCP
Endpoints:         10.211.21.102:7001
Session Affinity:  None
Events:            <none>

output of "ip a s" inside pod shows both IPv4 and IPv6 address to pod additional interface.

$ kubectl exec -it busybox sh
/ # ip a s
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host
       valid_lft forever preferred_lft forever
3: eth0@if3125: <BROADCAST,MULTICAST,UP,LOWER_UP,M-DOWN> mtu 1450 qdisc noqueue
    link/ether d2:04:77:d2:c0:8d brd ff:ff:ff:ff:ff:ff
    inet 10.244.2.224/24 brd 10.244.2.255 scope global eth0
       valid_lft forever preferred_lft forever
3126: az1@if3122: <BROADCAST,MULTICAST,UP,LOWER_UP,M-DOWN> mtu 1500 qdisc noqueue
    link/ether bc:97:e1:28:9e:a0 brd ff:ff:ff:ff:ff:ff
    inet 10.211.21.102/24 brd 10.211.21.255 scope global az1
       valid_lft forever preferred_lft forever
    inet6 2001:db8:aaaa:bbbb:f816:3eff:fe5d:da96/64 scope global
       valid_lft forever preferred_lft forever
    inet6 fe80::bc97:e100:128:9ea0/64 scope link
       valid_lft forever preferred_lft forever

What you expected to happen:

Service mapping should happen to both IPv4 and IPv6 address

How to reproduce it:

Deploy Pod using Danm networks giving both IPv4 and IPv6 address and deploy k8s headless service to select the pod

Anything else we need to know?:

Environment:

Levovar commented 4 years ago

@sriramec Akraino is running DANM 4.1, while this functionality was added by PR: https://github.com/nokia/danm/pull/187; and subsequently only released with DANM 4.2

With 4.2 it works as intended:

[cloudadmin@controller-1 ~]$ kubectl exec internal-processor-set-0 ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host
       valid_lft forever preferred_lft forever
3: eth0@if217: <BROADCAST,MULTICAST,UP,LOWER_UP,M-DOWN> mtu 8950 qdisc noqueue
    link/ether ba:1e:f7:20:84:46 brd ff:ff:ff:ff:ff:ff
    inet 10.244.1.186/24 brd 10.244.1.255 scope global eth0
       valid_lft forever preferred_lft forever
218: int1@if7: <BROADCAST,MULTICAST,UP,LOWER_UP,M-DOWN> mtu 9000 qdisc noqueue
    link/ether 24:8a:07:8e:d0:b4 brd ff:ff:ff:ff:ff:ff
    inet 10.240.1.100/24 brd 10.240.1.255 scope global int1
       valid_lft forever preferred_lft forever
    inet6 2001:db8::3f:fffa/64 scope global flags 02
       valid_lft forever preferred_lft forever
    inet6 fe80::248a:700:18e:d0b4/64 scope link
       valid_lft forever preferred_lft forever
[cloudadmin@controller-1 ~]$ kubectl describe service vnf-internal-processor-sset-danm
Name:              vnf-internal-processor-sset-danm
Namespace:         default
Labels:            <none>
Annotations:       danm.k8s.io/clusterNetwork: internal
                   danm.k8s.io/selector: {"app":"internal-processor-set"}
Selector:          <none>
Type:              ClusterIP
IP:                None
Port:              zeromq  5555/TCP
TargetPort:        5555/TCP
Endpoints:         10.240.1.100:5555,[2001:db8::3f:fffa]:5555
Session Affinity:  None
Events:            <none>

Upgrade to latest release, and functionality will work