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