blob: b57bf19f4945aac9a217895a42b262ae5d9b4025 [file] [log] [blame]
Wei-Yu Chen4182f962019-01-24 15:47:39 -08001---
2# Copyright 2018-present Open Networking Foundation
3# Copyright 2018 Intel Corporation
4#
5# Licensed under the Apache License, Version 2.0 (the "License");
6# you may not use this file except in compliance with the License.
7# You may obtain a copy of the License at
8#
9# http://www.apache.org/licenses/LICENSE-2.0
10#
11# Unless required by applicable law or agreed to in writing, software
12# distributed under the License is distributed on an "AS IS" BASIS,
13# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14# See the License for the specific language governing permissions and
15# limitations under the License.
16
17---
18apiVersion: v1
19kind: Service
20metadata:
21 name: accelleran
22spec:
23 selector:
24 app: accelleran
Pingping Lin79f84702019-02-05 18:38:40 -080025 clusterIP: None
Wei-Yu Chen4182f962019-01-24 15:47:39 -080026 ports:
27 - name: s1ap
28 port: {{ .Values.accelleran.ports.s1ap }}
Wei-Yu Chenec8a2d72019-02-12 14:36:10 -080029 protocol: SCTP
Matteo Scandolodec3f272019-02-04 13:57:35 -080030---
31apiVersion: v1
32kind: Service
33metadata:
Pingping Lin79f84702019-02-05 18:38:40 -080034 name: accelleran-external
Matteo Scandolodec3f272019-02-04 13:57:35 -080035spec:
36 selector:
Wei-Yu Chenec8a2d72019-02-12 14:36:10 -080037 app: accelleran
Matteo Scandolodec3f272019-02-04 13:57:35 -080038 type: NodePort
39 ports:
40 - port: {{ .Values.accelleran.ports.s1ap }}
Pingping Lin79f84702019-02-05 18:38:40 -080041 nodePort: {{ .Values.accelleran.ports.s1ap_external }}
Wei-Yu Chenec8a2d72019-02-12 14:36:10 -080042 protocol: SCTP
Wei-Yu Chen4182f962019-01-24 15:47:39 -080043---
44apiVersion: apps/v1
45kind: StatefulSet
46metadata:
47 name: accelleran
48 labels:
49 app: accelleran
50spec:
51 replicas: {{ .Values.accelleran.replicas }}
52 selector:
53 matchLabels:
54 app: accelleran
55 serviceName: "accelleran"
56 template:
57 metadata:
58 labels:
59 app: accelleran
60 annotations:
61 k8s.v1.cni.cncf.io/networks: '[
62 { "name": "bbu-net", "interface": "vbbu-net", "namespace": "default" }
63 ]'
64 spec:
Wei-Yu Chenec8a2d72019-02-12 14:36:10 -080065 nodeSelector:
66 kubernetes.io/hostname: "node2"
Wei-Yu Chen4182f962019-01-24 15:47:39 -080067 initContainers:
68 - name: init-iptables
69 image: {{ .Values.accelleran.images.init }}
70 command: [ "sh", "-c"]
71 args:
72 - iptables -I OUTPUT -p icmp --icmp-type destination-unreachable -j DROP;
73 securityContext:
74 capabilities:
75 add:
76 - NET_ADMIN
77 terminationGracePeriodSeconds: 1
78 containers:
79 - name: nats
80 image: {{ .Values.accelleran.images.nats }}
81 imagePullPolicy: IfNotPresent
82 stdin: true
83 tty: true
84 env:
85 - name: NATS_SERVICE_NAME
86 value: {{ .Values.accelleran.nats_service_name }}
87 command: [ "sh", "-c"]
88 args:
89 - gnatsd -DV -c /etc/gnatsd.conf;
90 resources:
91 limits:
92 cpu: {{ .Values.accelleran.resources.cpu }}
93 memory: {{ .Values.accelleran.resources.mem }}
94 intel.com/sriov: '2'
95 securityContext:
96 capabilities:
97 add:
98 - NET_ADMIN
99 - IPC_LOCK
100 - name: redis
101 image: {{ .Values.accelleran.images.redis }}
102 imagePullPolicy: IfNotPresent
103 stdin: true
104 tty: true
105 command: ["sh", "-c"]
106 args:
107 # FIXME: Redis can't support with dns resolution, can't set hostname at here.
Wei-Yu Chen353512d2019-01-30 13:28:48 -0800108 - (sleep 5; redis-cli -h localhost -p 6379 set NATS_SERVICE_URL "nat://$(ip route get 116 | awk '{print $NF;exit}'):4222";) &
Wei-Yu Chen4182f962019-01-24 15:47:39 -0800109 /usr/local/bin/redis-server
110 resources:
111 limits:
112 cpu: {{ .Values.accelleran.resources.cpu }}
113 memory: {{ .Values.accelleran.resources.mem }}
114 intel.com/sriov: '2'
115 securityContext:
116 capabilities:
117 add:
118 - NET_ADMIN
119 - IPC_LOCK
120 - name: bbu
121 image: {{ .Values.accelleran.images.bbu }}
Wei-Yu Chenb92af452019-01-31 12:08:19 -0800122 imagePullPolicy: Always
Wei-Yu Chen4182f962019-01-24 15:47:39 -0800123 env:
Wei-Yu Chenb92af452019-01-31 12:08:19 -0800124 - name: MME_IP
125 value: {{ .Values.mme_hostname }}
Wei-Yu Chen4182f962019-01-24 15:47:39 -0800126 stdin: true
127 tty: true
128 command: ["sh", "-c"]
Wei-Yu Chenec8a2d72019-02-12 14:36:10 -0800129 # Configure BBU SCTP source port to `s1ap_external`, MME endpoint port to `mme_port` and configure BBU to use
Wei-Yu Chen4182f962019-01-24 15:47:39 -0800130 args:
Wei-Yu Chenec8a2d72019-02-12 14:36:10 -0800131 - sqlite3 /mnt/app/datastore.db "update cellS1apConfig set enbSctpPort={{ .Values.accelleran.ports.s1ap_external }};";
132 sqlite3 /mnt/app/datastoreRemRw.db "update FapServiceFapControlLteGateway set S1SigLinkPort={{ .Values.mme_port }};";
133 sqlite3 /mnt/app/datastore.db "insert into enbSctpSocketInterface ('interfaceName') values ('eth0');";
Pingping Lina5cc6b82019-02-13 10:36:43 -0800134 sqlite3 /mnt/app/datastore.db "update logging set severity=7 where id=25;";
135 sqlite3 /mnt/app/datastore.db "update featureActivation set mmeSlicingEnabled=1;";
136 sqlite3 /mnt/app/datastore.db "update featureActivation set ranSlicingEnabled=1;";
Pingping Lin476bdc62019-02-15 11:02:14 -0800137 sqlite3 /mnt/app/datastore.db "insert into pranServerAddress (pranServerIpAddress,pranServerPort) values ('{{ .Values.progran_ip }}', {{ .Values.progran_port }});";
Pingping Lina5cc6b82019-02-13 10:36:43 -0800138
Wei-Yu Chen4182f962019-01-24 15:47:39 -0800139 sleep 10;
140 /l3/l3start;
141 volumeMounts:
142 - name: bbu-config
143 mountPath: /mnt/app/bootstrap.txt
144 subPath: bootstrap.txt
145 resources:
146 limits:
147 cpu: {{ .Values.accelleran.resources.cpu }}
148 memory: {{ .Values.accelleran.resources.mem }}
149 intel.com/sriov: '2'
150 securityContext:
151 capabilities:
152 add:
153 - NET_ADMIN
154 - IPC_LOCK
155 - SYS_NICE
156 volumes:
157 - name: bbu-config
158 configMap:
159 name: l3-config
160 items:
161 - key: bootstrap.txt
162 path: bootstrap.txt
163