apiVersion: v1
kind: Pod
metadata:
  name: sriov-pod-1
  annotations:
    k8s.v1.cni.cncf.io/networks: sriov-net-a, sriov-net-b
spec:
  containers:
  - name: sriov-example
    image: dpdk-app-centos:latest
    imagePullPolicy: Never
    securityContext:
      capabilities:
        add: ["IPC_LOCK"]
    volumeMounts:
    - mountPath: /etc/podnetinfo
      name: podnetinfo
      readOnly: false
    - mountPath: /dev/hugepages
      name: hugepage
    resources:
      requests:
        memory: 1Gi
        hugepages-1Gi: 2Gi
        #hugepages-2Mi: 2048Mi
        #cpu: "4"
        intel.com/intel_sriov_dpdk_a: '1'
        intel.com/intel_sriov_dpdk_b: '1'
      limits:
        memory: 1Gi
        hugepages-1Gi: 2Gi
        #hugepages-2Mi: 2048Mi
        #cpu: "4"
        intel.com/intel_sriov_dpdk_a: '1'
        intel.com/intel_sriov_dpdk_b: '1'
    # Uncomment to control which DPDK App is running in container.
    # If not provided, l3fwd is default.
    #   Options: l2fwd l3fwd testpmd
    #env:
    #- name: DPDK_SAMPLE_APP
    #  value: "l2fwd"
    #
    # Uncomment to debug DPDK App or to run manually to change
    # DPDK command line options.
    #command: ["sleep", "infinity"]
  volumes:
  - name: podnetinfo
    downwardAPI:
      items:
        - path: "labels"
          fieldRef:
            fieldPath: metadata.labels
        - path: "annotations"
          fieldRef:
            fieldPath: metadata.annotations
        # Exposing Hugepages via Downward API is an alpha feature in
        # Kubernetes 1.20. If K8s is greater than or equal to 1.20 and
        # and Feature Gate is enabled (FEATURE_GATES="DownwardAPIHugePages=true"),
        # then uncomment the 1G or 2M Hugepage sections below.
        #
        # 1G Hugepages
        #- path: "hugepages_request"
        #  resourceFieldRef:
        #    containerName: sriov-example
        #    resource: requests.hugepages-1Gi
        #    divisor: 1Mi
        #- path: "hugepages_limit"
        #  resourceFieldRef:
        #    containerName: sriov-example
        #    resource: limits.hugepages-1Gi
        #    divisor: 1Mi
        #
        # 2M Hugepages
        #- path: "hugepages_request"
        #  resourceFieldRef:
        #    containerName: sriov-example
        #    resource: requests.hugepages-2Mi
        #    divisor: 1Mi
        #- path: "hugepages_limit"
        #  resourceFieldRef:
        #    containerName: sriov-example
        #    resource: limits.hugepages-2Mi
        #    divisor: 1Mi
  - name: hugepage
    emptyDir:
      medium: HugePages
