[CONSUL] Add limits to consul chart.
[oom.git] / kubernetes / aaf / components / aaf-sms / charts / aaf-sms-quorumclient / 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/v1
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   selector:
29     matchLabels:
30       app: {{ include "common.name" . }}
31   serviceName: {{ include "common.servicename" . }}
32   template:
33     metadata:
34       labels:
35         app: {{ include "common.name" . }}
36         release: {{ include "common.release" . }}
37     spec:
38       imagePullSecrets:
39       - name: "{{ include "common.namespace" . }}-docker-registry-key"
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 /quorumclient/auth
49               chown -R 100:1000 /quorumclient/auth
50           image: "{{ .Values.global.busyboxRepository }}/{{ .Values.global.busyboxImage }}"
51           imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
52           volumeMounts:
53             - mountPath: /quorumclient/auth
54               name: {{ include "common.fullname" . }}-data
55 {{- end }}
56       containers:
57       - image: "{{ include "common.repository" . }}/{{ .Values.image }}"
58         name: {{ include "common.name" . }}
59         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
60         command: ["/quorumclient/bin/quorumclient"]
61         workingDir: /quorumclient/
62         volumeMounts:
63           - mountPath: /etc/localtime
64             name: localtime
65             readOnly: true
66           - mountPath: /quorumclient/config.json
67             name: {{ include "common.name" .}}
68             subPath: config.json
69 {{- if .Values.persistence.enabled }}
70           - mountPath: /quorumclient/auth
71             name: {{ include "common.fullname" . }}-data
72 {{- end }}
73         resources:
74 {{ include "common.resources" . | indent 10 }}
75         {{- if .Values.nodeSelector }}
76         nodeSelector:
77 {{ toYaml .Values.nodeSelector | indent 10 }}
78         {{- end -}}
79         {{- if .Values.affinity }}
80         affinity:
81 {{ toYaml .Values.affinity | indent 10 }}
82         {{- end }}
83       volumes:
84       - name: localtime
85         hostPath:
86           path: /etc/localtime
87       - name : {{ include "common.name" . }}
88         configMap:
89           name: {{ include "common.fullname" . }}
90           items:
91           - key: config.json
92             path: config.json
93             mode: 0755
94 {{- if .Values.persistence.enabled }}
95   volumeClaimTemplates:
96   - metadata:
97       name: {{ include "common.fullname" . }}-data
98       labels:
99         name: {{ include "common.fullname" . }}
100         chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
101         release: "{{ include "common.release" . }}"
102         heritage: "{{ .Release.Service }}"
103     spec:
104       accessModes:
105       - {{ .Values.persistence.accessMode | quote }}
106       storageClassName: {{ include "common.storageClass" . }}
107       resources:
108         requests:
109           storage: {{ .Values.persistence.size | quote }}
110 {{- end }}