blob: 3564458579fa0ce804c12f6a247634ee79179d40 [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:
Wei-Yu Chen450a98a2019-01-15 16:56:30 -080020 name: ngic-dp
21spec:
22 selector:
23 app: ngic-dp
24 clusterIP: None
25 ports:
26 - name: sx
27 port: {{ .Values.ngic_dp.ports.sx }}
28 protocol: UDP
29---
30apiVersion: apps/v1
31kind: StatefulSet
32metadata:
Wei-Yu Chen450a98a2019-01-15 16:56:30 -080033 name: ngic-dp
34 labels:
35 app: ngic-dp
36spec:
37 replicas: {{ .Values.ngic_dp.replicas }}
38 selector:
39 matchLabels:
40 app: ngic-dp
41 serviceName: "ngic-dp"
42 template:
43 metadata:
Wei-Yu Chen450a98a2019-01-15 16:56:30 -080044 labels:
45 app: ngic-dp
46 annotations:
47 k8s.v1.cni.cncf.io/networks: '[
48 { "name": "s1u-net", "interface": "s1u-net", "namespace": "default" },
49 { "name": "sgi-net", "interface": "sgi-net", "namespace": "default" }
50 ]'
51 spec:
52 initContainers:
53 - name: init-iptables
54 image: {{ .Values.ngic_dp.images.init }}
55 command: [ "sh", "-c"]
56 securityContext:
57 capabilities:
58 add:
59 - NET_ADMIN
60 args:
61 - iptables -I OUTPUT -p icmp --icmp-type destination-unreachable -j DROP;
62 terminationGracePeriodSeconds: 1
63 containers:
64 - name: ngic
65 image: {{ .Values.ngic_dp.images.dp }}
66 imagePullPolicy: IfNotPresent
67 stdin: true
68 tty: true
69 env:
70 - name: RTR_SGI_IP
71 value: {{ .Values.ngic_dp.config.rtr_sgi_ip }}
72 - name: SGI_MASK
73 value: {{ .Values.ngic_dp.config.sgi_mask }}
74 - name: MEM_LIMIT
75 valueFrom:
76 resourceFieldRef:
77 containerName: ngic
78 resource: limits.memory
79 divisor: 1Mi
Wei-Yu Chenda76c322019-01-18 13:31:55 -080080 command: [ "bash", "-xc"]
81 args:
82 - ifconfig -a; ifconfig lo down;
83 - . /opt/ngic/config/dp_config.cfg;
84 - ./ngic_dataplane $EAL_ARGS -- $APP_ARGS
Wei-Yu Chen450a98a2019-01-15 16:56:30 -080085 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}}