blob: 173b868cd3ce4d1cb8e748bb3126399966160537 [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 }}
Hyunsun Moon43eadcc2019-08-20 16:16:08 -060019{{- $name := .Values.config.enb.name }}
Hyunsun Mooned19c092019-07-10 15:24:45 -060020---
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:
Hyunsun Moon43eadcc2019-08-20 16:16:08 -060079 {{- if .Values.nodeSelectors.enabled }}
80 nodeSelector:
81 {{ .Values.nodeSelectors.enb.label }}: {{ .Values.nodeSelectors.enb.value }}
82 {{- end }}
Hyunsun Mooned19c092019-07-10 15:24:45 -060083 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: {}