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 }} |
| 33 | annotations: |
| 34 | k8s.v1.cni.cncf.io/networks: '[ |
| 35 | { "name": "f1-net-cu", "interface": "f1-net-cu" } |
| 36 | ]' |
| 37 | |
| 38 | spec: |
| 39 | nodeSelector: |
| 40 | {{ toYaml .Values.cu.nodeselector | indent 8 }} |
| 41 | initContainers: |
| 42 | - name: init-iptables |
| 43 | image: {{ .Values.cu.accelleran.images.init }} |
| 44 | command: [ "sh", "-c"] |
| 45 | args: |
| 46 | - iptables -I OUTPUT -p icmp --icmp-type destination-unreachable -j DROP; |
| 47 | securityContext: |
| 48 | capabilities: |
| 49 | add: |
| 50 | - NET_ADMIN |
| 51 | terminationGracePeriodSeconds: 1 |
| 52 | containers: |
| 53 | - name: nats |
| 54 | image: {{ .Values.cu.accelleran.images.nats }} |
| 55 | imagePullPolicy: IfNotPresent |
| 56 | stdin: true |
| 57 | tty: true |
| 58 | env: |
| 59 | - name: NATS_SERVICE_NAME |
| 60 | value: {{ .Values.cu.accelleran.nats.servicename }} |
| 61 | command: [ "sh", "-c"] |
| 62 | args: |
| 63 | - gnatsd -DV -c /etc/gnatsd.conf; |
| 64 | resources: |
| 65 | limits: |
| 66 | cpu: {{ .Values.cu.accelleran.resources.cpu }} |
| 67 | memory: {{ .Values.cu.accelleran.resources.mem }} |
| 68 | {{- if .Values.network.sriov.enabled }} |
| 69 | intel.com/sriov_netdevice: '2' |
| 70 | {{- end }} |
| 71 | securityContext: |
| 72 | capabilities: |
| 73 | add: |
| 74 | - NET_ADMIN |
| 75 | - IPC_LOCK |
| 76 | - name: redis |
| 77 | image: {{ .Values.cu.accelleran.images.redis }} |
| 78 | imagePullPolicy: IfNotPresent |
| 79 | stdin: true |
| 80 | tty: true |
| 81 | command: ["sh", "-c"] |
| 82 | args: |
| 83 | # FIXME: Redis can't support with dns resolution, can't set hostname at here. |
| 84 | - (sleep 5; redis-cli -h localhost -p 6379 set NATS_SERVICE_URL "nat://$(ip route get 116 | awk '{print $NF;exit}'):4222";) & |
| 85 | /usr/local/bin/redis-server |
| 86 | resources: |
| 87 | limits: |
| 88 | cpu: {{ .Values.cu.accelleran.resources.cpu }} |
| 89 | memory: {{ .Values.cu.accelleran.resources.mem }} |
| 90 | {{- if .Values.network.sriov.enabled }} |
| 91 | intel.com/sriov_netdevice: '2' |
| 92 | {{- end }} |
| 93 | securityContext: |
| 94 | capabilities: |
| 95 | add: |
| 96 | - NET_ADMIN |
| 97 | - IPC_LOCK |
| 98 | - name: bbu |
| 99 | image: {{ .Values.cu.accelleran.images.bbu }} |
Woojoong Kim | d543368 | 2019-08-26 15:06:16 -0700 | [diff] [blame] | 100 | imagePullPolicy: IfNotPresent |
Woojoong Kim | 67dac6d | 2019-08-02 12:20:31 -0700 | [diff] [blame] | 101 | env: |
| 102 | - name: MME_IP |
| 103 | value: {{ .Values.mme.nodeport_ip_addr }} |
| 104 | stdin: true |
| 105 | tty: true |
| 106 | command: ["sh", "-c"] |
| 107 | # Configure BBU SCTP source port to `s1ap_external`, MME endpoint port to `mme_port` and configure BBU to use |
| 108 | # Removed ProgRAN-related command - you can see about it in `helm-chart/mcord/mcord-bbu` |
| 109 | args: |
| 110 | - sqlite3 /mnt/app/datastore.db "update cellS1apConfig set enbSctpPort={{ .Values.cu.accelleran.ports.s1ap }};"; |
| 111 | sqlite3 /mnt/app/datastoreRemRw.db "update FapServiceFapControlLteGateway set S1SigLinkPort={{ .Values.mme.port }};"; |
| 112 | sqlite3 /mnt/app/datastore.db "insert into enbSctpSocketInterface ('interfaceName') values ('{{ .Values.enb.socket_interface }}');"; |
| 113 | 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^] | 114 | {{- if .Values.cu.accelleran.progran.enabled }} |
| 115 | sqlite3 /mnt/app/datastore.db "update featureActivation set mmeSlicingEnabled=1;"; |
| 116 | sqlite3 /mnt/app/datastore.db "update featureActivation set ranSlicingEnabled=1;"; |
| 117 | sqlite3 /mnt/app/datastore.db "insert into pranServerAddress (pranServerIpAddress,pranServerPort) values ('{{ .Values.cu.accelleran.progran.ip }}', {{ .Values.cu.accelleran.progran.port }});"; |
| 118 | {{- end}} |
Woojoong Kim | 67dac6d | 2019-08-02 12:20:31 -0700 | [diff] [blame] | 119 | sleep 10; |
| 120 | /l3/l3start; |
| 121 | volumeMounts: |
| 122 | - name: bbu-config |
| 123 | mountPath: /mnt/app/bootstrap.txt |
| 124 | subPath: bootstrap.txt |
| 125 | resources: |
| 126 | limits: |
| 127 | cpu: {{ .Values.cu.accelleran.resources.cpu }} |
| 128 | memory: {{ .Values.cu.accelleran.resources.mem }} |
| 129 | {{- if .Values.network.sriov.enabled }} |
| 130 | intel.com/sriov_netdevice: '2' |
| 131 | {{- end }} |
| 132 | securityContext: |
| 133 | capabilities: |
| 134 | add: |
| 135 | - NET_ADMIN |
| 136 | - IPC_LOCK |
| 137 | - SYS_NICE |
| 138 | volumes: |
| 139 | - name: bbu-config |
| 140 | configMap: |
| 141 | name: l3-config |
| 142 | items: |
| 143 | - key: bootstrap.txt |
Woojoong Kim | d543368 | 2019-08-26 15:06:16 -0700 | [diff] [blame] | 144 | path: bootstrap.txt |