blob: 71bcd47faa77f3f7c086f02505db779c5392c0ab [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---
Matteo Scandolodec3f272019-02-04 13:57:35 -080031apiVersion: v1
32kind: Service
33metadata:
34 name: ngic-dp-external
35spec:
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 Chen450a98a2019-01-15 16:56:30 -080044apiVersion: apps/v1
45kind: StatefulSet
46metadata:
Wei-Yu Chen450a98a2019-01-15 16:56:30 -080047 name: ngic-dp
48 labels:
49 app: ngic-dp
50spec:
51 replicas: {{ .Values.ngic_dp.replicas }}
52 selector:
53 matchLabels:
54 app: ngic-dp
55 serviceName: "ngic-dp"
56 template:
57 metadata:
Wei-Yu Chen450a98a2019-01-15 16:56:30 -080058 labels:
59 app: ngic-dp
60 annotations:
61 k8s.v1.cni.cncf.io/networks: '[
62 { "name": "s1u-net", "interface": "s1u-net", "namespace": "default" },
63 { "name": "sgi-net", "interface": "sgi-net", "namespace": "default" }
64 ]'
65 spec:
66 initContainers:
67 - name: init-iptables
68 image: {{ .Values.ngic_dp.images.init }}
69 command: [ "sh", "-c"]
70 securityContext:
71 capabilities:
72 add:
73 - NET_ADMIN
74 args:
75 - iptables -I OUTPUT -p icmp --icmp-type destination-unreachable -j DROP;
76 terminationGracePeriodSeconds: 1
77 containers:
78 - name: ngic
79 image: {{ .Values.ngic_dp.images.dp }}
80 imagePullPolicy: IfNotPresent
81 stdin: true
82 tty: true
83 env:
84 - name: RTR_SGI_IP
85 value: {{ .Values.ngic_dp.config.rtr_sgi_ip }}
86 - name: SGI_MASK
87 value: {{ .Values.ngic_dp.config.sgi_mask }}
88 - name: MEM_LIMIT
89 valueFrom:
90 resourceFieldRef:
91 containerName: ngic
92 resource: limits.memory
93 divisor: 1Mi
Wei-Yu Chenda76c322019-01-18 13:31:55 -080094 command: [ "bash", "-xc"]
95 args:
Wei-Yu Chenb92af452019-01-31 12:08:19 -080096 - ip addr show;
Wei-Yu Chen353512d2019-01-30 13:28:48 -080097 ifconfig;
Wei-Yu Chen9e5e0462019-01-18 16:58:10 -080098 . /opt/ngic/config/dp_config.cfg;
99 ./ngic_dataplane $EAL_ARGS -- $APP_ARGS
Wei-Yu Chen450a98a2019-01-15 16:56:30 -0800100 volumeMounts:
101 - name: config-volume
102 mountPath: /opt/ngic/config
103 {{- if .Values.ngic_dp.config.hugepage_enabled}}
104 - name: hugepage
105 mountPath: /dev/hugepages
106 {{- end}}
107 - name: shared-data
108 mountPath: /opt/ngic/config/shared
109 {{- if .Values.ngic_dp.config.dpdk_enabled}}
110 - name: sriov-volume
111 mountPath: /sriov-cni
112 - name: vfio-volume
113 mountPath: /dev/vfio
114 {{- end}}
115 resources:
116 limits:
Wei-Yu Chen4182f962019-01-24 15:47:39 -0800117 {{- if .Values.ngic_dp.config.hugepage_enabled}}
Wei-Yu Chen450a98a2019-01-15 16:56:30 -0800118 hugepages-1Gi: {{ .Values.ngic_dp.resources.hugepage }}
Wei-Yu Chen4182f962019-01-24 15:47:39 -0800119 {{- end}}
Wei-Yu Chen450a98a2019-01-15 16:56:30 -0800120 cpu: {{ .Values.ngic_dp.resources.cpu }}
121 memory: {{ .Values.ngic_dp.resources.mem }}
122 intel.com/sriov: '2'
123 securityContext:
124 {{- if .Values.ngic_dp.config.dpdk_enabled}}
125 privileged: true
126 {{- else}}
127 capabilities:
128 add:
129 - NET_ADMIN
130 - IPC_LOCK
131 {{- end}}
132 volumes:
133 - name: config-volume
134 configMap:
135 name: ngicdp-config
Wei-Yu Chen4182f962019-01-24 15:47:39 -0800136 {{- if .Values.ngic_dp.config.hugepage_enabled}}
Wei-Yu Chen450a98a2019-01-15 16:56:30 -0800137 - name: hugepage
138 emptyDir:
139 medium: HugePages
140 {{- end}}
141 - name: shared-data
142 emptyDir: {}
143 {{- if .Values.ngic_dp.config.dpdk_enabled}}
144 - name: sriov-volume
145 hostPath:
146 path: /var/lib/cni/sriov
147 type: Directory
148 - name: vfio-volume
149 hostPath:
150 path: /dev/vfio
151 type: Directory
152 {{- end}}