Wei-Yu Chen | 450a98a | 2019-01-15 16:56:30 -0800 | [diff] [blame] | 1 | --- |
Wei-Yu Chen | 53aec36 | 2019-01-18 16:30:33 -0800 | [diff] [blame] | 2 | # Copyright 2018-present Open Networking Foundation |
| 3 | # Copyright 2018 Intel Corporation |
Wei-Yu Chen | 450a98a | 2019-01-15 16:56:30 -0800 | [diff] [blame] | 4 | # |
| 5 | # Licensed under the Apache License, Version 2.0 (the "License"); |
| 6 | # you may not use this file except in compliance with the License. |
| 7 | # You may obtain a copy of the License at |
| 8 | # |
| 9 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 10 | # |
| 11 | # Unless required by applicable law or agreed to in writing, software |
| 12 | # distributed under the License is distributed on an "AS IS" BASIS, |
| 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 14 | # See the License for the specific language governing permissions and |
| 15 | # limitations under the License. |
| 16 | |
| 17 | --- |
| 18 | apiVersion: v1 |
| 19 | kind: Service |
| 20 | metadata: |
Wei-Yu Chen | 450a98a | 2019-01-15 16:56:30 -0800 | [diff] [blame] | 21 | name: ngic-dp |
| 22 | spec: |
| 23 | selector: |
| 24 | app: ngic-dp |
| 25 | clusterIP: None |
| 26 | ports: |
| 27 | - name: sx |
| 28 | port: {{ .Values.ngic_dp.ports.sx }} |
| 29 | protocol: UDP |
| 30 | --- |
| 31 | apiVersion: apps/v1 |
| 32 | kind: StatefulSet |
| 33 | metadata: |
Wei-Yu Chen | 450a98a | 2019-01-15 16:56:30 -0800 | [diff] [blame] | 34 | name: ngic-dp |
| 35 | labels: |
| 36 | app: ngic-dp |
| 37 | spec: |
| 38 | replicas: {{ .Values.ngic_dp.replicas }} |
| 39 | selector: |
| 40 | matchLabels: |
| 41 | app: ngic-dp |
| 42 | serviceName: "ngic-dp" |
| 43 | template: |
| 44 | metadata: |
Wei-Yu Chen | 450a98a | 2019-01-15 16:56:30 -0800 | [diff] [blame] | 45 | labels: |
| 46 | app: ngic-dp |
| 47 | annotations: |
| 48 | k8s.v1.cni.cncf.io/networks: '[ |
| 49 | { "name": "s1u-net", "interface": "s1u-net", "namespace": "default" }, |
| 50 | { "name": "sgi-net", "interface": "sgi-net", "namespace": "default" } |
| 51 | ]' |
| 52 | spec: |
| 53 | initContainers: |
| 54 | - name: init-iptables |
| 55 | image: {{ .Values.ngic_dp.images.init }} |
| 56 | command: [ "sh", "-c"] |
| 57 | securityContext: |
| 58 | capabilities: |
| 59 | add: |
| 60 | - NET_ADMIN |
| 61 | args: |
| 62 | - iptables -I OUTPUT -p icmp --icmp-type destination-unreachable -j DROP; |
| 63 | terminationGracePeriodSeconds: 1 |
| 64 | containers: |
| 65 | - name: ngic |
| 66 | image: {{ .Values.ngic_dp.images.dp }} |
| 67 | imagePullPolicy: IfNotPresent |
| 68 | stdin: true |
| 69 | tty: true |
| 70 | env: |
| 71 | - name: RTR_SGI_IP |
| 72 | value: {{ .Values.ngic_dp.config.rtr_sgi_ip }} |
| 73 | - name: SGI_MASK |
| 74 | value: {{ .Values.ngic_dp.config.sgi_mask }} |
| 75 | - name: MEM_LIMIT |
| 76 | valueFrom: |
| 77 | resourceFieldRef: |
| 78 | containerName: ngic |
| 79 | resource: limits.memory |
| 80 | divisor: 1Mi |
Wei-Yu Chen | da76c32 | 2019-01-18 13:31:55 -0800 | [diff] [blame] | 81 | command: [ "bash", "-xc"] |
| 82 | args: |
Wei-Yu Chen | 4182f96 | 2019-01-24 15:47:39 -0800 | [diff] [blame] | 83 | - ifconfig lo down; |
| 84 | ifconfig -a; |
Wei-Yu Chen | 9e5e046 | 2019-01-18 16:58:10 -0800 | [diff] [blame] | 85 | . /opt/ngic/config/dp_config.cfg; |
| 86 | ./ngic_dataplane $EAL_ARGS -- $APP_ARGS |
Wei-Yu Chen | 450a98a | 2019-01-15 16:56:30 -0800 | [diff] [blame] | 87 | volumeMounts: |
| 88 | - name: config-volume |
| 89 | mountPath: /opt/ngic/config |
| 90 | {{- if .Values.ngic_dp.config.hugepage_enabled}} |
| 91 | - name: hugepage |
| 92 | mountPath: /dev/hugepages |
| 93 | {{- end}} |
| 94 | - name: shared-data |
| 95 | mountPath: /opt/ngic/config/shared |
| 96 | {{- if .Values.ngic_dp.config.dpdk_enabled}} |
| 97 | - name: sriov-volume |
| 98 | mountPath: /sriov-cni |
| 99 | - name: vfio-volume |
| 100 | mountPath: /dev/vfio |
| 101 | {{- end}} |
| 102 | resources: |
| 103 | limits: |
Wei-Yu Chen | 4182f96 | 2019-01-24 15:47:39 -0800 | [diff] [blame] | 104 | {{- if .Values.ngic_dp.config.hugepage_enabled}} |
Wei-Yu Chen | 450a98a | 2019-01-15 16:56:30 -0800 | [diff] [blame] | 105 | hugepages-1Gi: {{ .Values.ngic_dp.resources.hugepage }} |
Wei-Yu Chen | 4182f96 | 2019-01-24 15:47:39 -0800 | [diff] [blame] | 106 | {{- end}} |
Wei-Yu Chen | 450a98a | 2019-01-15 16:56:30 -0800 | [diff] [blame] | 107 | cpu: {{ .Values.ngic_dp.resources.cpu }} |
| 108 | memory: {{ .Values.ngic_dp.resources.mem }} |
| 109 | intel.com/sriov: '2' |
| 110 | securityContext: |
| 111 | {{- if .Values.ngic_dp.config.dpdk_enabled}} |
| 112 | privileged: true |
| 113 | {{- else}} |
| 114 | capabilities: |
| 115 | add: |
| 116 | - NET_ADMIN |
| 117 | - IPC_LOCK |
| 118 | {{- end}} |
| 119 | volumes: |
| 120 | - name: config-volume |
| 121 | configMap: |
| 122 | name: ngicdp-config |
Wei-Yu Chen | 4182f96 | 2019-01-24 15:47:39 -0800 | [diff] [blame] | 123 | {{- if .Values.ngic_dp.config.hugepage_enabled}} |
Wei-Yu Chen | 450a98a | 2019-01-15 16:56:30 -0800 | [diff] [blame] | 124 | - name: hugepage |
| 125 | emptyDir: |
| 126 | medium: HugePages |
| 127 | {{- end}} |
| 128 | - name: shared-data |
| 129 | emptyDir: {} |
| 130 | {{- if .Values.ngic_dp.config.dpdk_enabled}} |
| 131 | - name: sriov-volume |
| 132 | hostPath: |
| 133 | path: /var/lib/cni/sriov |
| 134 | type: Directory |
| 135 | - name: vfio-volume |
| 136 | hostPath: |
| 137 | path: /dev/vfio |
| 138 | type: Directory |
| 139 | {{- end}} |