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 }}, |
| 32 | "ips": {{ .Values.config.upf.access.ip | quote }} |
Jeremy Ronquillo | 223db00 | 2020-06-05 10:28:22 -0700 | [diff] [blame] | 33 | }, |
| 34 | { |
Hyunsun Moon | 33d8531 | 2020-08-20 00:55:31 -0700 | [diff] [blame] | 35 | "name": "core-net", |
| 36 | "interface": {{ index $coreConfig "ifname" | quote }}, |
| 37 | "ips": {{ .Values.config.upf.core.ip | quote }} |
Jeremy Ronquillo | 223db00 | 2020-06-05 10:28:22 -0700 | [diff] [blame] | 38 | } |
| 39 | ]' |
| 40 | spec: |
| 41 | shareProcessNamespace: true |
| 42 | {{- if .Values.nodeSelectors.enabled }} |
| 43 | nodeSelector: |
Hyunsun Moon | 33d8531 | 2020-08-20 00:55:31 -0700 | [diff] [blame] | 44 | {{ .Values.nodeSelectors.upf.label }}: {{ .Values.nodeSelectors.upf.value }} |
Jeremy Ronquillo | 223db00 | 2020-06-05 10:28:22 -0700 | [diff] [blame] | 45 | {{- end }} |
Hyunsun Moon | 918f26b | 2020-06-11 13:16:39 -0700 | [diff] [blame] | 46 | initContainers: |
| 47 | - name: bess-init |
| 48 | image: {{ .Values.images.tags.bess | quote }} |
| 49 | imagePullPolicy: {{ .Values.images.pullPolicy | quote }} |
| 50 | command: ["sh", "-xec"] |
| 51 | args: |
Hyunsun Moon | 33d8531 | 2020-08-20 00:55:31 -0700 | [diff] [blame] | 52 | - ip route replace {{ .Values.config.upf.enb.subnet }} via {{ .Values.config.upf.access.gateway }}; |
| 53 | ip route replace default via {{ .Values.config.upf.core.gateway }} metric 110; |
Hyunsun Moon | 617dc05 | 2020-06-21 20:13:22 -0500 | [diff] [blame] | 54 | iptables -I OUTPUT -p icmp --icmp-type port-unreachable -j DROP; |
Hyunsun Moon | 918f26b | 2020-06-11 13:16:39 -0700 | [diff] [blame] | 55 | securityContext: |
| 56 | capabilities: |
| 57 | add: |
| 58 | - NET_ADMIN |
Jeremy Ronquillo | 223db00 | 2020-06-05 10:28:22 -0700 | [diff] [blame] | 59 | {{- if .Values.config.coreDump.enabled }} |
Hyunsun Moon | 33d8531 | 2020-08-20 00:55:31 -0700 | [diff] [blame] | 60 | {{ tuple "upf" . | include "omec-user-plane.coredump_init" | indent 8 }} |
Jeremy Ronquillo | 223db00 | 2020-06-05 10:28:22 -0700 | [diff] [blame] | 61 | {{- end }} |
| 62 | containers: |
Jeremy Ronquillo | 223db00 | 2020-06-05 10:28:22 -0700 | [diff] [blame] | 63 | - name: bessd |
| 64 | image: {{ .Values.images.tags.bess | quote }} |
| 65 | imagePullPolicy: {{ .Values.images.pullPolicy | quote }} |
| 66 | securityContext: |
Jeremy Ronquillo | 223db00 | 2020-06-05 10:28:22 -0700 | [diff] [blame] | 67 | capabilities: |
| 68 | add: |
| 69 | - IPC_LOCK |
Jeremy Ronquillo | 223db00 | 2020-06-05 10:28:22 -0700 | [diff] [blame] | 70 | stdin: true |
| 71 | tty: true |
Hyunsun Moon | 617dc05 | 2020-06-21 20:13:22 -0500 | [diff] [blame] | 72 | command: ["/bin/bash", "-xc"] |
| 73 | args: |
Hyunsun Moon | 33d8531 | 2020-08-20 00:55:31 -0700 | [diff] [blame] | 74 | {{- if .Values.config.upf.hugepage.enabled }} |
Hyunsun Moon | 617dc05 | 2020-06-21 20:13:22 -0500 | [diff] [blame] | 75 | - bessd -f -grpc-url=0.0.0.0:10514 |
| 76 | {{- else }} |
| 77 | - bessd -m 0 -f -grpc-url=0.0.0.0:10514 |
| 78 | {{- end }} |
Jeremy Ronquillo | 223db00 | 2020-06-05 10:28:22 -0700 | [diff] [blame] | 79 | lifecycle: |
| 80 | postStart: |
| 81 | exec: |
| 82 | command: ["/etc/bess/conf/bessd-poststart.sh"] |
| 83 | livenessProbe: |
| 84 | tcpSocket: |
| 85 | port: 10514 |
| 86 | initialDelaySeconds: 15 |
| 87 | periodSeconds: 20 |
| 88 | resources: |
| 89 | requests: |
| 90 | {{- if .Values.resources.enabled }} |
| 91 | {{ toYaml .Values.resources.bess.requests | indent 12 }} |
| 92 | {{- end }} |
Hyunsun Moon | 33d8531 | 2020-08-20 00:55:31 -0700 | [diff] [blame] | 93 | {{- if .Values.config.upf.hugepage.enabled }} |
Hyunsun Moon | 617dc05 | 2020-06-21 20:13:22 -0500 | [diff] [blame] | 94 | hugepages-1Gi: 2Gi |
| 95 | {{- end }} |
Hyunsun Moon | 33d8531 | 2020-08-20 00:55:31 -0700 | [diff] [blame] | 96 | {{- if .Values.config.upf.sriov.enabled }} |
| 97 | intel.com/sriov_vfio_access_net: 1 |
| 98 | intel.com/sriov_vfio_core_net: 1 |
Jeremy Ronquillo | 223db00 | 2020-06-05 10:28:22 -0700 | [diff] [blame] | 99 | {{- end }} |
| 100 | limits: |
| 101 | {{- if .Values.resources.enabled }} |
| 102 | {{ toYaml .Values.resources.bess.limits | indent 12 }} |
| 103 | {{- end }} |
Hyunsun Moon | 33d8531 | 2020-08-20 00:55:31 -0700 | [diff] [blame] | 104 | {{- if .Values.config.upf.hugepage.enabled }} |
Hyunsun Moon | 617dc05 | 2020-06-21 20:13:22 -0500 | [diff] [blame] | 105 | hugepages-1Gi: 2Gi |
| 106 | {{- end }} |
Hyunsun Moon | 33d8531 | 2020-08-20 00:55:31 -0700 | [diff] [blame] | 107 | {{- if .Values.config.upf.sriov.enabled }} |
| 108 | intel.com/sriov_vfio_access_net: 1 |
| 109 | intel.com/sriov_vfio_core_net: 1 |
Jeremy Ronquillo | 223db00 | 2020-06-05 10:28:22 -0700 | [diff] [blame] | 110 | {{- end }} |
| 111 | env: |
| 112 | - name: CONF_FILE |
Hyunsun Moon | d60fcaf | 2020-07-14 16:09:13 -0700 | [diff] [blame] | 113 | value: /etc/bess/conf/upf.json |
Jeremy Ronquillo | 223db00 | 2020-06-05 10:28:22 -0700 | [diff] [blame] | 114 | volumeMounts: |
Hyunsun Moon | 33d8531 | 2020-08-20 00:55:31 -0700 | [diff] [blame] | 115 | {{- if .Values.config.upf.hugepage.enabled }} |
Jeremy Ronquillo | 223db00 | 2020-06-05 10:28:22 -0700 | [diff] [blame] | 116 | - name: hugepages |
| 117 | mountPath: /dev/hugepages |
Hyunsun Moon | 617dc05 | 2020-06-21 20:13:22 -0500 | [diff] [blame] | 118 | {{- end }} |
Jeremy Ronquillo | 223db00 | 2020-06-05 10:28:22 -0700 | [diff] [blame] | 119 | - name: configs |
| 120 | mountPath: /etc/bess/conf |
| 121 | {{- if .Values.config.coreDump.enabled }} |
| 122 | - name: coredump |
| 123 | mountPath: /tmp/coredump |
| 124 | {{- end }} |
Hyunsun Moon | 918f26b | 2020-06-11 13:16:39 -0700 | [diff] [blame] | 125 | - name: routectl |
| 126 | image: {{ .Values.images.tags.bess | quote }} |
| 127 | imagePullPolicy: {{ .Values.images.pullPolicy | quote }} |
| 128 | env: |
| 129 | - name: PYTHONUNBUFFERED |
| 130 | value: "1" |
| 131 | command: ["/opt/bess/bessctl/conf/route_control.py"] |
| 132 | args: |
| 133 | - -i |
Hyunsun Moon | 33d8531 | 2020-08-20 00:55:31 -0700 | [diff] [blame] | 134 | - {{ index $accessConfig "ifname" }} |
| 135 | - {{ index $coreConfig "ifname" }} |
Hyunsun Moon | 918f26b | 2020-06-11 13:16:39 -0700 | [diff] [blame] | 136 | {{- if .Values.resources.enabled }} |
| 137 | resources: |
| 138 | {{ toYaml .Values.resources.routectl | indent 10 }} |
| 139 | {{- end }} |
Jeremy Ronquillo | 223db00 | 2020-06-05 10:28:22 -0700 | [diff] [blame] | 140 | - name: web |
| 141 | image: {{ .Values.images.tags.bess | quote }} |
| 142 | imagePullPolicy: {{ .Values.images.pullPolicy | quote }} |
| 143 | command: ["/bin/bash", "-xc", "bessctl http 0.0.0.0 8000"] |
| 144 | {{- if .Values.resources.enabled }} |
| 145 | resources: |
| 146 | {{ toYaml .Values.resources.web | indent 10 }} |
| 147 | {{- end }} |
| 148 | - name: cpiface |
Hyunsun Moon | 33d8531 | 2020-08-20 00:55:31 -0700 | [diff] [blame] | 149 | {{- if eq .Values.config.upf.cpiface.mode "zmq" }} |
Hyunsun Moon | d60fcaf | 2020-07-14 16:09:13 -0700 | [diff] [blame] | 150 | image: {{ .Values.images.tags.zmqiface | quote }} |
Jeremy Ronquillo | 223db00 | 2020-06-05 10:28:22 -0700 | [diff] [blame] | 151 | imagePullPolicy: {{ .Values.images.pullPolicy | quote }} |
| 152 | env: |
Jeremy Ronquillo | 223db00 | 2020-06-05 10:28:22 -0700 | [diff] [blame] | 153 | - name: GLOG_v |
| 154 | value: "1" |
| 155 | command: ["zmq-cpiface"] |
| 156 | args: |
Hyunsun Moon | d60fcaf | 2020-07-14 16:09:13 -0700 | [diff] [blame] | 157 | - --json_config |
| 158 | - /tmp/conf/upf.json |
| 159 | {{- else }} |
| 160 | image: {{ .Values.images.tags.pfcpiface | quote }} |
| 161 | imagePullPolicy: {{ .Values.images.pullPolicy | quote }} |
| 162 | command: ["pfcpiface"] |
| 163 | args: |
| 164 | - -config |
| 165 | - /tmp/conf/upf.json |
| 166 | {{- end }} |
Jeremy Ronquillo | 223db00 | 2020-06-05 10:28:22 -0700 | [diff] [blame] | 167 | {{- if .Values.resources.enabled }} |
| 168 | resources: |
| 169 | {{ toYaml .Values.resources.cpiface | indent 10 }} |
| 170 | {{- end }} |
Hyunsun Moon | d60fcaf | 2020-07-14 16:09:13 -0700 | [diff] [blame] | 171 | volumeMounts: |
| 172 | - name: configs |
| 173 | mountPath: /tmp/conf |
Jeremy Ronquillo | 223db00 | 2020-06-05 10:28:22 -0700 | [diff] [blame] | 174 | volumes: |
| 175 | - name: configs |
| 176 | configMap: |
Hyunsun Moon | 33d8531 | 2020-08-20 00:55:31 -0700 | [diff] [blame] | 177 | name: upf |
Jeremy Ronquillo | 223db00 | 2020-06-05 10:28:22 -0700 | [diff] [blame] | 178 | defaultMode: 493 |
Hyunsun Moon | 33d8531 | 2020-08-20 00:55:31 -0700 | [diff] [blame] | 179 | {{- if .Values.config.upf.hugepage.enabled }} |
Jeremy Ronquillo | 223db00 | 2020-06-05 10:28:22 -0700 | [diff] [blame] | 180 | - name: hugepages |
| 181 | emptyDir: |
| 182 | medium: HugePages |
Hyunsun Moon | 617dc05 | 2020-06-21 20:13:22 -0500 | [diff] [blame] | 183 | {{- end }} |
Jeremy Ronquillo | 223db00 | 2020-06-05 10:28:22 -0700 | [diff] [blame] | 184 | {{- if .Values.config.coreDump.enabled }} |
| 185 | - name: host-rootfs |
| 186 | hostPath: |
| 187 | path: / |
| 188 | - name: coredump |
| 189 | hostPath: |
| 190 | path: {{ .Values.config.coreDump.path }} |
| 191 | {{- end }} |