a7774e987895a93b9fa889680dfa44fa5260fb1d
[oom.git] / kubernetes / consul / templates / deployment.yaml
1 # Copyright © 2017 Amdocs, Bell Canada
2 # Modifications Copyright © 2018 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: Deployment
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   template:
32     metadata:
33       labels:
34         app: {{ include "common.name" . }}
35         release: {{ include "common.release" . }}
36       name: {{ include "common.name" . }}
37     spec:
38       imagePullSecrets:
39       - name: "{{ include "common.namespace" . }}-docker-registry-key"
40       containers:
41       - image: "{{ include "common.repository" . }}/{{ .Values.image }}"
42         command:
43         - /bin/sh
44         - "-c"
45         - |
46           apk update && apk add jq
47           cp /tmp/consul/config/* /consul/config
48           /usr/local/bin/docker-entrypoint.sh agent -client 0.0.0.0 -enable-script-checks -retry-join {{ .Values.consulServer.nameOverride }}
49         name: {{ include "common.name" . }}
50         env:
51           - name: SDNC_ODL_COUNT
52             value: "{{ .Values.sdnc.replicaCount }}"
53           - name: SDNC_IS_PRIMARY_CLUSTER
54             value: "{{ .Values.sdnc.config.isPrimaryCluster }}"
55         volumeMounts:
56         - mountPath: /tmp/consul/config
57           name: consul-agent-config
58         - mountPath: /consul/scripts
59           name: consul-agent-scripts-config
60         - mountPath: /consul/certs
61           name: consul-agent-certs-config
62       volumes:
63       - configMap:
64           name: {{ include "common.fullname" . }}-configmap
65         name: consul-agent-config
66       - configMap:
67           name: {{ include "common.fullname" . }}-scripts-configmap
68           defaultMode: 0755
69         name: consul-agent-scripts-config
70       - secret:
71           secretName: {{ include "common.fullname" . }}-certs-secret
72         name: consul-agent-certs-config