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