Sylvain Desbureaux | 7007041 | 2020-11-09 21:58:48 +0100 | [diff] [blame] | 1 | # Copyright (c) 2018 Amdocs, Bell Canada, AT&T |
Sylvain Desbureaux | 5b65132 | 2020-12-07 15:34:15 +0100 | [diff] [blame] | 2 | # Modifications Copyright (c) 2020 Nokia, Orange |
Sylvain Desbureaux | 7007041 | 2020-11-09 21:58:48 +0100 | [diff] [blame] | 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: apps/v1 |
| 18 | kind: Deployment |
| 19 | metadata: |
| 20 | name: {{ include "common.fullname" . }} |
| 21 | namespace: {{ include "common.namespace" . }} |
| 22 | labels: |
| 23 | app: {{ include "common.name" . }} |
| 24 | chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }} |
| 25 | release: {{ include "common.release" . }} |
| 26 | heritage: {{ .Release.Service }} |
| 27 | spec: |
| 28 | selector: |
| 29 | matchLabels: |
| 30 | app: {{ include "common.name" . }} |
| 31 | replicas: {{ .Values.replicaCount }} |
| 32 | template: |
| 33 | metadata: |
| 34 | labels: |
| 35 | app: {{ include "common.name" . }} |
| 36 | release: {{ include "common.release" . }} |
| 37 | name: {{ include "common.release" . }} |
| 38 | annotations: |
| 39 | checksum/config: {{ include (print $.Template.BasePath "/configmap.yaml") . | sha256sum }} |
| 40 | spec: |
| 41 | initContainers: |
| 42 | - command: |
| 43 | - /app/ready.py |
| 44 | args: |
| 45 | - --container-name |
| 46 | - aai-resources |
| 47 | - --container-name |
| 48 | - aai-traversal |
| 49 | - --container-name |
| 50 | - aai-graphadmin |
| 51 | env: |
| 52 | - name: NAMESPACE |
| 53 | valueFrom: |
| 54 | fieldRef: |
| 55 | apiVersion: v1 |
| 56 | fieldPath: metadata.namespace |
Sylvain Desbureaux | 5b65132 | 2020-12-07 15:34:15 +0100 | [diff] [blame] | 57 | image: {{ include "repositoryGenerator.image.readiness" . }} |
Sylvain Desbureaux | 7007041 | 2020-11-09 21:58:48 +0100 | [diff] [blame] | 58 | imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }} |
| 59 | name: {{ include "common.name" . }}-readiness |
| 60 | containers: |
| 61 | - name: {{ include "common.name" . }} |
Sylvain Desbureaux | 5b65132 | 2020-12-07 15:34:15 +0100 | [diff] [blame] | 62 | image: "{{ include "repositoryGenerator.dockerHubRepository" . }}/{{ .Values.image }}" |
Sylvain Desbureaux | 7007041 | 2020-11-09 21:58:48 +0100 | [diff] [blame] | 63 | imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }} |
| 64 | volumeMounts: |
| 65 | - mountPath: /etc/localtime |
| 66 | name: localtime |
| 67 | readOnly: true |
| 68 | - mountPath: /dev/log |
| 69 | name: aai-service-log |
| 70 | - mountPath: /usr/local/etc/haproxy/haproxy.cfg |
| 71 | {{ if .Values.global.installSidecarSecurity }} |
| 72 | subPath: haproxy-pluggable-security.cfg |
| 73 | {{ else }} |
| 74 | subPath: haproxy.cfg |
| 75 | {{ end }} |
| 76 | name: haproxy-cfg |
| 77 | - mountPath: /etc/ssl/private/aai.pem |
| 78 | name: aai-pem |
| 79 | subPath: aai.pem |
| 80 | ports: |
| 81 | - containerPort: {{ .Values.service.internalPort }} |
| 82 | # disable liveness probe when breakpoints set in debugger |
| 83 | # so K8s doesn't restart unresponsive container |
| 84 | {{- if eq .Values.liveness.enabled true }} |
| 85 | livenessProbe: |
| 86 | tcpSocket: |
| 87 | port: {{ .Values.service.internalPort }} |
| 88 | initialDelaySeconds: {{ .Values.liveness.initialDelaySeconds }} |
| 89 | periodSeconds: {{ .Values.liveness.periodSeconds }} |
| 90 | {{ end -}} |
| 91 | readinessProbe: |
| 92 | httpGet: |
| 93 | path: /aai/util/echo |
| 94 | port: {{ .Values.service.internalPort }} |
| 95 | scheme: HTTPS |
| 96 | httpHeaders: |
| 97 | - name: X-FromAppId |
| 98 | value: OOM_ReadinessCheck |
| 99 | {{ if .Values.global.installSidecarSecurity }} |
| 100 | - name: Authorization |
| 101 | value: Basic YWFpQGFhaS5vbmFwLm9yZzpkZW1vMTIzNDU2IQ== |
| 102 | {{ end }} |
| 103 | - name: X-TransactionId |
| 104 | value: OOM_ReadinessCheck_TID |
| 105 | - name: Accept |
| 106 | value: application/json |
| 107 | initialDelaySeconds: {{ .Values.readiness.initialDelaySeconds }} |
| 108 | periodSeconds: {{ .Values.readiness.periodSeconds }} |
| 109 | resources: |
| 110 | {{ include "common.resources" . }} |
| 111 | {{- if .Values.nodeSelector }} |
| 112 | nodeSelector: |
| 113 | {{ toYaml .Values.nodeSelector | indent 8 }} |
| 114 | {{- end -}} |
| 115 | {{- if .Values.affinity }} |
| 116 | affinity: |
| 117 | {{ toYaml .Values.affinity | indent 8 }} |
| 118 | {{- end }} |
| 119 | |
| 120 | volumes: |
| 121 | - name: localtime |
| 122 | hostPath: |
| 123 | path: /etc/localtime |
| 124 | - name: aai-service-log |
| 125 | hostPath: |
| 126 | path: "/dev/log" |
| 127 | - name: haproxy-cfg |
| 128 | configMap: |
| 129 | name: aai-deployment-configmap |
| 130 | - name: aai-pem |
| 131 | secret: |
| 132 | secretName: aai-haproxy-secret |
| 133 | imagePullSecrets: |
| 134 | - name: "{{ include "common.namespace" . }}-docker-registry-key" |