blob: 31431e9882b47dc103c15f71e5defbbf2a9ef5a9 [file] [log] [blame]
Woojoong Kimfdaa7732019-10-08 10:08:25 -07001{{/*
2Copyright 2019-present Open Networking Foundation
3
4Licensed under the Apache License, Version 2.0 (the "License");
5you may not use this file except in compliance with the License.
6You may obtain a copy of the License at
7
8http://www.apache.org/licenses/LICENSE-2.0
9
10Unless required by applicable law or agreed to in writing, software
11distributed under the License is distributed on an "AS IS" BASIS,
12WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13See the License for the specific language governing permissions and
14limitations under the License.
15*/}}
16
17{{ tuple "accelleran-cu" . | include "accelleran-cu.service_account" }}
18
19---
20apiVersion: apps/v1
21kind: StatefulSet
22metadata:
23 name: accelleran-cu
24 labels:
25{{ tuple "accelleran-cu" . | include "accelleran-cu.metadata_labels" | indent 4 }}
26spec:
27 replicas: {{ .Values.config.vran.replicas }}
28 selector:
29 matchLabels:
30{{ tuple "accelleran-cu" . | include "accelleran-cu.metadata_labels" | indent 6 }}
31 serviceName: "accelleran-cu"
32 template:
33 metadata:
34 labels:
35{{ tuple "accelleran-cu" . | include "accelleran-cu.metadata_labels" | indent 8 }}
36 spec:
37 terminationGracePeriodSeconds: 1
38 {{- if .Values.nodeSelectors.enabled }}
39 nodeSelector:
40 {{ .Values.nodeSelectors.accelleranCU.label }}: {{ .Values.nodeSelectors.accelleranCU.value }}
41 {{- end }}
42 serviceAccountName: accelleran-cu
43 initContainers:
44 - name: cu-init
45 image: {{ .Values.images.tags.initCU }}
46 imagePullPolicy: {{ .Values.images.pullPolicy }}
47 securityContext:
48 privileged: true
49 runAsUser: 0
50 command: [ "sh", "-c"]
51 args:
52 - >
53 iptables -I OUTPUT -p icmp --icmp-type destination-unreachable -j DROP;
54 if chroot /mnt/host-rootfs modinfo nf_conntrack_proto_sctp > /dev/null 2>&1; then \
55 chroot /mnt/host-rootfs modprobe nf_conntrack_proto_sctp; \
56 fi; \
57 volumeMounts:
58 - name: host-rootfs
59 mountPath: /mnt/host-rootfs
60 containers:
61 - name: nats
62 image: {{ .Values.images.tags.nats }}
63 imagePullPolicy: {{ .Values.images.pullPolicy }}
64 securityContext:
65 capabilities:
66 add:
67 - NET_ADMIN
68 - IPC_LOCK
69 stdin: true
70 tty: true
71 env:
72 - name: NATS_SERVICE_NAME
73 value: {{ .Values.config.nats.serviceName }}
74 command: [ "sh", "-c"]
75 args:
76 - gnatsd -DV -c /etc/gnatsd.conf;
77 {{- if .Values.resources.enabled }}
78 resources:
79{{ toYaml .Values.resources.accelleranCU | indent 10 }}
80 {{- end }}
81 - name: redis
82 image: {{ .Values.images.tags.redis }}
83 imagePullPolicy: {{ .Values.images.pullPolicy }}
84 securityContext:
85 capabilities:
86 add:
87 - NET_ADMIN
88 - IPC_LOCK
89 stdin: true
90 tty: true
91 command: ["sh", "-c"]
92 args:
93 # FIXME: Redis can't support with dns resolution, can't set hostname at here.
94 - (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 }}";) &
95 /usr/local/bin/redis-server
96 {{- if .Values.resources.enabled }}
97 resources:
98{{ toYaml .Values.resources.accelleranCU | indent 10 }}
99 {{- end }}
100 - name: vran-l3
101 image: {{ .Values.images.tags.vranL3 }}
102 imagePullPolicy: {{ .Values.images.pullPolicy }}
103 securityContext:
104 capabilities:
105 add:
106 - NET_ADMIN
107 - IPC_LOCK
108 - SYS_NICE
109 stdin: true
110 tty: true
111 env:
112 - name: MME_IP
113 value: {{ .Values.config.mme.ip }}
114 command: ["sh", "-c"]
115 args:
116 - sqlite3 /mnt/app/datastore.db "update cellS1apConfig set enbSctpPort={{ .Values.config.vran.ports.s1ap.port }};";
117 sqlite3 /mnt/app/datastoreRemRw.db "update FapServiceFapControlLteGateway set S1SigLinkPort={{ .Values.config.mme.s1apPort }};";
118 sqlite3 /mnt/app/datastoreRemRw.db "update FapServiceCellConfigLteEpcPlmnList set PLMNID={{ .Values.config.epc.plmnId }};";
119 sqlite3 /mnt/app/datastore.db "insert into enbSctpSocketInterface ('interfaceName') values ('{{ .Values.config.vran.socketInterface }}');";
120 sqlite3 /mnt/app/datastore.db "update logging set severity=7 where id=25;";
121{{- if .Values.config.progran.enabled }}
122 sqlite3 /mnt/app/datastore.db "update featureActivation set mmeSlicingEnabled=1;";
123 sqlite3 /mnt/app/datastore.db "update featureActivation set ranSlicingEnabled=1;";
124 sqlite3 /mnt/app/datastore.db "insert into pranServerAddress (pranServerIpAddress,pranServerPort) values ('{{ .Values.config.progran.ip }}', {{ .Values.config.progran.port }});";
125{{- end}}
126 sleep 10;
127 /l3/l3start;
128 volumeMounts:
129 - name: bbu-config
130 mountPath: /mnt/app/bootstrap.txt
131 subPath: bootstrap.txt
132 {{- if .Values.resources.enabled }}
133 resources:
134{{ toYaml .Values.resources.accelleranCU | indent 10 }}
135 {{- end }}
136 volumes:
137 - name: bbu-config
138 configMap:
139 name: accelleran-cu-config
140 items:
141 - key: bootstrap.txt
142 path: bootstrap.txt
143 - name: host-rootfs
144 hostPath:
145 path: /