Wei-Yu Chen | 4182f96 | 2019-01-24 15:47:39 -0800 | [diff] [blame] | 1 | --- |
| 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 | --- |
| 18 | apiVersion: v1 |
| 19 | kind: Service |
| 20 | metadata: |
| 21 | name: accelleran |
| 22 | spec: |
| 23 | selector: |
| 24 | app: accelleran |
Pingping Lin | 79f8470 | 2019-02-05 18:38:40 -0800 | [diff] [blame] | 25 | clusterIP: None |
Wei-Yu Chen | 4182f96 | 2019-01-24 15:47:39 -0800 | [diff] [blame] | 26 | ports: |
| 27 | - name: s1ap |
| 28 | port: {{ .Values.accelleran.ports.s1ap }} |
Wei-Yu Chen | ec8a2d7 | 2019-02-12 14:36:10 -0800 | [diff] [blame] | 29 | protocol: SCTP |
Matteo Scandolo | dec3f27 | 2019-02-04 13:57:35 -0800 | [diff] [blame] | 30 | --- |
| 31 | apiVersion: v1 |
| 32 | kind: Service |
| 33 | metadata: |
Pingping Lin | 79f8470 | 2019-02-05 18:38:40 -0800 | [diff] [blame] | 34 | name: accelleran-external |
Matteo Scandolo | dec3f27 | 2019-02-04 13:57:35 -0800 | [diff] [blame] | 35 | spec: |
| 36 | selector: |
Wei-Yu Chen | ec8a2d7 | 2019-02-12 14:36:10 -0800 | [diff] [blame] | 37 | app: accelleran |
Matteo Scandolo | dec3f27 | 2019-02-04 13:57:35 -0800 | [diff] [blame] | 38 | type: NodePort |
| 39 | ports: |
| 40 | - port: {{ .Values.accelleran.ports.s1ap }} |
Pingping Lin | 79f8470 | 2019-02-05 18:38:40 -0800 | [diff] [blame] | 41 | nodePort: {{ .Values.accelleran.ports.s1ap_external }} |
Wei-Yu Chen | ec8a2d7 | 2019-02-12 14:36:10 -0800 | [diff] [blame] | 42 | protocol: SCTP |
Wei-Yu Chen | 4182f96 | 2019-01-24 15:47:39 -0800 | [diff] [blame] | 43 | --- |
| 44 | apiVersion: apps/v1 |
| 45 | kind: StatefulSet |
| 46 | metadata: |
| 47 | name: accelleran |
| 48 | labels: |
| 49 | app: accelleran |
| 50 | spec: |
| 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 Chen | ec8a2d7 | 2019-02-12 14:36:10 -0800 | [diff] [blame] | 65 | nodeSelector: |
| 66 | kubernetes.io/hostname: "node2" |
Wei-Yu Chen | 4182f96 | 2019-01-24 15:47:39 -0800 | [diff] [blame] | 67 | 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 Chen | 353512d | 2019-01-30 13:28:48 -0800 | [diff] [blame] | 108 | - (sleep 5; redis-cli -h localhost -p 6379 set NATS_SERVICE_URL "nat://$(ip route get 116 | awk '{print $NF;exit}'):4222";) & |
Wei-Yu Chen | 4182f96 | 2019-01-24 15:47:39 -0800 | [diff] [blame] | 109 | /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 Chen | b92af45 | 2019-01-31 12:08:19 -0800 | [diff] [blame] | 122 | imagePullPolicy: Always |
Wei-Yu Chen | 4182f96 | 2019-01-24 15:47:39 -0800 | [diff] [blame] | 123 | env: |
Wei-Yu Chen | b92af45 | 2019-01-31 12:08:19 -0800 | [diff] [blame] | 124 | - name: MME_IP |
| 125 | value: {{ .Values.mme_hostname }} |
Wei-Yu Chen | 4182f96 | 2019-01-24 15:47:39 -0800 | [diff] [blame] | 126 | stdin: true |
| 127 | tty: true |
| 128 | command: ["sh", "-c"] |
Wei-Yu Chen | ec8a2d7 | 2019-02-12 14:36:10 -0800 | [diff] [blame] | 129 | # Configure BBU SCTP source port to `s1ap_external`, MME endpoint port to `mme_port` and configure BBU to use |
Wei-Yu Chen | 4182f96 | 2019-01-24 15:47:39 -0800 | [diff] [blame] | 130 | args: |
Wei-Yu Chen | ec8a2d7 | 2019-02-12 14:36:10 -0800 | [diff] [blame] | 131 | - 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 Lin | a5cc6b8 | 2019-02-13 10:36:43 -0800 | [diff] [blame] | 134 | 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;"; |
| 137 | sqlite3 /mnt/app/datastore.db "insert into pranServerAddress (pranServerIpAddress,pranServerPort) values ('{{ .Values.progran_ip }}', {{ .Values.progran_port }});" |
| 138 | |
Wei-Yu Chen | 4182f96 | 2019-01-24 15:47:39 -0800 | [diff] [blame] | 139 | 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 | |