blob: 609d6a78204d4031eb97afc532b81856a73c7d92 [file] [log] [blame]
Hung-Wei Chiu1887b932021-04-05 16:59:28 -07001# Copyright 2020-present Open Networking Foundation
2# SPDX-License-Identifier: LicenseRef-ONF-Member-Only-1.0
3
4apiVersion: batch/v1
5kind: Job
6metadata:
7 name: "{{ .Release.Name }}"
8spec:
9 backoffLimit: 4
10 activeDeadlineSeconds: 100
11 template:
12 metadata:
13 name: "{{ .Release.Name }}"
14 spec:
15 restartPolicy: OnFailure
16 containers:
17 - name: config
18 image: opennetworking/utils:jq-kubectl-curl
19 imagePullPolicy: IfNotPresent
20 env:
21 - name: ES_URL
22 value: "{{ .Values.elasticsearch.host }}:{{ .Values.elasticsearch.port}}"
23 {{ if .Values.configuration.setting }}
24 - name: SETTING_DIR
25 value: "{{ .Values.configuration.base_dir }}/{{ .Values.configuration.setting }}"
26 {{ end }}
27 {{ if .Values.configuration.monitor }}
28 - name: MONITOR_DIR
29 value: "{{ .Values.configuration.base_dir }}/{{ .Values.configuration.monitor }}"
30 {{ end }}
31 {{ if .Values.configuration.destination }}
32 - name: DEST_DIR
33 value: "{{ .Values.configuration.base_dir }}/{{ .Values.configuration.destination }}"
34 {{ end }}
35 volumeMounts:
36 - name: config-script
37 mountPath: /tmp/update.sh
38 subPath: update.sh
39 {{ if .Values.configuration.setting }}
40 - name: setting-configs
41 mountPath: "{{ .Values.configuration.base_dir }}/{{ .Values.configuration.setting }}"
42 {{ end }}
43 {{ if .Values.configuration.monitor }}
44 - name: monitor-configs
45 mountPath: "{{ .Values.configuration.base_dir }}/{{ .Values.configuration.monitor }}"
46 {{ end }}
47 {{ if .Values.configuration.destination }}
48 - name: destination-configs
49 mountPath: "{{ .Values.configuration.base_dir }}/{{ .Values.configuration.destination }}"
50 {{ end }}
51 command: ["sh", "-c", "/tmp/update.sh"]
52 volumes:
53 - name: "config-script"
54 configMap:
55 name: "{{ .Release.Name }}-scripts"
56 defaultMode: 0755
57 {{ if .Values.configuration.setting }}
58 - name: "setting-configs"
59 configMap:
60 name: "{{ .Values.configuration.setting_configmap }}"
61 defaultMode: 0644
62 {{ end }}
63 {{ if .Values.configuration.monitor }}
64 - name: "monitor-configs"
65 configMap:
66 name: "{{ .Values.configuration.monitor_configmap }}"
67 defaultMode: 0644
68 {{ end }}
69 {{ if .Values.configuration.destination }}
70 - name: "destination-configs"
71 secret:
72 secretName: "{{ .Values.configuration.destination_secret }}"
73 defaultMode: 0644
74 {{ end }}