summaryrefslogtreecommitdiffstats
path: root/templates/job.yaml
blob: 85c09402a2483e07899b9801227ee8b1a151b67f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
# Copyright © 2017 Amdocs, Bell Canada
#
# 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: batch/v1
kind: Job
metadata:
  name: {{ include "common.fullname" . }}-create-config
  namespace: {{ include "common.namespace" . }}
  labels:
    app: {{ include "common.name" . }}
    chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
    release: {{ .Release.Name }}
    heritage: {{ .Release.Service }}
spec:
  template:
    metadata:
      labels:
        app: aaf-init-job
        release: {{ .Release.Name }}
    spec:
      initContainers:
      - name: {{ include "common.name" . }}-inject-config
        command:
        - /bin/bash
        - -c
        - >
          git clone -b {{ .Values.config.gerritBranch }} --single-branch {{ .Values.config.gerritProject }} /tmp/gerrit;
          echo "Clone complete. Copying from /tmp/gerrit/ to /public";
          cp -rf /tmp/gerrit/auth/sample/public/* /public;
          echo "Done.";
        image: "{{ .Values.global.ubuntuInitRepository }}/{{ .Values.global.ubuntuInitImage }}"
        imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
        volumeMounts:
        - name: aaf-public
          mountPath: "/public"
      containers:
      - command: ["/bin/bash","-c","if [ ! -d /data/backup ]; then mkdir /data/data && cp -Ra /data1/data/..data/* /data/data/ && mkdir /data/etc && cp -Ra /data1/etc/..data/* data/etc/ && mkdir /data/backup && cp -Ra /data1/backup/..data/* /data/backup/ && cp -Ra /data1/public /data/ && cp -Ra /data1/local /data && mkdir -p /data/logs/oauth && mkdir -p /data/logs/hello && mkdir -p /data/logs/fs && mkdir -p /data/logs/gui && mkdir -p /data/logs/locate && mkdir -p /data/logs/cm && mkdir -p /data/logs/service; fi; exit 0"]
        image: "{{ .Values.global.readinessRepository }}/{{ .Values.global.readinessImage }}"
        imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
        name: aaf-init-job
        volumeMounts:
        - mountPath: /etc/localtime
          name: localtime
          readOnly: true
        - mountPath: /data
          name: aaf-persistent-data
        - mountPath: /data1/etc
          name: aaf-etc 
        - mountPath: /data1/data
          name: aaf-data
        - mountPath: /data1/public/iframe_denied_test.html
          name: aaf-public
          subPath: iframe_denied_test.html
        - mountPath: /data1/public/aaf_2_0.xsd
          name: aaf-public
          subPath: aaf_2_0.xsd
        - mountPath: /data1/public/truststoreONAP.p12
          name: aaf-public
          subPath: truststoreONAP.p12
        - mountPath: /data1/public/AAF_RootCA.cer
          name: aaf-public
          subPath: AAF_RootCA.cer
        - mountPath: /data1/public/truststoreONAPall.jks
          name: aaf-public
          subPath: truststoreONAPall.jks
        - mountPath: /data1/local/org.osaaf.location.props
          name: aaf-local
          subPath: org.osaaf.location.props
        - mountPath: /data1/local/org.osaaf.cm.ca.props
          name: aaf-local
          subPath: org.osaaf.cm.ca.props
        - mountPath: /data1/local/org.osaaf.cassandra.props
          name: aaf-local
          subPath: org.osaaf.cassandra.props
        - mountPath: /data1/local/org.osaaf.aaf.props
          name: aaf-local
          subPath: org.osaaf.aaf.props
        - mountPath: /data1/local/org.osaaf.aaf.trust.p12
          name: aaf-local-secret
          subPath: org.osaaf.aaf.trust.p12
        - mountPath: /data1/local/org.osaaf.aaf.p12
          name: aaf-local-secret
          subPath: org.osaaf.aaf.p12
        - mountPath: /data1/local/org.osaaf.aaf.keyfile
          name: aaf-local-secret
          subPath: org.osaaf.aaf.keyfile
        - mountPath: /data1/local/org.osaaf.aaf.cm.p12
          name: aaf-local-secret
          subPath: org.osaaf.aaf.cm.p12
        - mountPath: /data1/backup
          name: aaf-backup
        - mountPath: /share
          name: aaf-public
        resources: 
{{ toYaml .Values.resources | indent 12 }}
      {{- if .Values.nodeSelector }}
      nodeSelector:
{{ toYaml .Values.nodeSelector | indent 10 }}
      {{- end -}}
      {{- if .Values.affinity }}
      affinity:
{{ toYaml .Values.affinity | indent 10 }}
      {{- end }}
      volumes:
      - name: localtime
        hostPath:
          path: /etc/localtime
      - name: aaf-local-secret
        secret:
          secretName: {{ .Release.Name }}-aaf-local-secret
      - name: aaf-etc
        configMap:
          name: {{ .Release.Name }}-aaf-etc
      - name: aaf-local
        configMap:
          name: {{ .Release.Name }}-aaf-local
      - name: aaf-backup
        configMap:
          name: {{ .Release.Name }}-aaf-backup
      - name: aaf-data
        configMap:
          name: {{ .Release.Name }}-aaf-data
      - name: aaf-persistent-data
      {{- if .Values.global.persistence.enabled }}
        persistentVolumeClaim:
          claimName: {{ .Release.Name }}-aaf-pvc
      {{- else }}
        emptyDir: {}
      {{- end }}
      - name: aaf-public
        emptyDir: {}
      restartPolicy: OnFailure
      imagePullSecrets:
      - name: "{{ include "common.namespace" . }}-docker-registry-key"