[AAF SMS] Use certInitializer for certificates
[oom.git] / kubernetes / aaf / components / aaf-sms / charts / aaf-sms-vault / templates / statefulset.yaml
1 # Copyright 2018 Intel Corporation, Inc
2 # Modifications © 2020 AT&T
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 apiVersion: apps/v1beta1
17 kind: StatefulSet
18 metadata:
19   name: {{ include "common.fullname" . }}
20   namespace: {{ include "common.namespace" . }}
21   labels:
22     app: {{ include "common.name" . }}
23     chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
24     release: {{ include "common.release" . }}
25     heritage: {{ .Release.Service }}
26 spec:
27   replicas: {{ .Values.replicaCount }}
28   serviceName:
29   template:
30     metadata:
31       labels:
32         app: {{ include "common.name" . }}
33         release: {{ include "common.release" . }}
34     spec:
35 {{- if .Values.persistence.enabled }}
36       initContainers:
37         - name: fix-permission
38           command:
39             - /bin/sh
40           args:
41             - -c
42             - |
43               chmod -R 775 /consul/data
44               chown -R 100:1000 /consul/data
45           image: "{{ .Values.global.busyboxRepository }}/{{ .Values.global.busyboxImage }}"
46           imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
47           volumeMounts:
48             - mountPath: /consul/data
49               name: {{ include "common.fullname" . }}-data
50 {{- end }}
51       containers:
52       - image: "{{ include "common.repository" . }}/{{ .Values.image.vault }}"
53         name: {{ include "common.name" . }}
54         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
55         args: ["server"]
56         ports:
57         - containerPort: {{ .Values.service.internalPort }}
58         volumeMounts:
59         - mountPath: /vault/config/config.json
60           name: {{ include "common.fullname" . }}-vault
61           subPath: config.json
62         - mountPath: /etc/localtime
63           name: localtime
64           readOnly: true
65         resources:
66 {{ include "common.resources" . | indent 10 }}
67       - image: "{{ include "common.repository" . }}/{{ .Values.image.consul }}"
68         name: {{ include "common.name" . }}-backend
69         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
70         args: ["agent","-server","-bind","0.0.0.0","-bootstrap-expect=1","-config-file","/consul/config/config.json"]
71         ports:
72         - name: http
73           containerPort: 8500
74         volumeMounts:
75 {{- if .Values.persistence.enabled }}
76         - mountPath: /consul/data
77           name: {{ include "common.fullname" . }}-data
78 {{- end }}
79         - mountPath: /consul/config/config.json
80           name: {{ include "common.fullname" . }}-consulconfiguration
81           subPath: config.json
82         - mountPath: /etc/localtime
83           name: localtime
84           readOnly: true
85         resources:
86 {{ include "common.resources" . | indent 10 }}
87       volumes:
88         - name: {{ include "common.fullname" . }}-consulconfiguration
89           configMap:
90             name: {{ include "common.fullname" . }}-consul
91         - name: {{ include "common.fullname" . }}-vault
92           configMap:
93             name: {{ include "common.fullname" . }}-vault
94         - name: localtime
95           hostPath:
96             path: /etc/localtime
97       imagePullSecrets:
98       - name: "{{ include "common.namespace" . }}-docker-registry-key"
99 {{- if .Values.persistence.enabled }}
100   volumeClaimTemplates:
101   - metadata:
102       name: {{ include "common.fullname" . }}-data
103       labels:
104         name: {{ include "common.fullname" . }}
105         chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
106         release: "{{ include "common.release" . }}"
107         heritage: "{{ .Release.Service }}"
108     spec:
109       accessModes:
110       - {{ .Values.persistence.accessMode | quote }}
111       storageClassName: {{ include "common.storageClass" . }}
112       resources:
113         requests:
114           storage: {{ .Values.persistence.size | quote }}
115 {{- end }}