Jeremy Ronquillo | 223db00 | 2020-06-05 10:28:22 -0700 | [diff] [blame] | 1 | {{/* |
Jeremy Ronquillo | ec2d3e4 | 2020-06-05 11:33:39 -0700 | [diff] [blame] | 2 | # Copyright 2020-present Open Networking Foundation |
Jeremy Ronquillo | 223db00 | 2020-06-05 10:28:22 -0700 | [diff] [blame] | 3 | |
Jeremy Ronquillo | 6046ce3 | 2020-06-18 11:06:29 -0700 | [diff] [blame] | 4 | # SPDX-License-Identifier: LicenseRef-ONF-Member-Only-1.0 |
Jeremy Ronquillo | 223db00 | 2020-06-05 10:28:22 -0700 | [diff] [blame] | 5 | */}} |
| 6 | |
Hyunsun Moon | 33d8531 | 2020-08-20 00:55:31 -0700 | [diff] [blame] | 7 | {{- $upfConfig := index .Values.config.upf.cfgFiles "upf.json" }} |
| 8 | {{- $accessConfig := index $upfConfig "access" }} |
| 9 | {{- $coreConfig := index $upfConfig "core" }} |
Jeremy Ronquillo | 223db00 | 2020-06-05 10:28:22 -0700 | [diff] [blame] | 10 | --- |
| 11 | apiVersion: apps/v1 |
| 12 | kind: StatefulSet |
| 13 | metadata: |
Hyunsun Moon | 33d8531 | 2020-08-20 00:55:31 -0700 | [diff] [blame] | 14 | name: upf |
Jeremy Ronquillo | 223db00 | 2020-06-05 10:28:22 -0700 | [diff] [blame] | 15 | labels: |
Hyunsun Moon | 33d8531 | 2020-08-20 00:55:31 -0700 | [diff] [blame] | 16 | {{ tuple "upf" . | include "omec-user-plane.metadata_labels" | indent 4 }} |
Jeremy Ronquillo | 223db00 | 2020-06-05 10:28:22 -0700 | [diff] [blame] | 17 | spec: |
| 18 | replicas: 1 |
Hyunsun Moon | 33d8531 | 2020-08-20 00:55:31 -0700 | [diff] [blame] | 19 | serviceName: upf-headless |
Jeremy Ronquillo | 223db00 | 2020-06-05 10:28:22 -0700 | [diff] [blame] | 20 | selector: |
| 21 | matchLabels: |
Hyunsun Moon | 33d8531 | 2020-08-20 00:55:31 -0700 | [diff] [blame] | 22 | {{ tuple "upf" . | include "omec-user-plane.metadata_labels" | indent 6 }} |
Jeremy Ronquillo | 223db00 | 2020-06-05 10:28:22 -0700 | [diff] [blame] | 23 | template: |
| 24 | metadata: |
| 25 | labels: |
Hyunsun Moon | 33d8531 | 2020-08-20 00:55:31 -0700 | [diff] [blame] | 26 | {{ tuple "upf" . | include "omec-user-plane.metadata_labels" | indent 8 }} |
Jeremy Ronquillo | 223db00 | 2020-06-05 10:28:22 -0700 | [diff] [blame] | 27 | annotations: |
| 28 | k8s.v1.cni.cncf.io/networks: '[ |
| 29 | { |
Hyunsun Moon | 33d8531 | 2020-08-20 00:55:31 -0700 | [diff] [blame] | 30 | "name": "access-net", |
| 31 | "interface": {{ index $accessConfig "ifname" | quote }}, |
Hyunsun Moon | 1905a6e | 2020-11-09 05:59:55 +0000 | [diff] [blame] | 32 | {{- if hasKey .Values.config.upf.access "mac" }} |
| 33 | "mac": {{ .Values.config.upf.access.mac | quote }}, |
| 34 | {{- end }} |
Hyunsun Moon | d457d18 | 2020-09-10 15:52:09 -0700 | [diff] [blame] | 35 | "ips": [{{ .Values.config.upf.access.ip | quote }}] |
Jeremy Ronquillo | 223db00 | 2020-06-05 10:28:22 -0700 | [diff] [blame] | 36 | }, |
| 37 | { |
Hyunsun Moon | 33d8531 | 2020-08-20 00:55:31 -0700 | [diff] [blame] | 38 | "name": "core-net", |
| 39 | "interface": {{ index $coreConfig "ifname" | quote }}, |
Hyunsun Moon | 1905a6e | 2020-11-09 05:59:55 +0000 | [diff] [blame] | 40 | {{- if hasKey .Values.config.upf.core "mac" }} |
| 41 | "mac": {{ .Values.config.upf.core.mac | quote }}, |
| 42 | {{- end }} |
Hyunsun Moon | d457d18 | 2020-09-10 15:52:09 -0700 | [diff] [blame] | 43 | "ips": [{{ .Values.config.upf.core.ip | quote }}] |
Jeremy Ronquillo | 223db00 | 2020-06-05 10:28:22 -0700 | [diff] [blame] | 44 | } |
| 45 | ]' |
| 46 | spec: |
| 47 | shareProcessNamespace: true |
| 48 | {{- if .Values.nodeSelectors.enabled }} |
| 49 | nodeSelector: |
Hyunsun Moon | 33d8531 | 2020-08-20 00:55:31 -0700 | [diff] [blame] | 50 | {{ .Values.nodeSelectors.upf.label }}: {{ .Values.nodeSelectors.upf.value }} |
Jeremy Ronquillo | 223db00 | 2020-06-05 10:28:22 -0700 | [diff] [blame] | 51 | {{- end }} |
Hyunsun Moon | e3500a8 | 2021-05-08 18:12:08 -0700 | [diff] [blame] | 52 | {{- if hasKey .Values.images "pullSecrets" }} |
Hyunsun Moon | 8da1788 | 2020-10-14 21:28:44 -0500 | [diff] [blame] | 53 | imagePullSecrets: |
Hyunsun Moon | e3500a8 | 2021-05-08 18:12:08 -0700 | [diff] [blame] | 54 | {{ toYaml .Values.images.pullSecrets | indent 8 }} |
Hyunsun Moon | 8da1788 | 2020-10-14 21:28:44 -0500 | [diff] [blame] | 55 | {{- end }} |
Hyunsun Moon | 918f26b | 2020-06-11 13:16:39 -0700 | [diff] [blame] | 56 | initContainers: |
| 57 | - name: bess-init |
| 58 | image: {{ .Values.images.tags.bess | quote }} |
| 59 | imagePullPolicy: {{ .Values.images.pullPolicy | quote }} |
| 60 | command: ["sh", "-xec"] |
| 61 | args: |
Hyunsun Moon | 33d8531 | 2020-08-20 00:55:31 -0700 | [diff] [blame] | 62 | - ip route replace {{ .Values.config.upf.enb.subnet }} via {{ .Values.config.upf.access.gateway }}; |
| 63 | ip route replace default via {{ .Values.config.upf.core.gateway }} metric 110; |
Hyunsun Moon | 617dc05 | 2020-06-21 20:13:22 -0500 | [diff] [blame] | 64 | iptables -I OUTPUT -p icmp --icmp-type port-unreachable -j DROP; |
Hyunsun Moon | 918f26b | 2020-06-11 13:16:39 -0700 | [diff] [blame] | 65 | securityContext: |
| 66 | capabilities: |
| 67 | add: |
| 68 | - NET_ADMIN |
Jeremy Ronquillo | 223db00 | 2020-06-05 10:28:22 -0700 | [diff] [blame] | 69 | {{- if .Values.config.coreDump.enabled }} |
Hyunsun Moon | 7f03a77 | 2020-09-27 23:23:50 -0500 | [diff] [blame] | 70 | {{ tuple "upf" . | include "omec-user-plane.coredump_init" | indent 6 }} |
Jeremy Ronquillo | 223db00 | 2020-06-05 10:28:22 -0700 | [diff] [blame] | 71 | {{- end }} |
| 72 | containers: |
Jeremy Ronquillo | 223db00 | 2020-06-05 10:28:22 -0700 | [diff] [blame] | 73 | - name: bessd |
| 74 | image: {{ .Values.images.tags.bess | quote }} |
| 75 | imagePullPolicy: {{ .Values.images.pullPolicy | quote }} |
| 76 | securityContext: |
Hyunsun Moon | 785d81b | 2020-11-06 05:56:21 +0000 | [diff] [blame] | 77 | {{- if .Values.config.upf.privileged }} |
| 78 | privileged: true |
| 79 | {{- end }} |
Jeremy Ronquillo | 223db00 | 2020-06-05 10:28:22 -0700 | [diff] [blame] | 80 | capabilities: |
| 81 | add: |
| 82 | - IPC_LOCK |
Jeremy Ronquillo | 223db00 | 2020-06-05 10:28:22 -0700 | [diff] [blame] | 83 | stdin: true |
| 84 | tty: true |
Hyunsun Moon | 617dc05 | 2020-06-21 20:13:22 -0500 | [diff] [blame] | 85 | command: ["/bin/bash", "-xc"] |
| 86 | args: |
Hyunsun Moon | 33d8531 | 2020-08-20 00:55:31 -0700 | [diff] [blame] | 87 | {{- if .Values.config.upf.hugepage.enabled }} |
Hyunsun Moon | 617dc05 | 2020-06-21 20:13:22 -0500 | [diff] [blame] | 88 | - bessd -f -grpc-url=0.0.0.0:10514 |
| 89 | {{- else }} |
| 90 | - bessd -m 0 -f -grpc-url=0.0.0.0:10514 |
| 91 | {{- end }} |
Jeremy Ronquillo | 223db00 | 2020-06-05 10:28:22 -0700 | [diff] [blame] | 92 | lifecycle: |
| 93 | postStart: |
| 94 | exec: |
| 95 | command: ["/etc/bess/conf/bessd-poststart.sh"] |
| 96 | livenessProbe: |
| 97 | tcpSocket: |
| 98 | port: 10514 |
| 99 | initialDelaySeconds: 15 |
| 100 | periodSeconds: 20 |
| 101 | resources: |
| 102 | requests: |
| 103 | {{- if .Values.resources.enabled }} |
| 104 | {{ toYaml .Values.resources.bess.requests | indent 12 }} |
| 105 | {{- end }} |
Hyunsun Moon | 33d8531 | 2020-08-20 00:55:31 -0700 | [diff] [blame] | 106 | {{- if .Values.config.upf.hugepage.enabled }} |
Hyunsun Moon | 617dc05 | 2020-06-21 20:13:22 -0500 | [diff] [blame] | 107 | hugepages-1Gi: 2Gi |
| 108 | {{- end }} |
Hyunsun Moon | 33d8531 | 2020-08-20 00:55:31 -0700 | [diff] [blame] | 109 | {{- if .Values.config.upf.sriov.enabled }} |
Hyunsun Moon | 6575f7e | 2021-05-19 16:55:42 -0700 | [diff] [blame] | 110 | intel.com/intel_sriov_vfio: 2 |
Jeremy Ronquillo | 223db00 | 2020-06-05 10:28:22 -0700 | [diff] [blame] | 111 | {{- end }} |
| 112 | limits: |
| 113 | {{- if .Values.resources.enabled }} |
| 114 | {{ toYaml .Values.resources.bess.limits | indent 12 }} |
| 115 | {{- end }} |
Hyunsun Moon | 33d8531 | 2020-08-20 00:55:31 -0700 | [diff] [blame] | 116 | {{- if .Values.config.upf.hugepage.enabled }} |
Hyunsun Moon | 617dc05 | 2020-06-21 20:13:22 -0500 | [diff] [blame] | 117 | hugepages-1Gi: 2Gi |
| 118 | {{- end }} |
Hyunsun Moon | 33d8531 | 2020-08-20 00:55:31 -0700 | [diff] [blame] | 119 | {{- if .Values.config.upf.sriov.enabled }} |
Hyunsun Moon | 6575f7e | 2021-05-19 16:55:42 -0700 | [diff] [blame] | 120 | intel.com/intel_sriov_vfio: 2 |
Jeremy Ronquillo | 223db00 | 2020-06-05 10:28:22 -0700 | [diff] [blame] | 121 | {{- end }} |
| 122 | env: |
| 123 | - name: CONF_FILE |
Hyunsun Moon | d60fcaf | 2020-07-14 16:09:13 -0700 | [diff] [blame] | 124 | value: /etc/bess/conf/upf.json |
Jeremy Ronquillo | 223db00 | 2020-06-05 10:28:22 -0700 | [diff] [blame] | 125 | volumeMounts: |
Hyunsun Moon | 33d8531 | 2020-08-20 00:55:31 -0700 | [diff] [blame] | 126 | {{- if .Values.config.upf.hugepage.enabled }} |
Jeremy Ronquillo | 223db00 | 2020-06-05 10:28:22 -0700 | [diff] [blame] | 127 | - name: hugepages |
| 128 | mountPath: /dev/hugepages |
Hyunsun Moon | 617dc05 | 2020-06-21 20:13:22 -0500 | [diff] [blame] | 129 | {{- end }} |
Jeremy Ronquillo | 223db00 | 2020-06-05 10:28:22 -0700 | [diff] [blame] | 130 | - name: configs |
| 131 | mountPath: /etc/bess/conf |
| 132 | {{- if .Values.config.coreDump.enabled }} |
| 133 | - name: coredump |
| 134 | mountPath: /tmp/coredump |
| 135 | {{- end }} |
Hyunsun Moon | 918f26b | 2020-06-11 13:16:39 -0700 | [diff] [blame] | 136 | - name: routectl |
| 137 | image: {{ .Values.images.tags.bess | quote }} |
| 138 | imagePullPolicy: {{ .Values.images.pullPolicy | quote }} |
| 139 | env: |
| 140 | - name: PYTHONUNBUFFERED |
| 141 | value: "1" |
| 142 | command: ["/opt/bess/bessctl/conf/route_control.py"] |
| 143 | args: |
| 144 | - -i |
Hyunsun Moon | 33d8531 | 2020-08-20 00:55:31 -0700 | [diff] [blame] | 145 | - {{ index $accessConfig "ifname" }} |
| 146 | - {{ index $coreConfig "ifname" }} |
Hyunsun Moon | 918f26b | 2020-06-11 13:16:39 -0700 | [diff] [blame] | 147 | {{- if .Values.resources.enabled }} |
| 148 | resources: |
| 149 | {{ toYaml .Values.resources.routectl | indent 10 }} |
| 150 | {{- end }} |
Jeremy Ronquillo | 223db00 | 2020-06-05 10:28:22 -0700 | [diff] [blame] | 151 | - name: web |
| 152 | image: {{ .Values.images.tags.bess | quote }} |
| 153 | imagePullPolicy: {{ .Values.images.pullPolicy | quote }} |
| 154 | command: ["/bin/bash", "-xc", "bessctl http 0.0.0.0 8000"] |
| 155 | {{- if .Values.resources.enabled }} |
| 156 | resources: |
| 157 | {{ toYaml .Values.resources.web | indent 10 }} |
| 158 | {{- end }} |
| 159 | - name: cpiface |
Hyunsun Moon | 33d8531 | 2020-08-20 00:55:31 -0700 | [diff] [blame] | 160 | {{- if eq .Values.config.upf.cpiface.mode "zmq" }} |
Hyunsun Moon | d60fcaf | 2020-07-14 16:09:13 -0700 | [diff] [blame] | 161 | image: {{ .Values.images.tags.zmqiface | quote }} |
Jeremy Ronquillo | 223db00 | 2020-06-05 10:28:22 -0700 | [diff] [blame] | 162 | imagePullPolicy: {{ .Values.images.pullPolicy | quote }} |
| 163 | env: |
Jeremy Ronquillo | 223db00 | 2020-06-05 10:28:22 -0700 | [diff] [blame] | 164 | - name: GLOG_v |
| 165 | value: "1" |
| 166 | command: ["zmq-cpiface"] |
| 167 | args: |
Hyunsun Moon | d60fcaf | 2020-07-14 16:09:13 -0700 | [diff] [blame] | 168 | - --json_config |
| 169 | - /tmp/conf/upf.json |
| 170 | {{- else }} |
| 171 | image: {{ .Values.images.tags.pfcpiface | quote }} |
| 172 | imagePullPolicy: {{ .Values.images.pullPolicy | quote }} |
| 173 | command: ["pfcpiface"] |
| 174 | args: |
| 175 | - -config |
| 176 | - /tmp/conf/upf.json |
| 177 | {{- end }} |
Jeremy Ronquillo | 223db00 | 2020-06-05 10:28:22 -0700 | [diff] [blame] | 178 | {{- if .Values.resources.enabled }} |
| 179 | resources: |
| 180 | {{ toYaml .Values.resources.cpiface | indent 10 }} |
| 181 | {{- end }} |
Hyunsun Moon | d60fcaf | 2020-07-14 16:09:13 -0700 | [diff] [blame] | 182 | volumeMounts: |
| 183 | - name: configs |
| 184 | mountPath: /tmp/conf |
Jeremy Ronquillo | 223db00 | 2020-06-05 10:28:22 -0700 | [diff] [blame] | 185 | volumes: |
| 186 | - name: configs |
| 187 | configMap: |
Hyunsun Moon | 33d8531 | 2020-08-20 00:55:31 -0700 | [diff] [blame] | 188 | name: upf |
Jeremy Ronquillo | 223db00 | 2020-06-05 10:28:22 -0700 | [diff] [blame] | 189 | defaultMode: 493 |
Hyunsun Moon | 33d8531 | 2020-08-20 00:55:31 -0700 | [diff] [blame] | 190 | {{- if .Values.config.upf.hugepage.enabled }} |
Jeremy Ronquillo | 223db00 | 2020-06-05 10:28:22 -0700 | [diff] [blame] | 191 | - name: hugepages |
| 192 | emptyDir: |
| 193 | medium: HugePages |
Hyunsun Moon | 617dc05 | 2020-06-21 20:13:22 -0500 | [diff] [blame] | 194 | {{- end }} |
Jeremy Ronquillo | 223db00 | 2020-06-05 10:28:22 -0700 | [diff] [blame] | 195 | {{- if .Values.config.coreDump.enabled }} |
| 196 | - name: host-rootfs |
| 197 | hostPath: |
| 198 | path: / |
| 199 | - name: coredump |
| 200 | hostPath: |
| 201 | path: {{ .Values.config.coreDump.path }} |
| 202 | {{- end }} |