Merge R3 into master
[it/dep.git] / ric-aux / helm / aaf / charts / aaf-sshsm / charts / aaf-sshsm-abrmd / templates / statefulset.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 and .Values.global.tpm.enabled .Values.global.abrmd.enabled -}}
18
19 apiVersion: apps/v1
20 kind: StatefulSet
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   selector:
32     matchLabels:
33       app: {{ include "common.name" . }}
34       release: {{ .Release.Name }}
35   serviceName:
36   template:
37     metadata:
38       labels:
39         app: {{ include "common.name" . }}
40         release: {{ .Release.Name }}
41     spec:
42       initContainers:
43       - image:  "{{ .Values.global.readinessRepository }}/{{ .Values.global.readinessImage }}"
44         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
45         name: {{ include "common.name" . }}-job-complete
46         command:
47         - /root/job_complete.py
48         args:
49         - -j
50         - "{{ include "common.fullname" . }}-init"
51         env:
52         - name: NAMESPACE
53           valueFrom:
54             fieldRef:
55               apiVersion: v1
56               fieldPath: metadata.namespace
57       containers:
58       - image: "{{ include "common.repository" . }}/{{ .Values.image }}"
59         name: {{ include "common.name" . }}
60         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
61         command: ["/abrmd/bin/run_abrmd.sh"]
62         workingDir: /abrmd/bin
63         securityContext:
64           privileged: true
65         volumeMounts:
66         - name: {{ include "common.fullname" . }}-dbus
67           mountPath: /var/run/dbus
68         - name: {{ include "common.fullname" . }}-tpm-device
69           mountPath: /dev/tpm0
70         - mountPath: /etc/localtime
71           name: localtime
72           readOnly: true
73         resources:
74 {{ toYaml .Values.resources | indent 10 }}
75       nodeSelector:
76         {{- if .Values.nodeSelector }}
77 {{ toYaml .Values.nodeSelector | indent 8 }}
78         {{- end -}}
79         {{- if .Values.global.tpm.enabled }}
80         {{ (printf "%s: \"%s\"" .Values.global.tpm.nodeLabel .Values.global.tpm.nodeLabelValue) }}
81         {{- end -}}
82         {{- if .Values.affinity }}
83       affinity:
84 {{ toYaml .Values.affinity | indent 8 }}
85         {{- end }}
86       volumes:
87       - name: localtime
88         hostPath:
89           path: /etc/localtime
90       - name: {{ include "common.fullname" . }}-dbus
91         persistentVolumeClaim:
92           claimName: {{ .Release.Name }}-aaf-sshsm-dbus
93       - name: {{ include "common.fullname" . }}-tpm-device
94         hostPath:
95           path: /dev/tpm0
96
97 {{- end -}}