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 |
| 25 | clusterIP: None |
| 26 | ports: |
| 27 | - name: s1ap |
| 28 | port: {{ .Values.accelleran.ports.s1ap }} |
| 29 | protocol: TCP |
| 30 | |
| 31 | --- |
| 32 | apiVersion: apps/v1 |
| 33 | kind: StatefulSet |
| 34 | metadata: |
| 35 | name: accelleran |
| 36 | labels: |
| 37 | app: accelleran |
| 38 | spec: |
| 39 | replicas: {{ .Values.accelleran.replicas }} |
| 40 | selector: |
| 41 | matchLabels: |
| 42 | app: accelleran |
| 43 | serviceName: "accelleran" |
| 44 | template: |
| 45 | metadata: |
| 46 | labels: |
| 47 | app: accelleran |
| 48 | annotations: |
| 49 | k8s.v1.cni.cncf.io/networks: '[ |
| 50 | { "name": "bbu-net", "interface": "vbbu-net", "namespace": "default" } |
| 51 | ]' |
| 52 | spec: |
| 53 | initContainers: |
| 54 | - name: init-iptables |
| 55 | image: {{ .Values.accelleran.images.init }} |
| 56 | command: [ "sh", "-c"] |
| 57 | args: |
| 58 | - iptables -I OUTPUT -p icmp --icmp-type destination-unreachable -j DROP; |
| 59 | securityContext: |
| 60 | capabilities: |
| 61 | add: |
| 62 | - NET_ADMIN |
| 63 | terminationGracePeriodSeconds: 1 |
| 64 | containers: |
| 65 | - name: nats |
| 66 | image: {{ .Values.accelleran.images.nats }} |
| 67 | imagePullPolicy: IfNotPresent |
| 68 | stdin: true |
| 69 | tty: true |
| 70 | env: |
| 71 | - name: NATS_SERVICE_NAME |
| 72 | value: {{ .Values.accelleran.nats_service_name }} |
| 73 | command: [ "sh", "-c"] |
| 74 | args: |
| 75 | - gnatsd -DV -c /etc/gnatsd.conf; |
| 76 | resources: |
| 77 | limits: |
| 78 | cpu: {{ .Values.accelleran.resources.cpu }} |
| 79 | memory: {{ .Values.accelleran.resources.mem }} |
| 80 | intel.com/sriov: '2' |
| 81 | securityContext: |
| 82 | capabilities: |
| 83 | add: |
| 84 | - NET_ADMIN |
| 85 | - IPC_LOCK |
| 86 | - name: redis |
| 87 | image: {{ .Values.accelleran.images.redis }} |
| 88 | imagePullPolicy: IfNotPresent |
| 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. |
Wei-Yu Chen | 353512d | 2019-01-30 13:28:48 -0800 | [diff] [blame] | 94 | - (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] | 95 | /usr/local/bin/redis-server |
| 96 | resources: |
| 97 | limits: |
| 98 | cpu: {{ .Values.accelleran.resources.cpu }} |
| 99 | memory: {{ .Values.accelleran.resources.mem }} |
| 100 | intel.com/sriov: '2' |
| 101 | securityContext: |
| 102 | capabilities: |
| 103 | add: |
| 104 | - NET_ADMIN |
| 105 | - IPC_LOCK |
| 106 | - name: bbu |
| 107 | image: {{ .Values.accelleran.images.bbu }} |
| 108 | imagePullPolicy: IfNotPresent |
| 109 | env: |
| 110 | - name: HOST_IP |
| 111 | value: {{ .Values.accelleran_hostname }} |
| 112 | stdin: true |
| 113 | tty: true |
| 114 | command: ["sh", "-c"] |
| 115 | args: |
| 116 | - sqlite3 /mnt/app/datastoreRemRw.db "update FapServiceFapControlLteGateway_S1SigLinkServerListList set S1SigLinkServerList='{{ .Values.accelleran_hostname }}';"; |
| 117 | sleep 10; |
| 118 | /l3/l3start; |
| 119 | volumeMounts: |
| 120 | - name: bbu-config |
| 121 | mountPath: /mnt/app/bootstrap.txt |
| 122 | subPath: bootstrap.txt |
| 123 | resources: |
| 124 | limits: |
| 125 | cpu: {{ .Values.accelleran.resources.cpu }} |
| 126 | memory: {{ .Values.accelleran.resources.mem }} |
| 127 | intel.com/sriov: '2' |
| 128 | securityContext: |
| 129 | capabilities: |
| 130 | add: |
| 131 | - NET_ADMIN |
| 132 | - IPC_LOCK |
| 133 | - SYS_NICE |
| 134 | volumes: |
| 135 | - name: bbu-config |
| 136 | configMap: |
| 137 | name: l3-config |
| 138 | items: |
| 139 | - key: bootstrap.txt |
| 140 | path: bootstrap.txt |
| 141 | |