[DMAAP] Use common aaf template in dmaap-bc
[oom.git] / kubernetes / dmaap / components / message-router / templates / post-install-job.yaml
1 {{- if  .Values.global.aafEnabled }}
2 # Copyright © 2020 AT&T
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 apiVersion: batch/v1
16 kind: Job
17 metadata:
18   name: {{ include "common.fullname" . }}-post-install
19   labels:
20     app.kubernetes.io/managed-by: {{.Release.Service | quote }}
21     app.kubernetes.io/instance: {{include "common.release" . | quote }}
22     helm.sh/chart: "{{.Chart.Name}}-{{.Chart.Version}}"
23     release: {{ include "common.release" . }}
24   annotations:
25     # This is what defines this resource as a hook. Without this line, the
26     # job is considered part of the release.
27     "helm.sh/hook": post-install
28     "helm.sh/hook-weight": "-4"
29     "helm.sh/hook-delete-policy": hook-succeeded
30 spec:
31   template:
32     metadata:
33       name: {{ include "common.fullname" . }}
34       labels:
35         app.kubernetes.io/managed-by: {{.Release.Service | quote }}
36         app.kubernetes.io/instance: {{include "common.release" . | quote }}
37         helm.sh/chart: "{{.Chart.Name}}-{{.Chart.Version}}"
38         release: {{ include "common.release" . }}
39     spec:
40       restartPolicy: Never
41       containers:
42       - name: post-install-job
43         image: "{{ include "common.repository" . }}/{{ .Values.global.clientImage }}"
44         imagePullPolicy: "Always"
45         env:
46         - name: DELAY
47           value: "30"
48     {{- if .Values.global.allow_http }}
49         - name: PROTO
50           value: "http"
51         - name: PORT
52           value: "8080"
53     {{ end }}
54         - name: REQUESTID
55           value: "{{.Chart.Name}}-post-install"
56         volumeMounts:
57         - mountPath: /etc/localtime
58           name: localtime
59           readOnly: true
60
61 # NOTE: on the following several configMaps, careful to include / at end
62 #       since there may be more than one file in each mountPath
63 # NOTE: the basename of the subdirectory of mountPath is important - it matches the DBCL API URI
64         - name: {{ include "common.fullname" . }}-dbc-mrclusters
65           mountPath: /opt/app/config/mr_clusters/
66         - name: {{ include "common.fullname" . }}-dbc-topics
67           mountPath: /opt/app/config/topics/
68         resources:
69 {{ include "common.resources" . | indent 10 }}
70         {{- if .Values.nodeSelector }}
71       nodeSelector:
72 {{ toYaml .Values.nodeSelector | indent 8 }}
73         {{- end -}}
74         {{- if .Values.affinity }}
75       affinity:
76 {{ toYaml .Values.affinity | indent 8 }}
77         {{- end }}
78       volumes:
79         - name: localtime
80           hostPath:
81             path: /etc/localtime
82         - name: {{ include "common.fullname" . }}-dbc-mrclusters
83           configMap:
84             name: {{ include "common.fullname" . }}-dbc-mrclusters
85         - name: {{ include "common.fullname" . }}-dbc-topics
86           configMap:
87             name: {{ include "common.fullname" . }}-dbc-topics
88       imagePullSecrets:
89       - name: "{{ include "common.namespace" . }}-docker-registry-key"
90 {{- end }}