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