Merge "[COMMON] Add monitoring to postgres"
[oom.git] / kubernetes / aaf / components / aaf-sms / components / aaf-sms-quorumclient / 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       imagePullSecrets:
41       - name: "{{ include "common.namespace" . }}-docker-registry-key"
42 {{- if .Values.persistence.enabled }}
43       initContainers:
44         - name: fix-permission
45           command:
46             - /bin/sh
47           args:
48             - -c
49             - |
50               chmod -R 775 /quorumclient/auth
51               chown -R 100:1000 /quorumclient/auth
52           image: {{ include "repositoryGenerator.image.busybox" . }}
53           imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
54           volumeMounts:
55             - mountPath: /quorumclient/auth
56               name: {{ include "common.fullname" . }}-data
57 {{- end }}
58       containers:
59       - image: {{ include "repositoryGenerator.repository" . }}/{{ .Values.image }}
60         name: {{ include "common.name" . }}
61         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
62         command: ["/quorumclient/bin/quorumclient"]
63         workingDir: /quorumclient/
64         volumeMounts:
65           - mountPath: /etc/localtime
66             name: localtime
67             readOnly: true
68           - mountPath: /quorumclient/config.json
69             name: {{ include "common.name" .}}
70             subPath: config.json
71 {{- if .Values.persistence.enabled }}
72           - mountPath: /quorumclient/auth
73             name: {{ include "common.fullname" . }}-data
74 {{- end }}
75         resources: {{ include "common.resources" . | nindent 10 }}
76         {{- if .Values.nodeSelector }}
77         nodeSelector:
78 {{ toYaml .Values.nodeSelector | indent 10 }}
79         {{- end -}}
80         {{- if .Values.affinity }}
81         affinity:
82 {{ toYaml .Values.affinity | indent 10 }}
83         {{- end }}
84       volumes:
85       - name: localtime
86         hostPath:
87           path: /etc/localtime
88       - name : {{ include "common.name" . }}
89         configMap:
90           name: {{ include "common.fullname" . }}
91           items:
92           - key: config.json
93             path: config.json
94             mode: 0755
95 {{- if .Values.persistence.enabled }}
96   volumeClaimTemplates:
97   - metadata:
98       name: {{ include "common.fullname" . }}-data
99       labels:
100         name: {{ include "common.fullname" . }}
101         chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
102         release: "{{ include "common.release" . }}"
103         heritage: "{{ .Release.Service }}"
104     spec:
105       accessModes:
106       - {{ .Values.persistence.accessMode | quote }}
107       storageClassName: {{ include "common.storageClass" . }}
108       resources:
109         requests:
110           storage: {{ .Values.persistence.size | quote }}
111 {{- end }}