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