blob: 310697f9411596c3deafb36cd06b1aabbf678f8e [file] [log] [blame]
Wei-Yu Chen450a98a2019-01-15 16:56:30 -08001---
Wei-Yu Chen53aec362019-01-18 16:30:33 -08002# Copyright 2018-present Open Networking Foundation
3# Copyright 2018 Intel Corporation
Wei-Yu Chen450a98a2019-01-15 16:56:30 -08004#
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---
18apiVersion: v1
19kind: Service
20metadata:
Wei-Yu Chen450a98a2019-01-15 16:56:30 -080021 name: ngic-dp
22spec:
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---
31apiVersion: apps/v1
32kind: StatefulSet
33metadata:
Wei-Yu Chen450a98a2019-01-15 16:56:30 -080034 name: ngic-dp
35 labels:
36 app: ngic-dp
37spec:
38 replicas: {{ .Values.ngic_dp.replicas }}
39 selector:
40 matchLabels:
41 app: ngic-dp
42 serviceName: "ngic-dp"
43 template:
44 metadata:
Wei-Yu Chen450a98a2019-01-15 16:56:30 -080045 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 Chenda76c322019-01-18 13:31:55 -080081 command: [ "bash", "-xc"]
82 args:
83 - ifconfig -a; ifconfig lo down;
84 - . /opt/ngic/config/dp_config.cfg;
85 - ./ngic_dataplane $EAL_ARGS -- $APP_ARGS
Wei-Yu Chen450a98a2019-01-15 16:56:30 -080086 volumeMounts:
87 - name: config-volume
88 mountPath: /opt/ngic/config
89 {{- if .Values.ngic_dp.config.hugepage_enabled}}
90 - name: hugepage
91 mountPath: /dev/hugepages
92 {{- end}}
93 - name: shared-data
94 mountPath: /opt/ngic/config/shared
95 {{- if .Values.ngic_dp.config.dpdk_enabled}}
96 - name: sriov-volume
97 mountPath: /sriov-cni
98 - name: vfio-volume
99 mountPath: /dev/vfio
100 {{- end}}
101 resources:
102 limits:
103 hugepages-1Gi: {{ .Values.ngic_dp.resources.hugepage }}
104 cpu: {{ .Values.ngic_dp.resources.cpu }}
105 memory: {{ .Values.ngic_dp.resources.mem }}
106 intel.com/sriov: '2'
107 securityContext:
108 {{- if .Values.ngic_dp.config.dpdk_enabled}}
109 privileged: true
110 {{- else}}
111 capabilities:
112 add:
113 - NET_ADMIN
114 - IPC_LOCK
115 {{- end}}
116 volumes:
117 - name: config-volume
118 configMap:
119 name: ngicdp-config
120 {{- if .Values.ngic_dp.config.hugepage_enabled }}
121 - name: hugepage
122 emptyDir:
123 medium: HugePages
124 {{- end}}
125 - name: shared-data
126 emptyDir: {}
127 {{- if .Values.ngic_dp.config.dpdk_enabled}}
128 - name: sriov-volume
129 hostPath:
130 path: /var/lib/cni/sriov
131 type: Directory
132 - name: vfio-volume
133 hostPath:
134 path: /dev/vfio
135 type: Directory
136 {{- end}}