blob: 6b4f845150b091beba22760bce45cf0b7d93ea9f [file] [log] [blame]
Hyunsun Moon06f98552019-08-15 13:44:47 -06001{{/*
2Copyright 2018-present Open Networking Foundation
3Copyright 2018 Intel Corporation
4
5Licensed under the Apache License, Version 2.0 (the "License");
6you may not use this file except in compliance with the License.
7You may obtain a copy of the License at
8
9http://www.apache.org/licenses/LICENSE-2.0
10
11Unless required by applicable law or agreed to in writing, software
12distributed under the License is distributed on an "AS IS" BASIS,
13WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14See the License for the specific language governing permissions and
15limitations under the License.
16*/}}
Hyunsun Moona24d3f92019-06-19 03:04:58 -050017---
18apiVersion: apps/v1
19kind: StatefulSet
20metadata:
Hyunsun Moon06f98552019-08-15 13:44:47 -060021 name: spgwu
Hyunsun Moona24d3f92019-06-19 03:04:58 -050022 labels:
Hyunsun Moon06f98552019-08-15 13:44:47 -060023{{ tuple "spgwu" . | include "mcord-services.metadata_labels" | indent 4 }}
Hyunsun Moona24d3f92019-06-19 03:04:58 -050024spec:
25 replicas: 1
26 selector:
27 matchLabels:
Hyunsun Moon06f98552019-08-15 13:44:47 -060028{{ tuple "spgwu" . | include "mcord-services.metadata_labels" | indent 6 }}
29 serviceName: spgwu
Hyunsun Moona24d3f92019-06-19 03:04:58 -050030 template:
31 metadata:
32 labels:
Hyunsun Moon06f98552019-08-15 13:44:47 -060033{{ tuple "spgwu" . | include "mcord-services.metadata_labels" | indent 8 }}
Hyunsun Moona24d3f92019-06-19 03:04:58 -050034 annotations:
35 k8s.v1.cni.cncf.io/networks: '[
Hyunsun Moon06f98552019-08-15 13:44:47 -060036 { "name": "s1u-net", "interface": "s1u-net" },
37 { "name": "sgi-net", "interface": "sgi-net" }
Hyunsun Moona24d3f92019-06-19 03:04:58 -050038 ]'
39 spec:
Hyunsun Moon06f98552019-08-15 13:44:47 -060040 {{- if .Values.nodeSelectors.enabled }}
Woojoong Kim314d57c2019-07-09 17:08:11 -070041 nodeSelector:
Hyunsun Moon06f98552019-08-15 13:44:47 -060042 {{ .Values.nodeSelectors.spgwu.label }}: {{ .Values.nodeSelectors.spgwu.value }}
43 {{- end }}
44 {{- if not .Values.networks.sriov.enabled }}
Hyunsun Moona24d3f92019-06-19 03:04:58 -050045 initContainers:
46 - name: spgwu-iptables-init
Hyunsun Moon06f98552019-08-15 13:44:47 -060047 image: {{ .Values.images.tags.init | quote }}
48 imagePullPolicy: {{ .Values.images.pullPolicy | quote }}
Hyunsun Moona24d3f92019-06-19 03:04:58 -050049 command: [ "sh", "-xec"]
50 securityContext:
51 capabilities:
52 add:
53 - NET_ADMIN
54 args:
55 - iptables -I OUTPUT -p icmp --icmp-type destination-unreachable -j DROP;
56 - name: spgwu-af-iface-init
Hyunsun Moon06f98552019-08-15 13:44:47 -060057 image: {{ .Values.images.tags.init | quote }}
58 imagePullPolicy: {{ .Values.images.pullPolicy | quote }}
Hyunsun Moona24d3f92019-06-19 03:04:58 -050059 securityContext:
60 capabilities:
61 add:
62 - NET_ADMIN
63 command:
64 - /opt/dp/scripts/setup-af-iface.sh
65 volumeMounts:
66 - name: dp-script
67 mountPath: /opt/dp/scripts/setup-af-iface.sh
68 subPath: setup-af-iface.sh
Hyunsun Moon06f98552019-08-15 13:44:47 -060069 {{- end }}
Hyunsun Moona24d3f92019-06-19 03:04:58 -050070 containers:
Hyunsun Moon06f98552019-08-15 13:44:47 -060071 - name: spgwu
72 image: {{ .Values.images.tags.spgwu | quote }}
73 imagePullPolicy: {{ .Values.images.pullPolicy | quote }}
Hyunsun Moona24d3f92019-06-19 03:04:58 -050074 stdin: true
75 tty: true
76 env:
77 - name: MEM_LIMIT
78 valueFrom:
79 resourceFieldRef:
Hyunsun Moon06f98552019-08-15 13:44:47 -060080 containerName: spgwu
Hyunsun Moona24d3f92019-06-19 03:04:58 -050081 resource: limits.memory
82 divisor: 1Mi
83 - name: S1U_DEVNAME
Hyunsun Moon06f98552019-08-15 13:44:47 -060084 {{- if .Values.networks.sriov.enabled }}
Hyunsun Moona24d3f92019-06-19 03:04:58 -050085 value: s1u-net
Hyunsun Moon06f98552019-08-15 13:44:47 -060086 {{- else }}
87 value: {{ .Values.config.spgwu.dp.s1uAfDev | quote }}
88 {{- end }}
Hyunsun Moona24d3f92019-06-19 03:04:58 -050089 - name: SGI_DEVNAME
Hyunsun Moon06f98552019-08-15 13:44:47 -060090 {{- if .Values.networks.sriov.enabled }}
Hyunsun Moona24d3f92019-06-19 03:04:58 -050091 value: sgi-net
Hyunsun Moon06f98552019-08-15 13:44:47 -060092 {{- else }}
93 value: {{ .Values.config.spgwu.dp.sgiAfDev | quote }}
94 {{- end }}
Hyunsun Moona24d3f92019-06-19 03:04:58 -050095 - name: DEVICES
Hyunsun Moon06f98552019-08-15 13:44:47 -060096 value: {{ .Values.config.spgwu.dp.devices | quote }}
Hyunsun Moona24d3f92019-06-19 03:04:58 -050097 - name: CP_ADDR
Hyunsun Moon06f98552019-08-15 13:44:47 -060098 value: spgwc-0.spgwc
Hyunsun Moona24d3f92019-06-19 03:04:58 -050099 - name: DP_ADDR
100 valueFrom:
101 fieldRef:
102 fieldPath: status.podIP
103 - name: RTR_SGI_IP
Hyunsun Moon06f98552019-08-15 13:44:47 -0600104 value: {{ .Values.config.spgwu.dp.rtrSgiIp | quote }}
Hyunsun Moona24d3f92019-06-19 03:04:58 -0500105 - name: SGI_MASK
Hyunsun Moon06f98552019-08-15 13:44:47 -0600106 value: {{ .Values.config.spgwu.dp.sgiMask | quote }}
Hyunsun Moona24d3f92019-06-19 03:04:58 -0500107 command: ["bash", "-xc"]
108 args:
109 - ip a;
Hyunsun Moon06f98552019-08-15 13:44:47 -0600110 /opt/dp/scripts/run.sh;
Hyunsun Moona24d3f92019-06-19 03:04:58 -0500111 volumeMounts:
112 - name: dp-script
Hyunsun Moon06f98552019-08-15 13:44:47 -0600113 mountPath: /opt/dp/scripts/run.sh
114 subPath: run.sh
Hyunsun Moona24d3f92019-06-19 03:04:58 -0500115 - name: dp-config
116 mountPath: /etc/dp/config
Hyunsun Moona24d3f92019-06-19 03:04:58 -0500117 resources:
Hyunsun Moon06f98552019-08-15 13:44:47 -0600118 requests:
119 {{- if .Values.resources.enabled }}
120{{ toYaml .Values.resources.spgwu.requests | indent 12 }}
121 {{- end }}
122 {{- if .Values.networks.sriov.enabled }}
Woojoong Kime455aab2019-07-12 10:53:43 -0700123 intel.com/sriov_vfio: 2
Hyunsun Moon06f98552019-08-15 13:44:47 -0600124 {{- end }}
125 limits:
126 {{- if .Values.resources.enabled }}
127{{ toYaml .Values.resources.spgwu.limits | indent 12 }}
128 {{- end }}
129 {{- if .Values.networks.sriov.enabled }}
130 intel.com/sriov_vfio: 2
131 {{- end }}
Hyunsun Moona24d3f92019-06-19 03:04:58 -0500132 securityContext:
133 capabilities:
134 add:
135 - IPC_LOCK
136 volumes:
137 - name: dp-script
138 configMap:
Hyunsun Moon06f98552019-08-15 13:44:47 -0600139 name: spgwu
Hyunsun Moona24d3f92019-06-19 03:04:58 -0500140 defaultMode: 493
141 - name: dp-config
142 configMap:
Hyunsun Moon06f98552019-08-15 13:44:47 -0600143 name: spgwu
Hyunsun Moona24d3f92019-06-19 03:04:58 -0500144 defaultMode: 420