Paramterize the configMap name
[demo.git] / vnfs / DAaaS / sample-apps / m3db_promql / templates / deployment.yaml
1 {{/*
2 # Copyright 2019 Intel Corporation, Inc
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
17 apiVersion: extensions/v1beta1
18 kind: Deployment
19 metadata:
20   name: {{ include "promql_query_app.fullname" . }}
21   labels:
22     app: {{ include "promql_query_app.name" . }}
23     chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
24     release: {{ .Release.Name }}
25     heritage: {{ .Release.Service | quote }}
26 spec:
27   replicas: 1
28   selector:
29     matchLabels:
30       app: {{ include "promql_query_app.name" . }}
31       release: {{ .Release.Name }}
32       modelName: {{ .Values.modelName }}
33   template:
34     metadata:
35       labels:
36         app: {{ include "promql_query_app.name" . }}
37         release: {{ .Release.Name }}
38         modelName: {{ .Values.modelName }}
39     spec:
40       serviceAccountName: {{ template "promql_query_app.serviceAccountName" . }}
41       containers:
42         - name: promql_query_app
43           image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
44           imagePullPolicy: {{ .Values.image.pullPolicy }}
45           env:
46             - name: DATA_ENDPOINT
47               valueFrom:
48                 configMapKeyRef:
49                   name: {{ if .Values.prometheus.configMapName }}{{ .Values.prometheus.configMapName }}{{ else }}{{ template "promql_query_app.fullname" . }}{{ end }}
50                   key: prometheus_endpoint
51             - name: AWS_ACCESS_KEY_ID
52               valueFrom:
53                 secretKeyRef:
54                   name: {{ if .Values.minio.existingSecret }}{{ .Values.minio.existingSecret }}{{ else }}{{ template "promql_query_app.fullname" . }}{{ end }}
55                   key: accesskey
56             - name: AWS_SECRET_ACCESS_KEY
57               valueFrom:
58                 secretKeyRef:
59                   name: {{ if .Values.minio.existingSecret }}{{ .Values.minio.existingSecret }}{{ else }}{{ template "promql_query_app.fullname" . }}{{ end }}
60                   key: secretkey
61             {{- range $key, $val := .Values.minio.environment }}
62             - name: {{ $key }}
63               value: {{ $val | quote }}
64             {{- end}}
65           resources:
66             {{ toYaml .Values.resources | indent 12 }}
67           volumeMounts:
68             - mountPath: /models
69               name: models
70       volumes:
71         - name: models
72           emptyDir: {}
73       {{- with .Values.nodeSelector }}
74       nodeSelector:
75         {{- toYaml . | nindent 8 }}
76       {{- end }}
77     {{- with .Values.affinity }}
78       affinity:
79         {{- toYaml . | nindent 8 }}
80     {{- end }}
81     {{- with .Values.tolerations }}
82       tolerations:
83         {{- toYaml . | nindent 8 }}
84     {{- end }}