[DCAEMOD] Uses new tpls for repos / images
[oom.git] / kubernetes / aaf / components / aaf-sshsm / charts / aaf-sshsm-testca / 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.testca.enabled -}}
18
19 apiVersion: batch/v1
20 kind: Job
21 metadata: {{- include "common.resourceMetadata" . | nindent 2 }}
22 spec:
23   template:
24     metadata: {{- include "common.templateMetadata" . | nindent 6 }}
25     spec:
26       restartPolicy: Never
27       initContainers:
28       - image: "{{ include "common.repository" . }}/{{ .Values.global.readinessImage }}"
29         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
30         name: {{ include "common.name" . }}-distcenter-ready
31         command:
32         - /app/ready.py
33         args:
34         - -j
35         - "{{ include "common.release" . }}-aaf-sshsm-distcenter"
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 {{- if .Values.global.tpm.enabled }}
50       - image: "{{ include "common.repository" . }}/{{ .Values.image }}"
51         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
52         name: {{ include "common.name" . }}-abrmd-ready
53         command: ["sh", "/sshsm/bin/abrmd_ready.sh", "300"]
54         workingDir: /testca/bin
55         env:
56         - name: NAMESPACE
57           valueFrom:
58             fieldRef:
59               apiVersion: v1
60               fieldPath: metadata.namespace
61         volumeMounts:
62         - name: {{ include "common.fullname" . }}-dbus
63           mountPath: /var/run/dbus
64         resources:
65           limits:
66             cpu: 100m
67             memory: 100Mi
68           requests:
69             cpu: 3m
70             memory: 20Mi
71 {{- end }}
72       containers:
73       - image: "{{ include "common.repository" . }}/{{ .Values.image }}"
74         name: {{ include "common.name" . }}
75         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
76         command: ["./import.sh"]
77         workingDir: /testca/bin
78         env:
79 {{- if .Values.global.tpm.enabled }}
80         - name: TPM_NODE_NAME
81           valueFrom:
82             fieldRef:
83               fieldPath: spec.nodeName
84         - name: DATA_FOLDER
85           value: /testca/data/host_$(TPM_NODE_NAME)
86 {{ else }}
87         - name: DATA_FOLDER
88           value: /testca/data
89 {{- end }}
90         - name: SECRETS_FOLDER
91           value: /testca/secrets
92         volumeMounts:
93         - mountPath: /etc/localtime
94           name: localtime
95           readOnly: true
96         - name: {{ include "common.fullname" . }}-data
97           mountPath: /testca/data
98         - name: {{ include "common.fullname" . }}-dbus
99           mountPath: /var/run/dbus
100         - name: {{ include "common.fullname" . }}-secrets
101           mountPath: /testca/secrets
102           readOnly: true
103         resources: {{ include "common.resources" . | nindent 10 }}
104       nodeSelector:
105         {{- if .Values.nodeSelector }}
106 {{ toYaml .Values.nodeSelector | indent 8 }}
107         {{- end -}}
108         {{- if .Values.global.tpm.enabled }}
109         {{ (printf "%s: \"%s\"" .Values.global.tpm.nodeLabel .Values.global.tpm.nodeLabelValue) }}
110         {{- end -}}
111         {{- if .Values.affinity }}
112       affinity: {{ toYaml .Values.affinity | nindent 8 }}
113         {{- end }}
114       volumes:
115       - name: localtime
116         hostPath:
117           path: /etc/localtime
118       - name: {{ include "common.fullname" . }}-data
119         persistentVolumeClaim:
120           claimName: {{ include "common.release" . }}-aaf-sshsm
121       - name: {{ include "common.fullname" . }}-dbus
122         persistentVolumeClaim:
123           claimName: {{ include "common.release" . }}-aaf-sshsm-dbus
124       - name: {{ include "common.fullname" . }}-secrets
125         secret:
126           secretName: {{ include "common.release" . }}-aaf-sshsm
127       imagePullSecrets:
128       - name: "{{ include "common.namespace" . }}-docker-registry-key"
129
130 {{- end -}}