mayankg2703 | ced8514 | 2018-03-20 05:42:53 +0000 | [diff] [blame] | 1 | # Copyright © 2017 Amdocs, Bell Canada |
| 2 | # |
| 3 | # Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | # you may not use this file except in compliance with the License. |
| 5 | # You may obtain a copy of the License at |
| 6 | # |
| 7 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | # |
| 9 | # Unless required by applicable law or agreed to in writing, software |
| 10 | # distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | # See the License for the specific language governing permissions and |
| 13 | # limitations under the License. |
| 14 | |
| 15 | apiVersion: extensions/v1beta1 |
| 16 | kind: Deployment |
| 17 | metadata: |
| 18 | name: {{ include "common.fullname" . }} |
| 19 | namespace: {{ include "common.namespace" . }} |
| 20 | labels: |
| 21 | app: {{ include "common.name" . }} |
| 22 | chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }} |
| 23 | release: {{ .Release.Name }} |
| 24 | heritage: {{ .Release.Service }} |
| 25 | spec: |
| 26 | replicas: {{ .Values.replicaCount }} |
| 27 | template: |
| 28 | metadata: |
| 29 | labels: |
| 30 | app: {{ include "common.name" . }} |
| 31 | release: {{ .Release.Name }} |
| 32 | spec: |
| 33 | initContainers: |
| 34 | - command: |
| 35 | - /root/ready.py |
| 36 | args: |
| 37 | - --container-name |
| 38 | - {{ .Values.global.mariadb.nameOverride }} |
| 39 | env: |
| 40 | - name: NAMESPACE |
| 41 | valueFrom: |
| 42 | fieldRef: |
| 43 | apiVersion: v1 |
| 44 | fieldPath: metadata.namespace |
| 45 | image: "{{ .Values.global.readinessRepository }}/{{ .Values.global.readinessImage }}" |
| 46 | imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }} |
| 47 | name: {{ include "common.name" . }}-readiness |
| 48 | - command: ["/bin/bash", "-c", "echo $POD_IP > /config/ip_addr.txt"] |
| 49 | env: |
| 50 | - name: POD_IP |
| 51 | valueFrom: |
| 52 | fieldRef: |
| 53 | apiVersion: v1 |
| 54 | fieldPath: status.podIP |
| 55 | volumeMounts: |
| 56 | - mountPath: /config/ |
| 57 | name: pe |
| 58 | image: {{ .Values.global.ubuntuImage }} |
| 59 | imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }} |
| 60 | name: generate-ip-addr-txt |
| 61 | containers: |
| 62 | - command: |
| 63 | - /bin/bash |
| 64 | - ./do-start.sh |
| 65 | - pap |
| 66 | name: {{ include "common.name" . }} |
| 67 | image: "{{ .Values.global.repository | default .Values.repository }}/{{ .Values.image }}" |
| 68 | imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }} |
| 69 | ports: |
| 70 | - containerPort: {{ .Values.service.externalPort }} |
| 71 | - containerPort: {{ .Values.service.externalPort2 }} |
| 72 | {{- if eq .Values.liveness.enabled true }} |
| 73 | livenessProbe: |
| 74 | tcpSocket: |
| 75 | port: {{ .Values.service.externalPort }} |
| 76 | initialDelaySeconds: {{ .Values.liveness.initialDelaySeconds }} |
| 77 | periodSeconds: {{ .Values.liveness.periodSeconds }} |
| 78 | {{ end -}} |
| 79 | readinessProbe: |
| 80 | tcpSocket: |
| 81 | port: {{ .Values.service.externalPort }} |
| 82 | initialDelaySeconds: {{ .Values.readiness.initialDelaySeconds }} |
| 83 | periodSeconds: {{ .Values.readiness.periodSeconds }} |
| 84 | env: |
| 85 | - name: PRELOAD_POLICIES |
| 86 | value: "{{ .Values.config.preloadPolicies }}" |
| 87 | volumeMounts: |
| 88 | - mountPath: /etc/localtime |
| 89 | name: localtime |
| 90 | readOnly: true |
| 91 | - mountPath: /tmp/policy-install/config/base.conf |
| 92 | name: pe |
| 93 | subPath: base.conf |
| 94 | - mountPath: /tmp/policy-install/config/ |
| 95 | name: pe-pap |
| 96 | - mountPath: /tmp/policy-install/do-start.sh |
| 97 | name: pe-scripts |
| 98 | subPath: do-start.sh |
| 99 | - mountPath: /var/log/onap |
| 100 | name: policy-logs |
| 101 | - mountPath: /tmp/policy-install/logback.xml |
| 102 | name: policy-sdk-logback |
| 103 | subPath: logback.xml |
| 104 | - mountPath: /tmp/logback.xml |
| 105 | name: policy-logback |
| 106 | subPath: logback.xml |
| 107 | lifecycle: |
| 108 | postStart: |
| 109 | exec: |
| 110 | command: ["/bin/sh", "-c", "export LOG=wait_logback.log; touch $LOG; export SRC=/tmp/logback.xml; export DST=/opt/app/policy/servers/pap/webapps/pap/WEB-INF/classes/; while [ ! -e $DST ]; do echo 'Waiting for $DST...' >> $LOG; sleep 5; done; sleep 2; /bin/cp -f $SRC $DST; export SRC=/tmp/policy-install/logback.xml; export DST=/opt/app/policy/servers/console/webapps/onap/WEB-INF/classes/; while [ ! -e $DST ]; do echo 'Waiting for $DST...' >> $LOG; sleep 5; done; sleep 2; /bin/cp -f $SRC $DST; echo 'Done' >> $LOG"] |
| 111 | - image: "{{ .Values.global.loggingRepository | default .Values.loggingRepository }}/{{ .Values.global.loggingImage | default .Values.loggingImage }}" |
| 112 | imagePullPolicy: {{ .Values.pullPolicy }} |
| 113 | name: filebeat-onap |
| 114 | volumeMounts: |
| 115 | - mountPath: /usr/share/filebeat/filebeat.yml |
| 116 | name: filebeat-conf |
| 117 | subPath: filebeat.yml |
| 118 | - mountPath: /var/log/onap |
| 119 | name: policy-logs |
| 120 | - mountPath: /usr/share/filebeat/data |
| 121 | name: policy-data-filebeat |
| 122 | resources: |
| 123 | {{ toYaml .Values.resources | indent 12 }} |
| 124 | {{- if .Values.nodeSelector }} |
| 125 | nodeSelector: |
| 126 | {{ toYaml .Values.nodeSelector | indent 10 }} |
| 127 | {{- end -}} |
| 128 | {{- if .Values.affinity }} |
| 129 | affinity: |
| 130 | {{ toYaml .Values.affinity | indent 10 }} |
| 131 | {{- end }} |
| 132 | volumes: |
| 133 | - name: localtime |
| 134 | hostPath: |
| 135 | path: /etc/localtime |
| 136 | - name: filebeat-conf |
| 137 | configMap: |
| 138 | name: {{ .Release.Name }}-filebeat-configmap |
| 139 | - name: policy-logs |
| 140 | emptyDir: {} |
| 141 | - name: policy-data-filebeat |
| 142 | emptyDir: {} |
| 143 | - name: policy-logback |
| 144 | configMap: |
| 145 | name: {{ include "common.fullname" . }}-log-configmap |
| 146 | - name: policy-sdk-logback |
| 147 | configMap: |
| 148 | name: {{ include "common.fullname" . }}-sdk-log-configmap |
| 149 | - name: pe |
| 150 | configMap: |
| 151 | name: {{ .Release.Name }}-pe-configmap |
| 152 | defaultMode: 0755 |
| 153 | - name: pe-scripts |
| 154 | configMap: |
| 155 | name: {{ .Release.Name }}-pe-scripts-configmap |
| 156 | defaultMode: 0777 |
| 157 | - name: pe-pap |
| 158 | configMap: |
| 159 | name: {{ include "common.fullname" . }}-pe-configmap |
| 160 | defaultMode: 0755 |
| 161 | imagePullSecrets: |
| 162 | - name: "{{ include "common.namespace" . }}-docker-registry-key" |