---
apiVersion: v1
kind: Namespace
metadata:
  name: fpp-sample-iperf3
---
apiVersion: apps/v1
kind: StatefulSet
metadata:
  name: iperf3-client
  namespace: fpp-sample-iperf3
spec:
  podManagementPolicy: Parallel
  replicas: 1
  selector:
    matchLabels:
      name: iperf3-client
  updateStrategy:
    type: RollingUpdate
  serviceName: iperf3-client
  template:
    metadata:
      annotations:
        k8s.v1.cni.cncf.io/networks: iperf3-client
      labels:
        name: iperf3-client
        vppswitch-workload: ""
    spec:
      # this tries to place the client and the server on different nodes
      affinity:
        podAntiAffinity:
          preferredDuringSchedulingIgnoredDuringExecution:
          - weight: 99
            podAffinityTerm:
              labelSelector:
                matchExpressions:
                - key: vppswitch-workload
                  operator: In
                  values:
                  - iperf3
              topologyKey: kubernetes.io/hostname
      containers:
      - name: iperf3-client
        command: ["/bin/sh"]
        tty: true
        stdin: true
        image: mlabbe/iperf3:3.9-r1@sha256:31cbf5d6a22e4a78a66897572116ac9821fe3abec688ff3af9d2f9d7e40c32d2
        imagePullPolicy: IfNotPresent
        securityContext:
          privileged: true
      nodeSelector:
        fpp-manager.cennso.com/vppswitch: ""
---
apiVersion: apps/v1
kind: StatefulSet
metadata:
  name: iperf3-server
  namespace: fpp-sample-iperf3
spec:
  podManagementPolicy: Parallel
  replicas: 1
  selector:
    matchLabels:
      name: iperf3-server
  updateStrategy:
    type: RollingUpdate
  serviceName: iperf3-server
  template:
    metadata:
      annotations:
        k8s.v1.cni.cncf.io/networks: iperf3-server
      labels:
        name: iperf3-server
        vppswitch-workload: iperf3
    spec:
      # this tries to place the client and the server on different nodes
      affinity:
        podAntiAffinity:
          preferredDuringSchedulingIgnoredDuringExecution:
          - weight: 99
            podAffinityTerm:
              labelSelector:
                matchExpressions:
                - key: vppswitch-workload
                  operator: In
                  values:
                  - iperf3
              topologyKey: kubernetes.io/hostname
      containers:
      - name: iperf3-server
        command: ["iperf3", "-s"]
        image: mlabbe/iperf3:3.9-r1@sha256:31cbf5d6a22e4a78a66897572116ac9821fe3abec688ff3af9d2f9d7e40c32d2
        imagePullPolicy: IfNotPresent
      nodeSelector:
        fpp-manager.cennso.com/vppswitch: ""
---
---
apiVersion: k8s.cni.cncf.io/v1
kind: NetworkAttachmentDefinition
metadata:
  name: iperf3-server
  namespace: fpp-sample-iperf3
spec:
  config: |-
    {
      "cniVersion": "0.3.0",
      "ipam": {
        "addresses": [
          {
            "address": "10.0.0.1/24"
          }
        ],
        "type": "static"
      },
      "mtu": 9000,
      "name": "tst",
      "type": "fpp-cni",
      "vni": 1,
      "vppIfaceType": "tap"
    }
---
apiVersion: k8s.cni.cncf.io/v1
kind: NetworkAttachmentDefinition
metadata:
  name: iperf3-client
  namespace: fpp-sample-iperf3
spec:
  config: |-
    {
      "cniVersion": "0.3.0",
      "ipam": {
        "addresses": [
          {
            "address": "10.0.0.2/24"
          }
        ],
        "type": "static"
      },
      "mtu": 9000,
      "name": "tst",
      "type": "fpp-cni",
      "vni": 1,
      "vppIfaceType": "tap"
    }
---
apiVersion: fpp-manager.cennso.com/v1alpha1
kind: VXLAN
metadata:
  labels:
    name: vxlan1
  name: vxlan1
  namespace: fpp-sample-iperf3
spec:
  vni: 1
