Hyunsun Moon | ed19c09 | 2019-07-10 15:24:45 -0600 | [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 | {{- $releaseName := .Release.Name }} |
| 18 | {{- $namespace := .Release.Namespace }} |
| 19 | {{- $name := .Values.conf.enb.name }} |
| 20 | --- |
| 21 | apiVersion: v1 |
| 22 | kind: ServiceAccount |
| 23 | metadata: |
| 24 | name: {{ $releaseName }}-{{ $name }} |
| 25 | namespace: {{ $namespace }} |
| 26 | --- |
| 27 | kind: Role |
| 28 | apiVersion: rbac.authorization.k8s.io/v1 |
| 29 | metadata: |
| 30 | name: {{ $releaseName }}-{{ $name }} |
| 31 | namespace: {{ $namespace }} |
| 32 | rules: |
| 33 | - apiGroups: |
| 34 | - "" |
| 35 | - extensions |
| 36 | - batch |
| 37 | - apps |
| 38 | verbs: |
| 39 | - get |
| 40 | - list |
| 41 | resources: |
| 42 | - daemonsets |
| 43 | - jobs |
| 44 | - pods |
| 45 | - services |
| 46 | - endpoints |
| 47 | --- |
| 48 | kind: RoleBinding |
| 49 | apiVersion: rbac.authorization.k8s.io/v1 |
| 50 | metadata: |
| 51 | name: {{ $releaseName }}-{{ $name }} |
| 52 | namespace: {{ $namespace }} |
| 53 | roleRef: |
| 54 | apiGroup: rbac.authorization.k8s.io |
| 55 | kind: Role |
| 56 | name: {{ $releaseName }}-{{ $name }} |
| 57 | subjects: |
| 58 | - kind: ServiceAccount |
| 59 | name: {{ $releaseName }}-{{ $name }} |
| 60 | --- |
| 61 | apiVersion: apps/v1 |
| 62 | kind: StatefulSet |
| 63 | metadata: |
| 64 | name: {{ $name }} |
| 65 | namespace: {{ $namespace }} |
| 66 | labels: |
| 67 | app: oai-enb |
| 68 | spec: |
| 69 | replicas: 1 |
| 70 | selector: |
| 71 | matchLabels: |
| 72 | app: oai-enb |
| 73 | serviceName: {{ $name | quote }} |
| 74 | template: |
| 75 | metadata: |
| 76 | labels: |
| 77 | app: oai-enb |
| 78 | spec: |
| 79 | serviceAccountName: {{ $releaseName }}-{{ $name }} |
| 80 | hostNetwork: true |
| 81 | initContainers: |
| 82 | - name: enb-dep-check |
| 83 | image: {{ .Values.images.tags.dep_check | quote }} |
| 84 | imagePullPolicy: {{ .Values.images.pullPolicy }} |
| 85 | securityContext: |
| 86 | allowPrivilegeEscalation: false |
| 87 | readOnlyRootFilesystem: false |
| 88 | runAsUser: 0 |
| 89 | env: |
| 90 | - name: POD_NAME |
| 91 | valueFrom: |
| 92 | fieldRef: |
| 93 | apiVersion: v1 |
| 94 | fieldPath: metadata.name |
| 95 | - name: NAMESPACE |
| 96 | valueFrom: |
| 97 | fieldRef: |
| 98 | apiVersion: v1 |
| 99 | fieldPath: metadata.namespace |
| 100 | - name: PATH |
| 101 | value: /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/ |
| 102 | - name: COMMAND |
| 103 | value: "echo done" |
| 104 | - name: DEPENDENCY_POD_JSON |
| 105 | value: '[{"labels": {"app": "mme"}, "requireSameNode": false}]' |
| 106 | command: |
| 107 | - kubernetes-entrypoint |
| 108 | volumeMounts: |
| 109 | [] |
| 110 | - name: enb-init |
| 111 | image: {{ .Values.images.tags.enb | quote }} |
| 112 | imagePullPolicy: {{ .Values.images.pullPolicy }} |
| 113 | securityContext: |
| 114 | capabilities: |
| 115 | add: |
| 116 | - NET_ADMIN |
| 117 | command: |
| 118 | - /opt/oaisim/enb/scripts/enb-init.sh |
| 119 | env: |
| 120 | - name: ENB_LOCAL_IP |
| 121 | valueFrom: |
| 122 | fieldRef: |
| 123 | fieldPath: status.podIP |
| 124 | volumeMounts: |
| 125 | - name: script |
| 126 | mountPath: /opt/oaisim/enb/scripts/enb-init.sh |
| 127 | subPath: enb-init.sh |
| 128 | - name: config |
| 129 | mountPath: /opt/oaisim/enb/config |
| 130 | - name: pod-share |
| 131 | mountPath: /etc/oaisim/enb |
| 132 | containers: |
| 133 | - name: {{ $name }} |
| 134 | image: {{ .Values.images.tags.enb | quote }} |
| 135 | imagePullPolicy: {{ .Values.images.pullPolicy }} |
| 136 | securityContext: |
| 137 | privileged: true |
| 138 | command: |
| 139 | - /opt/oaisim/enb/scripts/enb-run.sh |
| 140 | - start |
| 141 | lifecycle: |
| 142 | preStop: |
| 143 | exec: |
| 144 | command: |
| 145 | - /opt/oaisim/enb/scripts/enb-run.sh |
| 146 | - stop |
| 147 | env: |
| 148 | - name: ENB_LOCAL_IP |
| 149 | valueFrom: |
| 150 | fieldRef: |
| 151 | fieldPath: status.podIP |
| 152 | volumeMounts: |
| 153 | - name: script |
| 154 | mountPath: /opt/oaisim/enb/scripts/enb-run.sh |
| 155 | subPath: enb-run.sh |
| 156 | - name: pod-share |
| 157 | mountPath: /etc/oaisim/enb |
| 158 | volumes: |
| 159 | - name: config |
| 160 | configMap: |
| 161 | name: {{ $name }} |
| 162 | defaultMode: 420 |
| 163 | - name: script |
| 164 | configMap: |
| 165 | name: {{ $name }} |
| 166 | defaultMode: 493 |
| 167 | - name: pod-share |
| 168 | emptyDir: {} |