blob: 4038394989ea3570282e829bcf77cdfa797711ae [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 }}
Wei-Yu Chenec8a2d72019-02-12 14:36:10 -080052
Wei-Yu Chen450a98a2019-01-15 16:56:30 -080053 selector:
54 matchLabels:
55 app: ngic-dp
56 serviceName: "ngic-dp"
57 template:
58 metadata:
Wei-Yu Chen450a98a2019-01-15 16:56:30 -080059 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 Chenec8a2d72019-02-12 14:36:10 -080067 nodeSelector:
68 kubernetes.io/hostname: "node3"
Wei-Yu Chen450a98a2019-01-15 16:56:30 -080069 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 Chenda76c322019-01-18 13:31:55 -080097 command: [ "bash", "-xc"]
98 args:
Wei-Yu Chenb92af452019-01-31 12:08:19 -080099 - ip addr show;
Wei-Yu Chen353512d2019-01-30 13:28:48 -0800100 ifconfig;
Wei-Yu Chen9e5e0462019-01-18 16:58:10 -0800101 . /opt/ngic/config/dp_config.cfg;
102 ./ngic_dataplane $EAL_ARGS -- $APP_ARGS
Wei-Yu Chen450a98a2019-01-15 16:56:30 -0800103 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 Chen4182f962019-01-24 15:47:39 -0800120 {{- if .Values.ngic_dp.config.hugepage_enabled}}
Wei-Yu Chen450a98a2019-01-15 16:56:30 -0800121 hugepages-1Gi: {{ .Values.ngic_dp.resources.hugepage }}
Wei-Yu Chen4182f962019-01-24 15:47:39 -0800122 {{- end}}
Wei-Yu Chen450a98a2019-01-15 16:56:30 -0800123 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 Chen4182f962019-01-24 15:47:39 -0800139 {{- if .Values.ngic_dp.config.hugepage_enabled}}
Wei-Yu Chen450a98a2019-01-15 16:56:30 -0800140 - 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}}