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 | --- |
Matteo Scandolo | dec3f27 | 2019-02-04 13:57:35 -0800 | [diff] [blame] | 31 | apiVersion: v1 |
| 32 | kind: Service |
| 33 | metadata: |
| 34 | name: ngic-dp-external |
| 35 | spec: |
| 36 | selector: |
| 37 | app: ngic-dp |
| 38 | type: NodePort |
| 39 | ports: |
| 40 | - port: {{ .Values.ngic_dp.ports.sx }} |
| 41 | nodePort: {{ .Values.ngic_dp.ports.sx_external }} |
| 42 | protocol: UDP |
| 43 | --- |
Wei-Yu Chen | 450a98a | 2019-01-15 16:56:30 -0800 | [diff] [blame] | 44 | apiVersion: apps/v1 |
| 45 | kind: StatefulSet |
| 46 | metadata: |
Wei-Yu Chen | 450a98a | 2019-01-15 16:56:30 -0800 | [diff] [blame] | 47 | name: ngic-dp |
| 48 | labels: |
| 49 | app: ngic-dp |
| 50 | spec: |
| 51 | replicas: {{ .Values.ngic_dp.replicas }} |
Wei-Yu Chen | ec8a2d7 | 2019-02-12 14:36:10 -0800 | [diff] [blame] | 52 | |
Wei-Yu Chen | 450a98a | 2019-01-15 16:56:30 -0800 | [diff] [blame] | 53 | selector: |
| 54 | matchLabels: |
| 55 | app: ngic-dp |
| 56 | serviceName: "ngic-dp" |
| 57 | template: |
| 58 | metadata: |
Wei-Yu Chen | 450a98a | 2019-01-15 16:56:30 -0800 | [diff] [blame] | 59 | labels: |
| 60 | app: ngic-dp |
| 61 | annotations: |
| 62 | k8s.v1.cni.cncf.io/networks: '[ |
| 63 | { "name": "s1u-net", "interface": "s1u-net", "namespace": "default" }, |
| 64 | { "name": "sgi-net", "interface": "sgi-net", "namespace": "default" } |
| 65 | ]' |
| 66 | spec: |
Wei-Yu Chen | ec8a2d7 | 2019-02-12 14:36:10 -0800 | [diff] [blame] | 67 | nodeSelector: |
| 68 | kubernetes.io/hostname: "node3" |
Wei-Yu Chen | 450a98a | 2019-01-15 16:56:30 -0800 | [diff] [blame] | 69 | initContainers: |
| 70 | - name: init-iptables |
| 71 | image: {{ .Values.ngic_dp.images.init }} |
| 72 | command: [ "sh", "-c"] |
| 73 | securityContext: |
| 74 | capabilities: |
| 75 | add: |
| 76 | - NET_ADMIN |
| 77 | args: |
| 78 | - iptables -I OUTPUT -p icmp --icmp-type destination-unreachable -j DROP; |
| 79 | terminationGracePeriodSeconds: 1 |
| 80 | containers: |
| 81 | - name: ngic |
| 82 | image: {{ .Values.ngic_dp.images.dp }} |
| 83 | imagePullPolicy: IfNotPresent |
| 84 | stdin: true |
| 85 | tty: true |
| 86 | env: |
| 87 | - name: RTR_SGI_IP |
| 88 | value: {{ .Values.ngic_dp.config.rtr_sgi_ip }} |
| 89 | - name: SGI_MASK |
| 90 | value: {{ .Values.ngic_dp.config.sgi_mask }} |
| 91 | - name: MEM_LIMIT |
| 92 | valueFrom: |
| 93 | resourceFieldRef: |
| 94 | containerName: ngic |
| 95 | resource: limits.memory |
| 96 | divisor: 1Mi |
Wei-Yu Chen | da76c32 | 2019-01-18 13:31:55 -0800 | [diff] [blame] | 97 | command: [ "bash", "-xc"] |
| 98 | args: |
Wei-Yu Chen | b92af45 | 2019-01-31 12:08:19 -0800 | [diff] [blame] | 99 | - ip addr show; |
Wei-Yu Chen | 353512d | 2019-01-30 13:28:48 -0800 | [diff] [blame] | 100 | ifconfig; |
Wei-Yu Chen | 9e5e046 | 2019-01-18 16:58:10 -0800 | [diff] [blame] | 101 | . /opt/ngic/config/dp_config.cfg; |
| 102 | ./ngic_dataplane $EAL_ARGS -- $APP_ARGS |
Wei-Yu Chen | 450a98a | 2019-01-15 16:56:30 -0800 | [diff] [blame] | 103 | volumeMounts: |
| 104 | - name: config-volume |
| 105 | mountPath: /opt/ngic/config |
| 106 | {{- if .Values.ngic_dp.config.hugepage_enabled}} |
| 107 | - name: hugepage |
| 108 | mountPath: /dev/hugepages |
| 109 | {{- end}} |
| 110 | - name: shared-data |
| 111 | mountPath: /opt/ngic/config/shared |
| 112 | {{- if .Values.ngic_dp.config.dpdk_enabled}} |
| 113 | - name: sriov-volume |
| 114 | mountPath: /sriov-cni |
| 115 | - name: vfio-volume |
| 116 | mountPath: /dev/vfio |
| 117 | {{- end}} |
| 118 | resources: |
| 119 | limits: |
Wei-Yu Chen | 4182f96 | 2019-01-24 15:47:39 -0800 | [diff] [blame] | 120 | {{- if .Values.ngic_dp.config.hugepage_enabled}} |
Wei-Yu Chen | 450a98a | 2019-01-15 16:56:30 -0800 | [diff] [blame] | 121 | hugepages-1Gi: {{ .Values.ngic_dp.resources.hugepage }} |
Wei-Yu Chen | 4182f96 | 2019-01-24 15:47:39 -0800 | [diff] [blame] | 122 | {{- end}} |
Wei-Yu Chen | 450a98a | 2019-01-15 16:56:30 -0800 | [diff] [blame] | 123 | cpu: {{ .Values.ngic_dp.resources.cpu }} |
| 124 | memory: {{ .Values.ngic_dp.resources.mem }} |
| 125 | intel.com/sriov: '2' |
| 126 | securityContext: |
| 127 | {{- if .Values.ngic_dp.config.dpdk_enabled}} |
| 128 | privileged: true |
| 129 | {{- else}} |
| 130 | capabilities: |
| 131 | add: |
| 132 | - NET_ADMIN |
| 133 | - IPC_LOCK |
| 134 | {{- end}} |
| 135 | volumes: |
| 136 | - name: config-volume |
| 137 | configMap: |
| 138 | name: ngicdp-config |
Wei-Yu Chen | 4182f96 | 2019-01-24 15:47:39 -0800 | [diff] [blame] | 139 | {{- if .Values.ngic_dp.config.hugepage_enabled}} |
Wei-Yu Chen | 450a98a | 2019-01-15 16:56:30 -0800 | [diff] [blame] | 140 | - name: hugepage |
| 141 | emptyDir: |
| 142 | medium: HugePages |
| 143 | {{- end}} |
| 144 | - name: shared-data |
| 145 | emptyDir: {} |
| 146 | {{- if .Values.ngic_dp.config.dpdk_enabled}} |
| 147 | - name: sriov-volume |
| 148 | hostPath: |
| 149 | path: /var/lib/cni/sriov |
| 150 | type: Directory |
| 151 | - name: vfio-volume |
| 152 | hostPath: |
| 153 | path: /dev/vfio |
| 154 | type: Directory |
| 155 | {{- end}} |