################################################################################ # Copyright (c) 2019 AT&T Intellectual Property. # # # # Licensed under the Apache License, Version 2.0 (the "License"); # # you may not use this file except in compliance with the License. # # You may obtain a copy of the License at # # # # http://www.apache.org/licenses/LICENSE-2.0 # # # # Unless required by applicable law or agreed to in writing, software # # distributed under the License is distributed on an "AS IS" BASIS, # # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # # See the License for the specific language governing permissions and # # limitations under the License. # ################################################################################' apiVersion: apps/v1 kind: Deployment metadata: name: {{ include "ricxapp.fullname" . }} labels: app: {{ include "ricxapp.namespace" . }}-{{ include "ricxapp.name" . }} chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }} release: {{ .Release.Name }} heritage: {{ .Release.Service }} spec: replicas: {{ .Values.replicaCount }} selector: matchLabels: app: {{ include "ricxapp.namespace" . }}-{{ include "ricxapp.name" . }} release: {{ .Release.Name }} template: metadata: {{- if .Values.annotations }} annotations: {{- range $key, $value := .Values.annotations }} {{- if kindIs "string" $value }} {{ $key }}: {{ $value | toPrettyJson }} {{- else }} {{ $key }}: | {{- $value | toPrettyJson | nindent 10 }} {{- end }} {{- end -}} {{ end }} labels: app: {{ include "ricxapp.namespace" . }}-{{ include "ricxapp.name" . }} kubernetes_name: {{ include "ricxapp.namespace" . }}_{{ include "ricxapp.name" . }} release: {{ .Release.Name }} spec: hostname: {{ include "ricxapp.name" . }} imagePullSecrets: {{- range .Values.containers }} - name: {{ .image.registry | replace "." "-" | replace ":" "-" | replace "/" "-" | trunc 63 | trimSuffix "-" }} {{- end }} volumes: - name: config-volume configMap: name: {{ include "ricxapp.configmapname" . }}-appconfig {{- if .Values.controls }} {{- if .Values.controls.fileStorage }} - name: diskwriter hostPath: path: {{ .Values.storage.mountPath }} type: DirectoryOrCreate {{- end }} {{- end }} containers: {{- $containers := .Values.containers }} {{- $ports := .Values.messaging.ports }} {{- range $container := $containers }} {{- $portlist := list }} {{- range $port := $ports }} {{- if eq $port.container $container.name }} {{- $portlist = append $portlist $port }} {{- end }} {{- end }} - name: {{ $container.name }} image: "{{ $container.image.registry }}/{{ $container.image.name }}:{{ $container.image.tag }}" {{- if $container.command }} command: [ {{- range $command := $container.command -}} {{- $command | quote -}} {{- if ne $command (last $container.command) }} {{- print ", " -}} {{- end -}} {{- end -}} {{- print "]" -}} {{- end}} {{- if $container.args }} args: [ {{- range $arg := $container.args -}} {{- $arg | quote -}} {{- if ne $arg (last $container.args) }} {{- print ", " -}} {{- end -}} {{- end -}} {{- print "]" -}} {{- end}} imagePullPolicy: {{ $.Values.image_pull_policy }} {{- if $portlist }} ports: {{- range $port := $portlist }} - name: {{ $port.name }} containerPort: {{ $port.port }} protocol: TCP {{- end }} {{- end }} {{- end }} volumeMounts: - name: config-volume mountPath: {{ .Values.appconfig.path }} {{- if .Values.controls }} {{- if .Values.controls.fileStorage }} - name: diskwriter mountPath: {{ .Values.storage.mountPath }} {{- end }} {{- end }} envFrom: - configMapRef: name: {{ include "ricxapp.configmapname" . }}-appenv - configMapRef: name: dbaas-appconfig