Jakub Latusek | e0e8ca7 | 2020-10-21 13:36:29 +0200 | [diff] [blame] | 1 | {{/* |
Alexander Dehn | 9b797d6 | 2020-04-21 09:53:50 +0000 | [diff] [blame] | 2 | # Copyright © 2020 highstreet technologies GmbH |
| 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. |
Jakub Latusek | e0e8ca7 | 2020-10-21 13:36:29 +0200 | [diff] [blame] | 15 | */}} |
Alexander Dehn | 9b797d6 | 2020-04-21 09:53:50 +0000 | [diff] [blame] | 16 | {{ if .Values.config.sdnr.enabled -}} |
| 17 | apiVersion: batch/v1 |
| 18 | kind: Job |
| 19 | metadata: {{- include "common.resourceMetadata" (dict "suffix" "sdnrdb-init-job" "dot" . ) | nindent 2 }} |
| 20 | spec: |
| 21 | backoffLimit: 20 |
| 22 | template: |
| 23 | metadata: {{ include "common.templateMetadata" . | indent 6}} |
| 24 | spec: |
| 25 | initContainers: |
Alexander Dehn | 9b797d6 | 2020-04-21 09:53:50 +0000 | [diff] [blame] | 26 | - name: {{ include "common.name" . }}-readiness |
| 27 | command: |
Sylvain Desbureaux | 1694e1d | 2020-08-21 09:58:25 +0200 | [diff] [blame] | 28 | - /app/ready.py |
Alexander Dehn | 9b797d6 | 2020-04-21 09:53:50 +0000 | [diff] [blame] | 29 | args: |
| 30 | - --container-name |
| 31 | - {{.Values.elasticsearch.nameOverride}}-elasticsearch |
| 32 | - --container-name |
| 33 | - {{.Values.elasticsearch.nameOverride}}-nginx |
| 34 | - --container-name |
| 35 | - {{.Values.elasticsearch.nameOverride}}-master |
| 36 | env: |
| 37 | - name: NAMESPACE |
| 38 | valueFrom: |
| 39 | fieldRef: |
| 40 | apiVersion: v1 |
| 41 | fieldPath: metadata.namespace |
Sylvain Desbureaux | cbc703c | 2020-11-19 17:52:07 +0100 | [diff] [blame] | 42 | image: {{ include "repositoryGenerator.image.readiness" . }} |
Alexander Dehn | 9b797d6 | 2020-04-21 09:53:50 +0000 | [diff] [blame] | 43 | imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }} |
| 44 | containers: |
| 45 | - name: {{ include "common.name" . }}-sdnrdb-init-job |
Sylvain Desbureaux | cbc703c | 2020-11-19 17:52:07 +0100 | [diff] [blame] | 46 | image: {{ include "repositoryGenerator.repository" . }}/{{ .Values.image }} |
Alexander Dehn | 9b797d6 | 2020-04-21 09:53:50 +0000 | [diff] [blame] | 47 | imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }} |
| 48 | command: ["/bin/bash"] |
Radoslaw Chmiel | 58662a3 | 2022-06-02 19:37:35 +0200 | [diff] [blame] | 49 | args: |
| 50 | - -c |
| 51 | - | |
| 52 | sleep 90; "{{ .Values.config.binDir }}/startODL.sh" |
Alexander Dehn | 9b797d6 | 2020-04-21 09:53:50 +0000 | [diff] [blame] | 53 | env: |
| 54 | - name: SDNC_AAF_ENABLED |
Andreas Geissler | 2af5079 | 2023-03-27 17:11:27 +0200 | [diff] [blame] | 55 | value: "false" |
Alexander Dehn | 9b797d6 | 2020-04-21 09:53:50 +0000 | [diff] [blame] | 56 | - name: SDNC_HOME |
| 57 | value: "{{.Values.config.sdncHome}}" |
| 58 | - name: ETC_DIR |
| 59 | value: "{{.Values.config.etcDir}}" |
| 60 | - name: BIN_DIR |
| 61 | value: "{{.Values.config.binDir}}" |
| 62 | ## start sdnrdb parameter |
| 63 | - name: SDNRINIT |
| 64 | value: "true" |
| 65 | - name: SDNRDBURL |
Alexander Dehn | 9b797d6 | 2020-04-21 09:53:50 +0000 | [diff] [blame] | 66 | value: "http://{{ .Values.elasticsearch.service.name | default "sdnrdb"}}.{{.Release.Namespace}}:{{.Values.elasticsearch.service.port | default "9200"}}" |
Alexander Dehn | 9b797d6 | 2020-04-21 09:53:50 +0000 | [diff] [blame] | 67 | - name: SDNRDBPARAMETER |
| 68 | value: "-k" |
miroslavmasaryk | a7ac7f0 | 2023-03-01 14:12:26 +0100 | [diff] [blame] | 69 | resources: {{ include "common.resources" . | nindent 10 }} |
Radoslaw Chmiel | 58662a3 | 2022-06-02 19:37:35 +0200 | [diff] [blame] | 70 | {{- if include "common.onServiceMesh" . }} |
| 71 | - name: sdnrdb-service-mesh-wait-for-job-container |
| 72 | image: {{ include "repositoryGenerator.image.quitQuit" . }} |
| 73 | imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }} |
| 74 | command: |
| 75 | - /bin/sh |
| 76 | - "-c" |
| 77 | args: |
| 78 | - | |
| 79 | echo "waiting 30s for istio side cars to be up"; sleep 30s; |
| 80 | /app/ready.py --service-mesh-check sdnc-sdnrdb-init-job -t 45; |
| 81 | env: |
| 82 | - name: NAMESPACE |
| 83 | valueFrom: |
| 84 | fieldRef: |
| 85 | apiVersion: v1 |
| 86 | fieldPath: metadata.namespace |
| 87 | {{- end }} |
Alexander Dehn | 9b797d6 | 2020-04-21 09:53:50 +0000 | [diff] [blame] | 88 | {{- if .Values.nodeSelector }} |
| 89 | nodeSelector: {{ toYaml .Values.nodeSelector | nindent 10 }} |
| 90 | {{- end -}} |
| 91 | {{- if .Values.affinity }} |
| 92 | affinity: {{ toYaml .Values.affinity | nindent 10 }} |
| 93 | {{- end }} |
| 94 | volumes: |
| 95 | - name: localtime |
| 96 | hostPath: |
| 97 | path: /etc/localtime |
| 98 | - name: docker-entrypoint-initdb-d |
| 99 | emptyDir: {} |
| 100 | - name: bin |
| 101 | configMap: |
| 102 | name: {{ include "common.fullname" . }}-bin |
| 103 | defaultMode: 0755 |
| 104 | - name: properties |
| 105 | configMap: |
| 106 | name: {{ include "common.fullname" . }}-properties |
| 107 | defaultMode: 0644 |
Alexander Dehn | 9b797d6 | 2020-04-21 09:53:50 +0000 | [diff] [blame] | 108 | restartPolicy: Never |
| 109 | imagePullSecrets: |
| 110 | - name: "{{ include "common.namespace" . }}-docker-registry-key" |
| 111 | |
Sylvain Desbureaux | 1694e1d | 2020-08-21 09:58:25 +0200 | [diff] [blame] | 112 | {{ end -}} |