Merge "[UUI] Service Mesh Compliance for UUI"
[oom.git] / kubernetes / aaf / components / aaf-templates / templates / _initContainers.tpl
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: onboard-identity-and-fix-permission
19   command:
20   - /bin/sh
21   args:
22   - -c
23   - |
24     echo "*** Move files from configmap to emptyDir"
25     cp -L /config-input-identity/* /config-identity/
26     echo "*** set righ user to the different folders"
27     chown -R 1000:1000 /config-identity
28     chown -R 1000:1000 /opt/app/aaf
29     chown -R 1000:1000 /opt/app/osaaf
30   image: {{ include "repositoryGenerator.image.busybox" . }}
31   imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
32   volumeMounts:
33   - mountPath: /opt/app/osaaf
34     name: aaf-config-vol
35   - mountPath: /config-input-identity
36     name: config-init-identity
37   - mountPath: /config-identity
38     name: config-identity
39   resources:
40     limits:
41       cpu: 100m
42       memory: 100Mi
43     requests:
44       cpu: 3m
45       memory: 20Mi
46 {{- end -}}
47
48 {{- define "aaf.podConfiguration" }}
49 - name: {{ include "common.name" . }}-config-container
50   image: {{ include "repositoryGenerator.repository" . }}/{{.Values.global.aaf.config.image}}
51   imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
52   command:
53   - /bin/bash
54   args:
55   - -c
56   - |
57     cd /opt/app/aaf_config
58     bin/agent.sh
59   volumeMounts:
60   - mountPath: "/opt/app/osaaf"
61     name: aaf-config-vol
62   env:
63   - name: aaf_env
64     value: "{{ .Values.global.aaf.aaf_env }}"
65   - name: cadi_latitude
66     value: "{{ .Values.global.aaf.cadi_latitude }}"
67   - name: cadi_longitude
68     value: "{{ .Values.global.aaf.cadi_longitude }}"
69   - name: cadi_x509_issuers
70     value: "{{ .Values.global.aaf.cadi_x509_issuers }}"
71   - name: aaf_locate_url
72     value: "https://aaf-locate.{{ .Release.Namespace}}:8095"
73   - name: aaf_locator_container
74     value: "oom"
75   - name: aaf_release
76     value: "{{ .Values.global.aaf.aaf_release }}"
77   - name: aaf_locator_container_ns
78     valueFrom:
79       fieldRef:
80         apiVersion: v1
81         fieldPath: metadata.namespace
82   - name: aaf_locator_public_fqdn
83     value: "{{.Values.global.aaf.public_fqdn}}"
84   - name: aaf_locator_name
85     value: "{{.Values.global.aaf.aaf_locator_name}}"
86   - name: aaf_locator_name_oom
87     value: "{{.Values.global.aaf.aaf_locator_name_oom}}"
88   - name: cm_always_ignore_ips
89     value: "true"
90   - name: CASSANDRA_CLUSTER
91     value: "aaf-cass.{{ .Release.Namespace }}"
92   resources:
93     limits:
94       cpu: 100m
95       memory: 100Mi
96     requests:
97       cpu: 3m
98       memory: 20Mi
99 {{- end -}}
100
101 {{- define "aaf.initContainers" -}}
102 initContainers:
103 {{   include "aaf.permissionFixer"  . }}
104 {{-   if .Values.sequence_order }}
105 - name: {{ include "common.name" . }}-aaf-readiness
106   command:
107   - /app/ready.py
108   args:
109   {{- range $container := .Values.sequence_order }}
110   - --container-name
111   - aaf-{{ $container}}
112   {{- end }}
113   env:
114   - name: NAMESPACE
115     valueFrom:
116       fieldRef:
117         apiVersion: v1
118         fieldPath: metadata.namespace
119   image: {{ include "repositoryGenerator.image.readiness" . }}
120   imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
121   resources:
122     limits:
123       cpu: 100m
124       memory: 100Mi
125     requests:
126       cpu: 3m
127       memory: 20Mi
128 {{-   end }}
129 {{   include "aaf.podConfiguration" . }}
130 {{- end }}