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: |
| 26 | {{ include "common.certInitializer.initContainer" . | indent 6 }} |
| 27 | {{ if .Values.global.aafEnabled }} |
| 28 | - name: {{ include "common.name" . }}-chown |
Sylvain Desbureaux | cbc703c | 2020-11-19 17:52:07 +0100 | [diff] [blame] | 29 | image: {{ include "repositoryGenerator.image.busybox" . }} |
Alexander Dehn | 9b797d6 | 2020-04-21 09:53:50 +0000 | [diff] [blame] | 30 | command: ["sh", "-c", "chown -R {{ .Values.config.odlUid }}:{{ .Values.config.odlGid}} {{ .Values.certInitializer.credsPath }}"] |
| 31 | volumeMounts: {{ include "common.certInitializer.volumeMount" . | nindent 10 }} |
| 32 | {{ end }} |
| 33 | - name: {{ include "common.name" . }}-readiness |
| 34 | command: |
Sylvain Desbureaux | 1694e1d | 2020-08-21 09:58:25 +0200 | [diff] [blame] | 35 | - /app/ready.py |
Alexander Dehn | 9b797d6 | 2020-04-21 09:53:50 +0000 | [diff] [blame] | 36 | args: |
| 37 | - --container-name |
| 38 | - {{.Values.elasticsearch.nameOverride}}-elasticsearch |
| 39 | - --container-name |
| 40 | - {{.Values.elasticsearch.nameOverride}}-nginx |
| 41 | - --container-name |
| 42 | - {{.Values.elasticsearch.nameOverride}}-master |
| 43 | env: |
| 44 | - name: NAMESPACE |
| 45 | valueFrom: |
| 46 | fieldRef: |
| 47 | apiVersion: v1 |
| 48 | fieldPath: metadata.namespace |
Sylvain Desbureaux | cbc703c | 2020-11-19 17:52:07 +0100 | [diff] [blame] | 49 | image: {{ include "repositoryGenerator.image.readiness" . }} |
Alexander Dehn | 9b797d6 | 2020-04-21 09:53:50 +0000 | [diff] [blame] | 50 | imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }} |
| 51 | containers: |
| 52 | - name: {{ include "common.name" . }}-sdnrdb-init-job |
Sylvain Desbureaux | cbc703c | 2020-11-19 17:52:07 +0100 | [diff] [blame] | 53 | image: {{ include "repositoryGenerator.repository" . }}/{{ .Values.image }} |
Alexander Dehn | 9b797d6 | 2020-04-21 09:53:50 +0000 | [diff] [blame] | 54 | imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }} |
| 55 | command: ["/bin/bash"] |
Dan Timoney | 6d1973f | 2020-10-07 14:00:37 -0400 | [diff] [blame] | 56 | args: ["-c", "{{ .Values.config.binDir }}/startODL.sh"] |
Alexander Dehn | 9b797d6 | 2020-04-21 09:53:50 +0000 | [diff] [blame] | 57 | env: |
| 58 | - name: SDNC_AAF_ENABLED |
| 59 | value: "{{ .Values.global.aafEnabled}}" |
| 60 | - name: SDNC_HOME |
| 61 | value: "{{.Values.config.sdncHome}}" |
| 62 | - name: ETC_DIR |
| 63 | value: "{{.Values.config.etcDir}}" |
| 64 | - name: BIN_DIR |
| 65 | value: "{{.Values.config.binDir}}" |
| 66 | ## start sdnrdb parameter |
| 67 | - name: SDNRINIT |
| 68 | value: "true" |
| 69 | - name: SDNRDBURL |
| 70 | {{ if .Values.global.aafEnabled -}} |
| 71 | value: "https://{{ .Values.elasticsearch.service.name | default "sdnrdb"}}.{{.Release.Namespace}}:{{.Values.elasticsearch.service.port | default "9200"}}" |
| 72 | {{- else -}} |
| 73 | value: "http://{{ .Values.elasticsearch.service.name | default "sdnrdb"}}.{{.Release.Namespace}}:{{.Values.elasticsearch.service.port | default "9200"}}" |
| 74 | {{- end }} |
| 75 | - name: SDNRDBPARAMETER |
| 76 | value: "-k" |
| 77 | volumeMounts: {{ include "common.certInitializer.volumeMount" . | nindent 10 }} |
| 78 | resources: {{ include "common.resources" . | nindent 12 }} |
| 79 | {{- if .Values.nodeSelector }} |
| 80 | nodeSelector: {{ toYaml .Values.nodeSelector | nindent 10 }} |
| 81 | {{- end -}} |
| 82 | {{- if .Values.affinity }} |
| 83 | affinity: {{ toYaml .Values.affinity | nindent 10 }} |
| 84 | {{- end }} |
| 85 | volumes: |
| 86 | - name: localtime |
| 87 | hostPath: |
| 88 | path: /etc/localtime |
| 89 | - name: docker-entrypoint-initdb-d |
| 90 | emptyDir: {} |
| 91 | - name: bin |
| 92 | configMap: |
| 93 | name: {{ include "common.fullname" . }}-bin |
| 94 | defaultMode: 0755 |
| 95 | - name: properties |
| 96 | configMap: |
| 97 | name: {{ include "common.fullname" . }}-properties |
| 98 | defaultMode: 0644 |
| 99 | {{ include "common.certInitializer.volumes" . | nindent 6 }} |
| 100 | restartPolicy: Never |
| 101 | imagePullSecrets: |
| 102 | - name: "{{ include "common.namespace" . }}-docker-registry-key" |
| 103 | |
Sylvain Desbureaux | 1694e1d | 2020-08-21 09:58:25 +0200 | [diff] [blame] | 104 | {{ end -}} |