Merge "Bump up version to 1.3.0-SNAPSHOT"
[oom.git] / kubernetes / aaf / charts / 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:
22   name: {{ include "common.fullname" . }}
23   namespace: {{ include "common.namespace" . }}
24   labels:
25     app: {{ include "common.name" . }}
26     chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
27     release: {{ .Release.Name }}
28     heritage: {{ .Release.Service }}
29 spec:
30   replicas: {{ .Values.replicaCount }}
31   serviceName:
32   template:
33     metadata:
34       labels:
35         app: {{ include "common.name" . }}
36         release: {{ .Release.Name }}
37     spec:
38       restartPolicy: Never
39       initContainers:
40       - image: "{{ .Values.global.readinessRepository }}/{{ .Values.global.readinessImage }}"
41         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
42         name: {{ include "common.name" . }}-distcenter-ready
43         command:
44         - /root/job_complete.py
45         args:
46         - -j
47         - "{{ .Release.Name }}-aaf-sshsm-distcenter"
48         env:
49         - name: NAMESPACE
50           valueFrom:
51             fieldRef:
52               apiVersion: v1
53               fieldPath: metadata.namespace
54 {{- if .Values.global.tpm.enabled }}
55       - image: "{{ include "common.repository" . }}/{{ .Values.image }}"
56         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
57         name: {{ include "common.name" . }}-abrmd-ready
58         command: ["sh", "/sshsm/bin/abrmd_ready.sh", "300"]
59         workingDir: /testca/bin
60         env:
61         - name: NAMESPACE
62           valueFrom:
63             fieldRef:
64               apiVersion: v1
65               fieldPath: metadata.namespace
66         volumeMounts:
67         - name: {{ include "common.fullname" . }}-dbus
68           mountPath: /var/run/dbus
69 {{- end }}
70       containers:
71       - image: "{{ include "common.repository" . }}/{{ .Values.image }}"
72         name: {{ include "common.name" . }}
73         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
74         command: ["./import.sh"]
75         workingDir: /testca/bin
76         env:
77 {{- if .Values.global.tpm.enabled }}
78         - name: TPM_NODE_NAME
79           valueFrom:
80             fieldRef:
81               fieldPath: spec.nodeName
82         - name: DATA_FOLDER
83           value: /testca/data/host_$(TPM_NODE_NAME)
84 {{ else }}
85         - name: DATA_FOLDER
86           value: /testca/data
87 {{- end }}
88         - name: SECRETS_FOLDER
89           value: /testca/secrets
90         volumeMounts:
91         - mountPath: /etc/localtime
92           name: localtime
93           readOnly: true
94         - name: {{ include "common.fullname" . }}-data
95           mountPath: /testca/data
96         - name: {{ include "common.fullname" . }}-dbus
97           mountPath: /var/run/dbus
98         - name: {{ include "common.fullname" . }}-secrets
99           mountPath: /testca/secrets
100           readOnly: true
101         resources:
102 {{ toYaml .Values.resources | indent 10 }}
103       nodeSelector:
104         {{- if .Values.nodeSelector }}
105 {{ toYaml .Values.nodeSelector | indent 8 }}
106         {{- end -}}
107         {{- if .Values.global.tpm.enabled }}
108         {{ (printf "%s: \"%s\"" .Values.global.tpm.nodeLabel .Values.global.tpm.nodeLabelValue) }}
109         {{- end -}}
110         {{- if .Values.affinity }}
111       affinity:
112 {{ toYaml .Values.affinity | indent 8 }}
113         {{- end }}
114       volumes:
115       - name: localtime
116         hostPath:
117           path: /etc/localtime
118       - name: {{ include "common.fullname" . }}-data
119         persistentVolumeClaim:
120           claimName: {{ .Release.Name }}-aaf-sshsm-data
121       - name: {{ include "common.fullname" . }}-dbus
122         persistentVolumeClaim:
123           claimName: {{ .Release.Name }}-aaf-sshsm-dbus
124       - name: {{ include "common.fullname" . }}-secrets
125         secret:
126           secretName: {{ .Release.Name }}-aaf-sshsm
127       imagePullSecrets:
128       - name: "{{ include "common.namespace" . }}-docker-registry-key"
129
130 {{- end -}}