Merge "[DMAAP] DMaaP ServiceMesh compatibility"
[oom.git] / kubernetes / aaf / components / aaf-sshsm / components / aaf-sshsm-distcenter / templates / job.yaml
1 {{/*
2 # Copyright 2018 Intel Corporation, Inc
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 apiVersion: batch/v1
18 kind: Job
19 metadata: {{- include "common.resourceMetadata" . | nindent 2 }}
20 spec:
21   serviceName:
22   template:
23     metadata: {{- include "common.templateMetadata" . | nindent 6 }}
24     spec:
25       restartPolicy: Never
26       initContainers:
27 {{- if .Values.global.tpm.enabled }}
28       - image: {{ include "repositoryGenerator.image.readiness" . }}
29         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
30         name: {{ include "common.name" . }}-readiness
31         command:
32         - /app/ready.py
33         args:
34         - -j
35         - "{{ include "common.release" . }}-aaf-sshsm-abrmd-init"
36         env:
37         - name: NAMESPACE
38           valueFrom:
39             fieldRef:
40               apiVersion: v1
41               fieldPath: metadata.namespace
42         resources:
43           limits:
44             cpu: 100m
45             memory: 100Mi
46           requests:
47             cpu: 3m
48             memory: 20Mi
49 {{ else }}
50       - image: {{ include "repositoryGenerator.repository" . }}/{{ .Values.image }}
51         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
52         name: {{ include "common.name" . }}-gen-passphrase
53         command: ["sh", "-c", "/usr/bin/openssl rand -base64 12 >/distcenter/data/passphrase"]
54         env:
55         - name: NAMESPACE
56           valueFrom:
57             fieldRef:
58               apiVersion: v1
59               fieldPath: metadata.namespace
60         volumeMounts:
61         - mountPath: /etc/localtime
62           name: localtime
63           readOnly: true
64         - name: {{ include "common.fullname" . }}-data
65           mountPath: /distcenter/data
66         resources:
67           limits:
68             cpu: 1
69             memory: 100Mi
70           requests:
71             cpu: 3m
72             memory: 20Mi
73 {{- end }}
74       containers:
75       - image: {{ include "repositoryGenerator.repository" . }}/{{ .Values.image }}
76         name: {{ include "common.name" . }}
77         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
78         command: ["/entrypoint.sh"]
79         workingDir: /distcenter
80         volumeMounts:
81         - mountPath: /etc/localtime
82           name: localtime
83           readOnly: true
84         - name: {{ include "common.fullname" . }}-data
85           mountPath: /distcenter/data
86         resources: {{ include "common.resources" . | nindent 10 }}
87         {{- if .Values.nodeSelector }}
88         nodeSelector: {{ toYaml .Values.nodeSelector | nindent 8 }}
89         {{- end -}}
90         {{- if .Values.affinity }}
91         affinity: {{ toYaml .Values.affinity | nindent 8 }}
92         {{- end }}
93       volumes:
94       - name: localtime
95         hostPath:
96           path: /etc/localtime
97       - name: {{ include "common.fullname" . }}-data
98         persistentVolumeClaim:
99           claimName: {{ include "common.release" . }}-aaf-sshsm
100       imagePullSecrets:
101       - name: "{{ include "common.namespace" . }}-docker-registry-key"