Sylvain Desbureaux | 8f9ef35 | 2020-04-14 15:02:57 +0200 | [diff] [blame] | 1 | {*/ |
| 2 | # Copyright © 2020 AT&T, Orange |
| 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 | {{- define "aaf.permissionFixer" -}} |
| 18 | - name: fix-permission |
| 19 | command: |
| 20 | - /bin/sh |
| 21 | args: |
| 22 | - -c |
| 23 | - | |
| 24 | chown -R 1000:1000 /opt/app/aaf |
| 25 | chown -R 1000:1000 /opt/app/osaaf |
| 26 | image: "{{ .Values.global.busyboxRepository }}/{{ .Values.global.busyboxImage }}" |
| 27 | imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }} |
| 28 | volumeMounts: |
| 29 | - mountPath: /opt/app/osaaf |
| 30 | name: aaf-config-vol |
| 31 | resources: |
| 32 | limits: |
| 33 | cpu: 100m |
| 34 | memory: 100Mi |
| 35 | requests: |
| 36 | cpu: 3m |
| 37 | memory: 20Mi |
| 38 | {{- end -}} |
| 39 | |
| 40 | {{- define "aaf.podConfiguration" }} |
| 41 | - name: {{ include "common.name" . }}-config-container |
| 42 | image: {{ .Values.global.repository }}/{{.Values.global.aaf.config.image}} |
| 43 | imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }} |
| 44 | command: |
| 45 | - /bin/bash |
| 46 | args: |
| 47 | - -c |
| 48 | - | |
| 49 | cd /opt/app/aaf_config |
| 50 | bin/agent.sh |
| 51 | volumeMounts: |
| 52 | - mountPath: "/opt/app/osaaf" |
| 53 | name: aaf-config-vol |
| 54 | env: |
| 55 | - name: aaf_env |
| 56 | value: "{{ .Values.global.aaf.aaf_env }}" |
| 57 | - name: cadi_latitude |
| 58 | value: "{{ .Values.global.aaf.cadi_latitude }}" |
| 59 | - name: cadi_longitude |
| 60 | value: "{{ .Values.global.aaf.cadi_longitude }}" |
| 61 | - name: cadi_x509_issuers |
| 62 | value: "{{ .Values.global.aaf.cadi_x509_issuers }}" |
| 63 | - name: aaf_locate_url |
| 64 | value: "https://aaf-locate.{{ .Release.Namespace}}:8095" |
| 65 | - name: aaf_locator_container |
| 66 | value: "oom" |
| 67 | - name: aaf_release |
| 68 | value: "{{ .Values.global.aaf.aaf_release }}" |
| 69 | - name: aaf_locator_container_ns |
| 70 | valueFrom: |
| 71 | fieldRef: |
| 72 | apiVersion: v1 |
| 73 | fieldPath: metadata.namespace |
| 74 | - name: aaf_locator_public_fqdn |
| 75 | value: "{{.Values.global.aaf.public_fqdn}}" |
| 76 | - name: aaf_locator_name |
| 77 | value: "{{.Values.global.aaf.aaf_locator_name}}" |
| 78 | - name: aaf_locator_name_oom |
| 79 | value: "{{.Values.global.aaf.aaf_locator_name_oom}}" |
| 80 | - name: cm_always_ignore_ips |
| 81 | value: "true" |
| 82 | - name: CASSANDRA_CLUSTER |
| 83 | value: "aaf-cass.{{ .Release.Namespace }}" |
| 84 | resources: |
| 85 | limits: |
| 86 | cpu: 100m |
| 87 | memory: 100Mi |
| 88 | requests: |
| 89 | cpu: 3m |
| 90 | memory: 20Mi |
| 91 | {{- end -}} |
| 92 | |
| 93 | {{- define "aaf.initContainers" -}} |
| 94 | initContainers: |
| 95 | {{ include "aaf.permissionFixer" . }} |
| 96 | {{- if .Values.sequence_order }} |
| 97 | - name: {{ include "common.name" . }}-aaf-readiness |
| 98 | command: |
| 99 | - /root/ready.py |
| 100 | args: |
| 101 | {{- range $container := .Values.sequence_order }} |
| 102 | - --container-name |
| 103 | - aaf-{{ $container}} |
| 104 | {{- end }} |
| 105 | env: |
| 106 | - name: NAMESPACE |
| 107 | valueFrom: |
| 108 | fieldRef: |
| 109 | apiVersion: v1 |
| 110 | fieldPath: metadata.namespace |
| 111 | image: "{{ .Values.global.readinessRepository }}/{{ .Values.global.readinessImage }}" |
| 112 | imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }} |
| 113 | resources: |
| 114 | limits: |
| 115 | cpu: 100m |
| 116 | memory: 100Mi |
| 117 | requests: |
| 118 | cpu: 3m |
| 119 | memory: 20Mi |
| 120 | {{- end }} |
| 121 | {{ include "aaf.podConfiguration" . }} |
| 122 | {{- end }} |