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: |
demskeq8 | 4e1f84c | 2023-07-04 08:39:43 +0000 | [diff] [blame^] | 30 | {{- if .Values.config.sdnr.mariadb.enabled }} |
| 31 | - --container-name |
| 32 | - {{ include "common.mariadbService" . }} |
| 33 | {{- else -}} |
Alexander Dehn | 9b797d6 | 2020-04-21 09:53:50 +0000 | [diff] [blame] | 34 | - --container-name |
| 35 | - {{.Values.elasticsearch.nameOverride}}-elasticsearch |
| 36 | - --container-name |
| 37 | - {{.Values.elasticsearch.nameOverride}}-nginx |
| 38 | - --container-name |
| 39 | - {{.Values.elasticsearch.nameOverride}}-master |
demskeq8 | 4e1f84c | 2023-07-04 08:39:43 +0000 | [diff] [blame^] | 40 | {{- end }} |
Alexander Dehn | 9b797d6 | 2020-04-21 09:53:50 +0000 | [diff] [blame] | 41 | env: |
| 42 | - name: NAMESPACE |
| 43 | valueFrom: |
| 44 | fieldRef: |
| 45 | apiVersion: v1 |
| 46 | fieldPath: metadata.namespace |
Sylvain Desbureaux | cbc703c | 2020-11-19 17:52:07 +0100 | [diff] [blame] | 47 | image: {{ include "repositoryGenerator.image.readiness" . }} |
Alexander Dehn | 9b797d6 | 2020-04-21 09:53:50 +0000 | [diff] [blame] | 48 | imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }} |
| 49 | containers: |
| 50 | - name: {{ include "common.name" . }}-sdnrdb-init-job |
Sylvain Desbureaux | cbc703c | 2020-11-19 17:52:07 +0100 | [diff] [blame] | 51 | image: {{ include "repositoryGenerator.repository" . }}/{{ .Values.image }} |
Alexander Dehn | 9b797d6 | 2020-04-21 09:53:50 +0000 | [diff] [blame] | 52 | imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }} |
| 53 | command: ["/bin/bash"] |
Radoslaw Chmiel | 58662a3 | 2022-06-02 19:37:35 +0200 | [diff] [blame] | 54 | args: |
| 55 | - -c |
| 56 | - | |
demskeq8 | 4e1f84c | 2023-07-04 08:39:43 +0000 | [diff] [blame^] | 57 | {{- if .Values.config.sdnr.mariadb.enabled }} |
| 58 | "{{ .Values.config.binDir }}/createSdnrDb.sh"; |
| 59 | {{- end -}} |
Radoslaw Chmiel | 58662a3 | 2022-06-02 19:37:35 +0200 | [diff] [blame] | 60 | sleep 90; "{{ .Values.config.binDir }}/startODL.sh" |
Alexander Dehn | 9b797d6 | 2020-04-21 09:53:50 +0000 | [diff] [blame] | 61 | env: |
| 62 | - name: SDNC_AAF_ENABLED |
Andreas Geissler | 2af5079 | 2023-03-27 17:11:27 +0200 | [diff] [blame] | 63 | value: "false" |
Alexander Dehn | 9b797d6 | 2020-04-21 09:53:50 +0000 | [diff] [blame] | 64 | - name: SDNC_HOME |
| 65 | value: "{{.Values.config.sdncHome}}" |
| 66 | - name: ETC_DIR |
| 67 | value: "{{.Values.config.etcDir}}" |
| 68 | - name: BIN_DIR |
| 69 | value: "{{.Values.config.binDir}}" |
| 70 | ## start sdnrdb parameter |
| 71 | - name: SDNRINIT |
| 72 | value: "true" |
demskeq8 | 4e1f84c | 2023-07-04 08:39:43 +0000 | [diff] [blame^] | 73 | {{- if .Values.config.sdnr.mariadb.enabled }} |
| 74 | - name: SDNRDBTYPE |
| 75 | value: MARIADB |
| 76 | - name: MYSQL_HOST |
| 77 | value: {{ include "common.mariadbService" . }} |
| 78 | - name: MYSQL_ROOT_PASSWORD |
| 79 | {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "db-root-password" "key" "password") | indent 12 }} |
| 80 | - name: SDNRDBURL |
| 81 | value: "jdbc:mysql://{{ include "common.mariadbService" . }}:3306/{{ .Values.config.sdnr.mariadb.databaseName }}" |
| 82 | - name: SDNRDBDATABASE |
| 83 | value: "{{ .Values.config.sdnr.mariadb.databaseName }}" |
| 84 | - name: SDNRDBUSERNAME |
| 85 | {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "sdnrdb-secret" "key" "login") | indent 12 }} |
| 86 | - name: SDNRDBPASSWORD |
| 87 | {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "sdnrdb-secret" "key" "password") | indent 12 }} |
| 88 | {{- else -}} |
Alexander Dehn | 9b797d6 | 2020-04-21 09:53:50 +0000 | [diff] [blame] | 89 | - name: SDNRDBURL |
Alexander Dehn | 9b797d6 | 2020-04-21 09:53:50 +0000 | [diff] [blame] | 90 | 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] | 91 | - name: SDNRDBPARAMETER |
| 92 | value: "-k" |
demskeq8 | 4e1f84c | 2023-07-04 08:39:43 +0000 | [diff] [blame^] | 93 | {{- end }} |
| 94 | {{- if .Values.config.sdnr.mariadb.enabled }} |
| 95 | volumeMounts: |
| 96 | - mountPath: {{ .Values.config.binDir }}/createSdnrDb.sh |
| 97 | name: bin |
| 98 | subPath: createSdnrDb.sh |
| 99 | {{- end }} |
miroslavmasaryk | a7ac7f0 | 2023-03-01 14:12:26 +0100 | [diff] [blame] | 100 | resources: {{ include "common.resources" . | nindent 10 }} |
Radoslaw Chmiel | 58662a3 | 2022-06-02 19:37:35 +0200 | [diff] [blame] | 101 | {{- if include "common.onServiceMesh" . }} |
| 102 | - name: sdnrdb-service-mesh-wait-for-job-container |
| 103 | image: {{ include "repositoryGenerator.image.quitQuit" . }} |
| 104 | imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }} |
| 105 | command: |
| 106 | - /bin/sh |
| 107 | - "-c" |
| 108 | args: |
| 109 | - | |
| 110 | echo "waiting 30s for istio side cars to be up"; sleep 30s; |
| 111 | /app/ready.py --service-mesh-check sdnc-sdnrdb-init-job -t 45; |
| 112 | env: |
| 113 | - name: NAMESPACE |
| 114 | valueFrom: |
| 115 | fieldRef: |
| 116 | apiVersion: v1 |
| 117 | fieldPath: metadata.namespace |
| 118 | {{- end }} |
Alexander Dehn | 9b797d6 | 2020-04-21 09:53:50 +0000 | [diff] [blame] | 119 | {{- if .Values.nodeSelector }} |
| 120 | nodeSelector: {{ toYaml .Values.nodeSelector | nindent 10 }} |
| 121 | {{- end -}} |
| 122 | {{- if .Values.affinity }} |
| 123 | affinity: {{ toYaml .Values.affinity | nindent 10 }} |
| 124 | {{- end }} |
vladimir turok | d804418 | 2023-07-27 16:28:36 +0200 | [diff] [blame] | 125 | serviceAccountName: {{ include "common.fullname" (dict "suffix" "read" "dot" . )}} |
Alexander Dehn | 9b797d6 | 2020-04-21 09:53:50 +0000 | [diff] [blame] | 126 | volumes: |
| 127 | - name: localtime |
| 128 | hostPath: |
| 129 | path: /etc/localtime |
| 130 | - name: docker-entrypoint-initdb-d |
| 131 | emptyDir: {} |
| 132 | - name: bin |
| 133 | configMap: |
| 134 | name: {{ include "common.fullname" . }}-bin |
| 135 | defaultMode: 0755 |
| 136 | - name: properties |
| 137 | configMap: |
| 138 | name: {{ include "common.fullname" . }}-properties |
| 139 | defaultMode: 0644 |
Alexander Dehn | 9b797d6 | 2020-04-21 09:53:50 +0000 | [diff] [blame] | 140 | restartPolicy: Never |
| 141 | imagePullSecrets: |
| 142 | - name: "{{ include "common.namespace" . }}-docker-registry-key" |
| 143 | |
Sylvain Desbureaux | 1694e1d | 2020-08-21 09:58:25 +0200 | [diff] [blame] | 144 | {{ end -}} |