blob: 47e31cd5e3d2e24d5443d5bf5107f42c7723eee6 [file] [log] [blame]
Hyunsun Mooned19c092019-07-10 15:24:45 -06001{{/*
2Copyright 2019-present Open Networking Foundation
3
4Licensed under the Apache License, Version 2.0 (the "License");
5you may not use this file except in compliance with the License.
6You may obtain a copy of the License at
7
8http://www.apache.org/licenses/LICENSE-2.0
9
10Unless required by applicable law or agreed to in writing, software
11distributed under the License is distributed on an "AS IS" BASIS,
12WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13See the License for the specific language governing permissions and
14limitations under the License.
15*/}}
16
17{{- $releaseName := .Release.Name }}
18{{- $namespace := .Release.Namespace }}
19{{- $name := .Values.conf.enb.name }}
20---
21apiVersion: v1
22kind: ServiceAccount
23metadata:
24 name: {{ $releaseName }}-{{ $name }}
25 namespace: {{ $namespace }}
26---
27kind: Role
28apiVersion: rbac.authorization.k8s.io/v1
29metadata:
30 name: {{ $releaseName }}-{{ $name }}
31 namespace: {{ $namespace }}
32rules:
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---
48kind: RoleBinding
49apiVersion: rbac.authorization.k8s.io/v1
50metadata:
51 name: {{ $releaseName }}-{{ $name }}
52 namespace: {{ $namespace }}
53roleRef:
54 apiGroup: rbac.authorization.k8s.io
55 kind: Role
56 name: {{ $releaseName }}-{{ $name }}
57subjects:
58 - kind: ServiceAccount
59 name: {{ $releaseName }}-{{ $name }}
60---
61apiVersion: apps/v1
62kind: StatefulSet
63metadata:
64 name: {{ $name }}
65 namespace: {{ $namespace }}
66 labels:
67 app: oai-enb
68spec:
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: {}