Merge "[COMMON] Add monitoring to postgres"
[oom.git] / kubernetes / aaf / components / aaf-sms / components / aaf-sms-vault / templates / statefulset.yaml
1 {{/*
2 # Copyright 2018 Intel Corporation, Inc
3 # Modifications © 2020 AT&T
4 #
5 # Licensed under the Apache License, Version 2.0 (the "License");
6 # you may not use this file except in compliance with the License.
7 # You may obtain a copy of the License at
8 #
9 #       http://www.apache.org/licenses/LICENSE-2.0
10 #
11 # Unless required by applicable law or agreed to in writing, software
12 # distributed under the License is distributed on an "AS IS" BASIS,
13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 # See the License for the specific language governing permissions and
15 # limitations under the License.
16 */}}
17
18 apiVersion: apps/v1
19 kind: StatefulSet
20 metadata:
21   name: {{ include "common.fullname" . }}
22   namespace: {{ include "common.namespace" . }}
23   labels:
24     app: {{ include "common.name" . }}
25     chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
26     release: {{ include "common.release" . }}
27     heritage: {{ .Release.Service }}
28 spec:
29   replicas: {{ .Values.replicaCount }}
30   selector:
31     matchLabels:
32       app: {{ include "common.name" . }}
33   serviceName: {{ include "common.servicename" . }}
34   template:
35     metadata:
36       labels:
37         app: {{ include "common.name" . }}
38         release: {{ include "common.release" . }}
39     spec:
40 {{- if .Values.persistence.enabled }}
41       initContainers:
42         - name: fix-permission
43           command:
44             - /bin/sh
45           args:
46             - -c
47             - |
48               chmod -R 775 /consul/data
49               chown -R 100:1000 /consul/data
50           image: {{ include "repositoryGenerator.image.busybox" . }}
51           imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
52           volumeMounts:
53             - mountPath: /consul/data
54               name: {{ include "common.fullname" . }}-data
55 {{- end }}
56       containers:
57       - image: {{ include "repositoryGenerator.dockerHubRepository" . }}/{{ .Values.image.vault }}
58         name: {{ include "common.name" . }}
59         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
60         args: ["server"]
61         ports:
62         - containerPort: {{ .Values.service.internalPort }}
63         volumeMounts:
64         - mountPath: /vault/config/config.json
65           name: {{ include "common.fullname" . }}-vault
66           subPath: config.json
67         - mountPath: /etc/localtime
68           name: localtime
69           readOnly: true
70         resources: {{ include "common.resources" . | nindent 10 }}
71       - image: {{ include "repositoryGenerator.dockerHubRepository" . }}/{{ .Values.image.consul }}
72         name: {{ include "common.name" . }}-backend
73         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
74         args: ["agent","-server","-bind","0.0.0.0","-bootstrap-expect=1","-config-file","/consul/config/config.json"]
75         ports:
76         - name: http
77           containerPort: 8500
78         volumeMounts:
79 {{- if .Values.persistence.enabled }}
80         - mountPath: /consul/data
81           name: {{ include "common.fullname" . }}-data
82 {{- end }}
83         - mountPath: /consul/config/config.json
84           name: {{ include "common.fullname" . }}-consulconfiguration
85           subPath: config.json
86         - mountPath: /etc/localtime
87           name: localtime
88           readOnly: true
89         resources: {{ include "common.resources" . | nindent 10 }}
90       volumes:
91         - name: {{ include "common.fullname" . }}-consulconfiguration
92           configMap:
93             name: {{ include "common.fullname" . }}-consul
94         - name: {{ include "common.fullname" . }}-vault
95           configMap:
96             name: {{ include "common.fullname" . }}-vault
97         - name: localtime
98           hostPath:
99             path: /etc/localtime
100       imagePullSecrets:
101       - name: "{{ include "common.namespace" . }}-docker-registry-key"
102 {{- if .Values.persistence.enabled }}
103   volumeClaimTemplates:
104   - metadata:
105       name: {{ include "common.fullname" . }}-data
106       labels:
107         name: {{ include "common.fullname" . }}
108         chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
109         release: "{{ include "common.release" . }}"
110         heritage: "{{ .Release.Service }}"
111     spec:
112       accessModes:
113       - {{ .Values.persistence.accessMode | quote }}
114       storageClassName: {{ include "common.storageClass" . }}
115       resources:
116         requests:
117           storage: {{ .Values.persistence.size | quote }}
118 {{- end }}