Woojoong Kim | 67dac6d | 2019-08-02 12:20:31 -0700 | [diff] [blame] | 1 | --- |
| 2 | # Copyright 2019-present Open Networking Foundation |
| 3 | # |
| 4 | # Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | # you may not use this file except in compliance with the License. |
| 6 | # You may obtain a copy of the License at |
| 7 | # |
| 8 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | # |
| 10 | # Unless required by applicable law or agreed to in writing, software |
| 11 | # distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | # See the License for the specific language governing permissions and |
| 14 | # limitations under the License. |
| 15 | |
| 16 | --- |
| 17 | apiVersion: apps/v1 |
| 18 | kind: StatefulSet |
| 19 | metadata: |
| 20 | name: {{ .Values.cu.name }} |
| 21 | labels: |
| 22 | app: {{ .Values.cu.name }} |
| 23 | spec: |
| 24 | replicas: {{ .Values.cu.accelleran.replicas }} |
| 25 | selector: |
| 26 | matchLabels: |
| 27 | app: {{ .Values.cu.name }} |
| 28 | serviceName: {{ .Values.cu.name | quote }} |
| 29 | template: |
| 30 | metadata: |
| 31 | labels: |
| 32 | app: {{ .Values.cu.name }} |
Woojoong Kim | 67dac6d | 2019-08-02 12:20:31 -0700 | [diff] [blame] | 33 | spec: |
Hyunsun Moon | 0fa831a | 2019-09-27 18:01:26 -0500 | [diff] [blame] | 34 | terminationGracePeriodSeconds: 1 |
Woojoong Kim | 67dac6d | 2019-08-02 12:20:31 -0700 | [diff] [blame] | 35 | initContainers: |
Hyunsun Moon | 0fa831a | 2019-09-27 18:01:26 -0500 | [diff] [blame] | 36 | - name: cu-init |
Woojoong Kim | 67dac6d | 2019-08-02 12:20:31 -0700 | [diff] [blame] | 37 | image: {{ .Values.cu.accelleran.images.init }} |
Hyunsun Moon | 0fa831a | 2019-09-27 18:01:26 -0500 | [diff] [blame] | 38 | securityContext: |
| 39 | privileged: true |
| 40 | runAsUser: 0 |
Woojoong Kim | 67dac6d | 2019-08-02 12:20:31 -0700 | [diff] [blame] | 41 | command: [ "sh", "-c"] |
| 42 | args: |
Hyunsun Moon | 0fa831a | 2019-09-27 18:01:26 -0500 | [diff] [blame] | 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 |
Woojoong Kim | 67dac6d | 2019-08-02 12:20:31 -0700 | [diff] [blame] | 51 | containers: |
| 52 | - name: nats |
| 53 | image: {{ .Values.cu.accelleran.images.nats }} |
| 54 | imagePullPolicy: IfNotPresent |
| 55 | stdin: true |
| 56 | tty: true |
| 57 | env: |
| 58 | - name: NATS_SERVICE_NAME |
| 59 | value: {{ .Values.cu.accelleran.nats.servicename }} |
| 60 | command: [ "sh", "-c"] |
| 61 | args: |
| 62 | - gnatsd -DV -c /etc/gnatsd.conf; |
| 63 | resources: |
| 64 | limits: |
| 65 | cpu: {{ .Values.cu.accelleran.resources.cpu }} |
| 66 | memory: {{ .Values.cu.accelleran.resources.mem }} |
Woojoong Kim | 67dac6d | 2019-08-02 12:20:31 -0700 | [diff] [blame] | 67 | securityContext: |
| 68 | capabilities: |
| 69 | add: |
| 70 | - NET_ADMIN |
| 71 | - IPC_LOCK |
| 72 | - name: redis |
| 73 | image: {{ .Values.cu.accelleran.images.redis }} |
| 74 | imagePullPolicy: IfNotPresent |
| 75 | stdin: true |
| 76 | tty: true |
| 77 | command: ["sh", "-c"] |
| 78 | args: |
| 79 | # FIXME: Redis can't support with dns resolution, can't set hostname at here. |
Woojoong Kim | d5caad6 | 2019-08-28 19:13:27 -0700 | [diff] [blame] | 80 | - (sleep 5; redis-cli -h localhost -p {{ .Values.cu.accelleran.ports.redis }} set NATS_SERVICE_URL "nat://{{ .Values.cu.accelleran.node_ip }}:{{ .Values.cu.accelleran.ports.nats }}";) & |
Woojoong Kim | 67dac6d | 2019-08-02 12:20:31 -0700 | [diff] [blame] | 81 | /usr/local/bin/redis-server |
| 82 | resources: |
| 83 | limits: |
| 84 | cpu: {{ .Values.cu.accelleran.resources.cpu }} |
| 85 | memory: {{ .Values.cu.accelleran.resources.mem }} |
Woojoong Kim | 67dac6d | 2019-08-02 12:20:31 -0700 | [diff] [blame] | 86 | securityContext: |
| 87 | capabilities: |
| 88 | add: |
| 89 | - NET_ADMIN |
| 90 | - IPC_LOCK |
| 91 | - name: bbu |
| 92 | image: {{ .Values.cu.accelleran.images.bbu }} |
Woojoong Kim | d543368 | 2019-08-26 15:06:16 -0700 | [diff] [blame] | 93 | imagePullPolicy: IfNotPresent |
Woojoong Kim | 67dac6d | 2019-08-02 12:20:31 -0700 | [diff] [blame] | 94 | env: |
| 95 | - name: MME_IP |
| 96 | value: {{ .Values.mme.nodeport_ip_addr }} |
| 97 | stdin: true |
| 98 | tty: true |
| 99 | command: ["sh", "-c"] |
| 100 | # Configure BBU SCTP source port to `s1ap_external`, MME endpoint port to `mme_port` and configure BBU to use |
| 101 | # Removed ProgRAN-related command - you can see about it in `helm-chart/mcord/mcord-bbu` |
| 102 | args: |
| 103 | - sqlite3 /mnt/app/datastore.db "update cellS1apConfig set enbSctpPort={{ .Values.cu.accelleran.ports.s1ap }};"; |
| 104 | sqlite3 /mnt/app/datastoreRemRw.db "update FapServiceFapControlLteGateway set S1SigLinkPort={{ .Values.mme.port }};"; |
Woojoong Kim | 90397c5 | 2019-08-28 17:49:45 -0700 | [diff] [blame] | 105 | sqlite3 /mnt/app/datastoreRemRw.db "update FapServiceCellConfigLteEpcPlmnList set PLMNID={{ .Values.epc.config.plmnid }};"; |
Woojoong Kim | 67dac6d | 2019-08-02 12:20:31 -0700 | [diff] [blame] | 106 | sqlite3 /mnt/app/datastore.db "insert into enbSctpSocketInterface ('interfaceName') values ('{{ .Values.enb.socket_interface }}');"; |
| 107 | sqlite3 /mnt/app/datastore.db "update logging set severity=7 where id=25;"; |
Woojoong Kim | e0c94a8 | 2019-08-27 10:27:27 -0700 | [diff] [blame] | 108 | {{- if .Values.cu.accelleran.progran.enabled }} |
| 109 | sqlite3 /mnt/app/datastore.db "update featureActivation set mmeSlicingEnabled=1;"; |
| 110 | sqlite3 /mnt/app/datastore.db "update featureActivation set ranSlicingEnabled=1;"; |
| 111 | sqlite3 /mnt/app/datastore.db "insert into pranServerAddress (pranServerIpAddress,pranServerPort) values ('{{ .Values.cu.accelleran.progran.ip }}', {{ .Values.cu.accelleran.progran.port }});"; |
| 112 | {{- end}} |
Woojoong Kim | 67dac6d | 2019-08-02 12:20:31 -0700 | [diff] [blame] | 113 | sleep 10; |
| 114 | /l3/l3start; |
| 115 | volumeMounts: |
| 116 | - name: bbu-config |
| 117 | mountPath: /mnt/app/bootstrap.txt |
| 118 | subPath: bootstrap.txt |
| 119 | resources: |
| 120 | limits: |
| 121 | cpu: {{ .Values.cu.accelleran.resources.cpu }} |
| 122 | memory: {{ .Values.cu.accelleran.resources.mem }} |
Woojoong Kim | 67dac6d | 2019-08-02 12:20:31 -0700 | [diff] [blame] | 123 | securityContext: |
| 124 | capabilities: |
| 125 | add: |
| 126 | - NET_ADMIN |
| 127 | - IPC_LOCK |
| 128 | - SYS_NICE |
| 129 | volumes: |
| 130 | - name: bbu-config |
| 131 | configMap: |
| 132 | name: l3-config |
| 133 | items: |
| 134 | - key: bootstrap.txt |
Woojoong Kim | d543368 | 2019-08-26 15:06:16 -0700 | [diff] [blame] | 135 | path: bootstrap.txt |
Hyunsun Moon | 0fa831a | 2019-09-27 18:01:26 -0500 | [diff] [blame] | 136 | - name: host-rootfs |
| 137 | hostPath: |
| 138 | path: / |