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 2019-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 | |
| 7 | {{ tuple "accelleran-cu" . | include "accelleran-cu.service_account" }} |
| 8 | |
| 9 | --- |
| 10 | apiVersion: apps/v1 |
| 11 | kind: StatefulSet |
| 12 | metadata: |
| 13 | name: accelleran-cu |
| 14 | labels: |
| 15 | {{ tuple "accelleran-cu" . | include "accelleran-cu.metadata_labels" | indent 4 }} |
| 16 | spec: |
| 17 | replicas: {{ .Values.config.vran.replicas }} |
| 18 | selector: |
| 19 | matchLabels: |
| 20 | {{ tuple "accelleran-cu" . | include "accelleran-cu.metadata_labels" | indent 6 }} |
| 21 | serviceName: "accelleran-cu" |
| 22 | template: |
| 23 | metadata: |
| 24 | labels: |
| 25 | {{ tuple "accelleran-cu" . | include "accelleran-cu.metadata_labels" | indent 8 }} |
| 26 | spec: |
| 27 | terminationGracePeriodSeconds: 1 |
| 28 | {{- if .Values.nodeSelectors.enabled }} |
| 29 | nodeSelector: |
| 30 | {{ .Values.nodeSelectors.accelleranCU.label }}: {{ .Values.nodeSelectors.accelleranCU.value }} |
| 31 | {{- end }} |
| 32 | serviceAccountName: accelleran-cu |
| 33 | initContainers: |
| 34 | - name: cu-init |
| 35 | image: {{ .Values.images.tags.initCU }} |
| 36 | imagePullPolicy: {{ .Values.images.pullPolicy }} |
| 37 | securityContext: |
| 38 | privileged: true |
| 39 | runAsUser: 0 |
| 40 | command: [ "sh", "-c"] |
| 41 | args: |
| 42 | - > |
| 43 | iptables -I OUTPUT -p icmp --icmp-type destination-unreachable -j DROP; |
| 44 | if chroot /mnt/host-rootfs modinfo nf_conntrack_proto_sctp > /dev/null 2>&1; then \ |
| 45 | chroot /mnt/host-rootfs modprobe nf_conntrack_proto_sctp; \ |
| 46 | fi; \ |
| 47 | volumeMounts: |
| 48 | - name: host-rootfs |
| 49 | mountPath: /mnt/host-rootfs |
| 50 | containers: |
| 51 | - name: nats |
| 52 | image: {{ .Values.images.tags.nats }} |
| 53 | imagePullPolicy: {{ .Values.images.pullPolicy }} |
| 54 | securityContext: |
| 55 | capabilities: |
| 56 | add: |
| 57 | - NET_ADMIN |
| 58 | - IPC_LOCK |
| 59 | stdin: true |
| 60 | tty: true |
| 61 | env: |
| 62 | - name: NATS_SERVICE_NAME |
| 63 | value: {{ .Values.config.nats.serviceName }} |
| 64 | command: [ "sh", "-c"] |
| 65 | args: |
| 66 | - gnatsd -DV -c /etc/gnatsd.conf; |
| 67 | {{- if .Values.resources.enabled }} |
| 68 | resources: |
| 69 | {{ toYaml .Values.resources.accelleranCU | indent 10 }} |
| 70 | {{- end }} |
| 71 | - name: redis |
| 72 | image: {{ .Values.images.tags.redis }} |
| 73 | imagePullPolicy: {{ .Values.images.pullPolicy }} |
| 74 | securityContext: |
| 75 | capabilities: |
| 76 | add: |
| 77 | - NET_ADMIN |
| 78 | - IPC_LOCK |
| 79 | stdin: true |
| 80 | tty: true |
| 81 | command: ["sh", "-c"] |
| 82 | args: |
| 83 | # FIXME: Redis can't support with dns resolution, can't set hostname at here. |
| 84 | - (sleep 5; redis-cli -h localhost -p {{ .Values.config.vran.ports.redis.port }} set NATS_SERVICE_URL "nat://{{ .Values.config.nats.ip }}:{{ .Values.config.vran.ports.nats.port }}";) & |
| 85 | /usr/local/bin/redis-server |
| 86 | {{- if .Values.resources.enabled }} |
| 87 | resources: |
| 88 | {{ toYaml .Values.resources.accelleranCU | indent 10 }} |
| 89 | {{- end }} |
| 90 | - name: vran-l3 |
| 91 | image: {{ .Values.images.tags.vranL3 }} |
| 92 | imagePullPolicy: {{ .Values.images.pullPolicy }} |
| 93 | securityContext: |
| 94 | capabilities: |
| 95 | add: |
| 96 | - NET_ADMIN |
| 97 | - IPC_LOCK |
| 98 | - SYS_NICE |
| 99 | stdin: true |
| 100 | tty: true |
| 101 | env: |
| 102 | - name: MME_IP |
| 103 | value: {{ .Values.config.mme.ip }} |
| 104 | command: ["sh", "-c"] |
| 105 | args: |
| 106 | - sqlite3 /mnt/app/datastore.db "update cellS1apConfig set enbSctpPort={{ .Values.config.vran.ports.s1ap.port }};"; |
| 107 | sqlite3 /mnt/app/datastoreRemRw.db "update FapServiceFapControlLteGateway set S1SigLinkPort={{ .Values.config.mme.s1apPort }};"; |
| 108 | sqlite3 /mnt/app/datastoreRemRw.db "update FapServiceCellConfigLteEpcPlmnList set PLMNID={{ .Values.config.epc.plmnId }};"; |
| 109 | sqlite3 /mnt/app/datastore.db "insert into enbSctpSocketInterface ('interfaceName') values ('{{ .Values.config.vran.socketInterface }}');"; |
| 110 | sqlite3 /mnt/app/datastore.db "update logging set severity=7 where id=25;"; |
| 111 | {{- if .Values.config.progran.enabled }} |
| 112 | sqlite3 /mnt/app/datastore.db "update featureActivation set mmeSlicingEnabled=1;"; |
| 113 | sqlite3 /mnt/app/datastore.db "update featureActivation set ranSlicingEnabled=1;"; |
| 114 | sqlite3 /mnt/app/datastore.db "insert into pranServerAddress (pranServerIpAddress,pranServerPort) values ('{{ .Values.config.progran.ip }}', {{ .Values.config.progran.port }});"; |
| 115 | {{- end}} |
| 116 | sleep 10; |
| 117 | /l3/l3start; |
| 118 | volumeMounts: |
| 119 | - name: bbu-config |
| 120 | mountPath: /mnt/app/bootstrap.txt |
| 121 | subPath: bootstrap.txt |
| 122 | {{- if .Values.resources.enabled }} |
| 123 | resources: |
| 124 | {{ toYaml .Values.resources.accelleranCU | indent 10 }} |
| 125 | {{- end }} |
| 126 | volumes: |
| 127 | - name: bbu-config |
| 128 | configMap: |
| 129 | name: accelleran-cu-config |
| 130 | items: |
| 131 | - key: bootstrap.txt |
| 132 | path: bootstrap.txt |
| 133 | - name: host-rootfs |
| 134 | hostPath: |
| 135 | path: / |