[CONSUL] Add limits to consul chart.
[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/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 {{- if .Values.persistence.enabled }}
39       initContainers:
40         - name: fix-permission
41           command:
42             - /bin/sh
43           args:
44             - -c
45             - |
46               chmod -R 775 /consul/data
47               chown -R 100:1000 /consul/data
48           image: "{{ .Values.global.busyboxRepository }}/{{ .Values.global.busyboxImage }}"
49           imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
50           volumeMounts:
51             - mountPath: /consul/data
52               name: {{ include "common.fullname" . }}-data
53 {{- end }}
54       containers:
55       - image: "{{ include "common.repository" . }}/{{ .Values.image.vault }}"
56         name: {{ include "common.name" . }}
57         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
58         args: ["server"]
59         ports:
60         - containerPort: {{ .Values.service.internalPort }}
61         volumeMounts:
62         - mountPath: /vault/config/config.json
63           name: {{ include "common.fullname" . }}-vault
64           subPath: config.json
65         - mountPath: /etc/localtime
66           name: localtime
67           readOnly: true
68         resources:
69 {{ include "common.resources" . | indent 10 }}
70       - image: "{{ include "common.repository" . }}/{{ .Values.image.consul }}"
71         name: {{ include "common.name" . }}-backend
72         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
73         args: ["agent","-server","-bind","0.0.0.0","-bootstrap-expect=1","-config-file","/consul/config/config.json"]
74         ports:
75         - name: http
76           containerPort: 8500
77         volumeMounts:
78 {{- if .Values.persistence.enabled }}
79         - mountPath: /consul/data
80           name: {{ include "common.fullname" . }}-data
81 {{- end }}
82         - mountPath: /consul/config/config.json
83           name: {{ include "common.fullname" . }}-consulconfiguration
84           subPath: config.json
85         - mountPath: /etc/localtime
86           name: localtime
87           readOnly: true
88         resources:
89 {{ include "common.resources" . | indent 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 }}