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 }} |
Hyunsun Moon | 43eadcc | 2019-08-20 16:16:08 -0600 | [diff] [blame] | 19 | {{- $name := .Values.config.enb.name }} |
Hyunsun Moon | ed19c09 | 2019-07-10 15:24:45 -0600 | [diff] [blame] | 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: |
Hyunsun Moon | 43eadcc | 2019-08-20 16:16:08 -0600 | [diff] [blame] | 79 | {{- if .Values.nodeSelectors.enabled }} |
| 80 | nodeSelector: |
| 81 | {{ .Values.nodeSelectors.enb.label }}: {{ .Values.nodeSelectors.enb.value }} |
| 82 | {{- end }} |
Hyunsun Moon | ed19c09 | 2019-07-10 15:24:45 -0600 | [diff] [blame] | 83 | serviceAccountName: {{ $releaseName }}-{{ $name }} |
| 84 | hostNetwork: true |
| 85 | initContainers: |
| 86 | - name: enb-dep-check |
| 87 | image: {{ .Values.images.tags.dep_check | quote }} |
| 88 | imagePullPolicy: {{ .Values.images.pullPolicy }} |
| 89 | securityContext: |
| 90 | allowPrivilegeEscalation: false |
| 91 | readOnlyRootFilesystem: false |
| 92 | runAsUser: 0 |
| 93 | env: |
| 94 | - name: POD_NAME |
| 95 | valueFrom: |
| 96 | fieldRef: |
| 97 | apiVersion: v1 |
| 98 | fieldPath: metadata.name |
| 99 | - name: NAMESPACE |
| 100 | valueFrom: |
| 101 | fieldRef: |
| 102 | apiVersion: v1 |
| 103 | fieldPath: metadata.namespace |
| 104 | - name: PATH |
| 105 | value: /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/ |
| 106 | - name: COMMAND |
| 107 | value: "echo done" |
| 108 | - name: DEPENDENCY_POD_JSON |
| 109 | value: '[{"labels": {"app": "mme"}, "requireSameNode": false}]' |
| 110 | command: |
| 111 | - kubernetes-entrypoint |
| 112 | volumeMounts: |
| 113 | [] |
| 114 | - name: enb-init |
| 115 | image: {{ .Values.images.tags.enb | quote }} |
| 116 | imagePullPolicy: {{ .Values.images.pullPolicy }} |
| 117 | securityContext: |
| 118 | capabilities: |
| 119 | add: |
| 120 | - NET_ADMIN |
| 121 | command: |
| 122 | - /opt/oaisim/enb/scripts/enb-init.sh |
| 123 | env: |
| 124 | - name: ENB_LOCAL_IP |
| 125 | valueFrom: |
| 126 | fieldRef: |
| 127 | fieldPath: status.podIP |
| 128 | volumeMounts: |
| 129 | - name: script |
| 130 | mountPath: /opt/oaisim/enb/scripts/enb-init.sh |
| 131 | subPath: enb-init.sh |
| 132 | - name: config |
| 133 | mountPath: /opt/oaisim/enb/config |
| 134 | - name: pod-share |
| 135 | mountPath: /etc/oaisim/enb |
| 136 | containers: |
| 137 | - name: {{ $name }} |
| 138 | image: {{ .Values.images.tags.enb | quote }} |
| 139 | imagePullPolicy: {{ .Values.images.pullPolicy }} |
| 140 | securityContext: |
| 141 | privileged: true |
| 142 | command: |
| 143 | - /opt/oaisim/enb/scripts/enb-run.sh |
| 144 | - start |
| 145 | lifecycle: |
| 146 | preStop: |
| 147 | exec: |
| 148 | command: |
| 149 | - /opt/oaisim/enb/scripts/enb-run.sh |
| 150 | - stop |
| 151 | env: |
| 152 | - name: ENB_LOCAL_IP |
| 153 | valueFrom: |
| 154 | fieldRef: |
| 155 | fieldPath: status.podIP |
| 156 | volumeMounts: |
| 157 | - name: script |
| 158 | mountPath: /opt/oaisim/enb/scripts/enb-run.sh |
| 159 | subPath: enb-run.sh |
| 160 | - name: pod-share |
| 161 | mountPath: /etc/oaisim/enb |
| 162 | volumes: |
| 163 | - name: config |
| 164 | configMap: |
| 165 | name: {{ $name }} |
| 166 | defaultMode: 420 |
| 167 | - name: script |
| 168 | configMap: |
| 169 | name: {{ $name }} |
| 170 | defaultMode: 493 |
| 171 | - name: pod-share |
| 172 | emptyDir: {} |