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