Hyunsun Moon | 636e17d | 2019-07-03 12:52:15 -0500 | [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 | {{- if eq .Values.mme.type "openmme" }} |
| 17 | |
| 18 | {{- $releaseName := .Release.Name }} |
| 19 | {{- $namespace := .Values.global.namespace }} |
| 20 | {{- $name := .Values.mme.name }} |
| 21 | --- |
| 22 | apiVersion: v1 |
| 23 | kind: ServiceAccount |
| 24 | metadata: |
| 25 | name: {{ $releaseName }}-{{ $name }} |
| 26 | namespace: {{ $namespace }} |
| 27 | --- |
| 28 | kind: Role |
| 29 | apiVersion: rbac.authorization.k8s.io/v1 |
| 30 | metadata: |
| 31 | name: {{ $releaseName }}-{{ $name }} |
| 32 | namespace: {{ $namespace }} |
| 33 | rules: |
| 34 | - apiGroups: |
| 35 | - "" |
| 36 | - extensions |
| 37 | - batch |
| 38 | - apps |
| 39 | verbs: |
| 40 | - get |
| 41 | - list |
| 42 | resources: |
| 43 | - daemonsets |
| 44 | - jobs |
| 45 | - pods |
| 46 | - services |
| 47 | - endpoints |
| 48 | --- |
| 49 | kind: RoleBinding |
| 50 | apiVersion: rbac.authorization.k8s.io/v1 |
| 51 | metadata: |
| 52 | name: {{ $releaseName }}-{{ $name }} |
| 53 | namespace: {{ $namespace }} |
| 54 | roleRef: |
| 55 | apiGroup: rbac.authorization.k8s.io |
| 56 | kind: Role |
| 57 | name: {{ $releaseName }}-{{ $name }} |
| 58 | subjects: |
| 59 | - kind: ServiceAccount |
| 60 | name: {{ $releaseName }}-{{ $name }} |
| 61 | --- |
| 62 | apiVersion: apps/v1 |
| 63 | kind: StatefulSet |
| 64 | metadata: |
| 65 | name: {{ $name }} |
| 66 | namespace: {{ $namespace }} |
| 67 | labels: |
| 68 | app: {{ $name }} |
| 69 | spec: |
| 70 | replicas: 1 |
| 71 | selector: |
| 72 | matchLabels: |
| 73 | app: {{ $name }} |
| 74 | serviceName: {{ $name | quote }} |
| 75 | template: |
| 76 | metadata: |
| 77 | labels: |
| 78 | app: {{ $name }} |
| 79 | spec: |
| 80 | serviceAccountName: {{ $releaseName }}-{{ $name }} |
| 81 | initContainers: |
| 82 | - name: mme-dep-check |
| 83 | image: {{ .Values.mme.images.tags.dep_check | quote }} |
| 84 | imagePullPolicy: {{ .Values.mme.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": {{ .Values.spgwc.name | quote }}}, "requireSameNode": false}, {"labels": {"app": {{ .Values.hss.name | quote }}}, "requireSameNode": false}]' |
| 106 | # add dependency job for make_certs.sh |
| 107 | command: |
| 108 | - kubernetes-entrypoint |
| 109 | volumeMounts: |
| 110 | [] |
| 111 | - name: mme-init |
| 112 | image: {{ .Values.mme.images.tags.mme | quote }} |
| 113 | imagePullPolicy: {{ .Values.mme.images.pullPolicy }} |
| 114 | command: ["/opt/mme/scripts/mme-init.sh"] |
| 115 | env: |
| 116 | - name: MME_LOCAL_IP |
| 117 | valueFrom: |
| 118 | fieldRef: |
| 119 | fieldPath: status.podIP |
| 120 | volumeMounts: |
| 121 | - name: scripts |
| 122 | mountPath: /opt/mme/scripts/mme-init.sh |
| 123 | subPath: mme-init.sh |
| 124 | - name: configs |
| 125 | mountPath: /opt/mme/config |
| 126 | - name: shared-data |
| 127 | mountPath: /opt/mme/config/shared |
| 128 | containers: |
| 129 | - name: mme-app |
| 130 | image: {{ .Values.mme.images.tags.mme | quote }} |
| 131 | imagePullPolicy: {{ .Values.mme.images.pullPolicy }} |
| 132 | command: ["bash", "-xc"] |
| 133 | args: |
| 134 | - /opt/mme/scripts/mme-run.sh mme-app |
| 135 | volumeMounts: |
| 136 | - name: scripts |
| 137 | mountPath: /opt/mme/scripts/mme-run.sh |
| 138 | subPath: mme-run.sh |
| 139 | - name: shared-data |
| 140 | mountPath: /opt/mme/config/shared |
| 141 | - name: shared-app |
| 142 | mountPath: /tmp |
| 143 | - name: s1ap-app |
| 144 | image: {{ .Values.mme.images.tags.mme | quote }} |
| 145 | imagePullPolicy: {{ .Values.mme.images.pullPolicy }} |
| 146 | command: ["bash", "-xc"] |
| 147 | args: |
| 148 | - /opt/mme/scripts/mme-run.sh s1ap-app |
| 149 | volumeMounts: |
| 150 | - name: scripts |
| 151 | mountPath: /opt/mme/scripts/mme-run.sh |
| 152 | subPath: mme-run.sh |
| 153 | - name: shared-data |
| 154 | mountPath: /opt/mme/config/shared |
| 155 | - name: shared-app |
| 156 | mountPath: /tmp |
| 157 | - name: s6a-app |
| 158 | image: {{ .Values.mme.images.tags.mme | quote }} |
| 159 | imagePullPolicy: {{ .Values.mme.images.pullPolicy }} |
| 160 | command: ["bash", "-xc"] |
| 161 | args: |
| 162 | - /opt/mme/scripts/mme-run.sh s6a-app |
| 163 | volumeMounts: |
| 164 | - name: scripts |
| 165 | mountPath: /opt/mme/scripts/mme-run.sh |
| 166 | subPath: mme-run.sh |
| 167 | - name: shared-data |
| 168 | mountPath: /opt/mme/config/shared |
| 169 | - name: shared-app |
| 170 | mountPath: /tmp |
| 171 | - name: s11-app |
| 172 | image: {{ .Values.mme.images.tags.mme | quote }} |
| 173 | imagePullPolicy: {{ .Values.mme.images.pullPolicy }} |
| 174 | command: ["bash", "-xc"] |
| 175 | args: |
| 176 | - /opt/mme/scripts/mme-run.sh s11-app |
| 177 | volumeMounts: |
| 178 | - name: scripts |
| 179 | mountPath: /opt/mme/scripts/mme-run.sh |
| 180 | subPath: mme-run.sh |
| 181 | - name: shared-data |
| 182 | mountPath: /opt/mme/config/shared |
| 183 | - name: shared-app |
| 184 | mountPath: /tmp |
| 185 | volumes: |
| 186 | - name: scripts |
| 187 | configMap: |
| 188 | name: {{ $name }} |
| 189 | defaultMode: 493 |
| 190 | - name: configs |
| 191 | configMap: |
| 192 | name: {{ $name }} |
| 193 | defaultMode: 420 |
| 194 | - name: shared-data |
| 195 | emptyDir: {} |
| 196 | - name: shared-app |
| 197 | emptyDir: {} |
| 198 | {{- end }} |