Alexander Dehn | 9b797d6 | 2020-04-21 09:53:50 +0000 | [diff] [blame] | 1 | # Copyright © 2020 highstreet technologies GmbH |
| 2 | # |
| 3 | # Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | # you may not use this file except in compliance with the License. |
| 5 | # You may obtain a copy of the License at |
| 6 | # |
| 7 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | # |
| 9 | # Unless required by applicable law or agreed to in writing, software |
| 10 | # distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | # See the License for the specific language governing permissions and |
| 13 | # limitations under the License. |
| 14 | {{ if .Values.config.sdnr.enabled -}} |
| 15 | apiVersion: batch/v1 |
| 16 | kind: Job |
| 17 | metadata: {{- include "common.resourceMetadata" (dict "suffix" "sdnrdb-init-job" "dot" . ) | nindent 2 }} |
| 18 | spec: |
| 19 | backoffLimit: 20 |
| 20 | template: |
| 21 | metadata: {{ include "common.templateMetadata" . | indent 6}} |
| 22 | spec: |
| 23 | initContainers: |
| 24 | {{ include "common.certInitializer.initContainer" . | indent 6 }} |
| 25 | {{ if .Values.global.aafEnabled }} |
| 26 | - name: {{ include "common.name" . }}-chown |
Alexander Dehn | 1373c9c | 2020-09-02 09:01:15 +0000 | [diff] [blame^] | 27 | image: {{ .Values.global.busyboxRepository | default .Values.busyboxRepository }}/{{ .Values.global.busyboxImage | default .Values.busyboxImage }} |
Alexander Dehn | 9b797d6 | 2020-04-21 09:53:50 +0000 | [diff] [blame] | 28 | command: ["sh", "-c", "chown -R {{ .Values.config.odlUid }}:{{ .Values.config.odlGid}} {{ .Values.certInitializer.credsPath }}"] |
| 29 | volumeMounts: {{ include "common.certInitializer.volumeMount" . | nindent 10 }} |
| 30 | {{ end }} |
| 31 | - name: {{ include "common.name" . }}-readiness |
| 32 | command: |
| 33 | - /root/ready.py |
| 34 | args: |
| 35 | - --container-name |
| 36 | - {{.Values.elasticsearch.nameOverride}}-elasticsearch |
| 37 | - --container-name |
| 38 | - {{.Values.elasticsearch.nameOverride}}-nginx |
| 39 | - --container-name |
| 40 | - {{.Values.elasticsearch.nameOverride}}-master |
| 41 | env: |
| 42 | - name: NAMESPACE |
| 43 | valueFrom: |
| 44 | fieldRef: |
| 45 | apiVersion: v1 |
| 46 | fieldPath: metadata.namespace |
| 47 | image: "{{ .Values.global.readinessRepository }}/{{ .Values.global.readinessImage }}" |
| 48 | imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }} |
| 49 | containers: |
| 50 | - name: {{ include "common.name" . }}-sdnrdb-init-job |
| 51 | image: "{{ include "common.repository" . }}/{{ .Values.image }}" |
| 52 | imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }} |
| 53 | command: ["/bin/bash"] |
| 54 | args: ["-c", "{{ .Values.config.binDir }}/startODL.oom.sh"] |
| 55 | env: |
| 56 | - name: SDNC_AAF_ENABLED |
| 57 | value: "{{ .Values.global.aafEnabled}}" |
| 58 | - name: SDNC_HOME |
| 59 | value: "{{.Values.config.sdncHome}}" |
| 60 | - name: ETC_DIR |
| 61 | value: "{{.Values.config.etcDir}}" |
| 62 | - name: BIN_DIR |
| 63 | value: "{{.Values.config.binDir}}" |
| 64 | ## start sdnrdb parameter |
| 65 | - name: SDNRINIT |
| 66 | value: "true" |
| 67 | - name: SDNRDBURL |
| 68 | {{ if .Values.global.aafEnabled -}} |
| 69 | value: "https://{{ .Values.elasticsearch.service.name | default "sdnrdb"}}.{{.Release.Namespace}}:{{.Values.elasticsearch.service.port | default "9200"}}" |
| 70 | {{- else -}} |
| 71 | value: "http://{{ .Values.elasticsearch.service.name | default "sdnrdb"}}.{{.Release.Namespace}}:{{.Values.elasticsearch.service.port | default "9200"}}" |
| 72 | {{- end }} |
| 73 | - name: SDNRDBPARAMETER |
| 74 | value: "-k" |
| 75 | volumeMounts: {{ include "common.certInitializer.volumeMount" . | nindent 10 }} |
| 76 | resources: {{ include "common.resources" . | nindent 12 }} |
| 77 | {{- if .Values.nodeSelector }} |
| 78 | nodeSelector: {{ toYaml .Values.nodeSelector | nindent 10 }} |
| 79 | {{- end -}} |
| 80 | {{- if .Values.affinity }} |
| 81 | affinity: {{ toYaml .Values.affinity | nindent 10 }} |
| 82 | {{- end }} |
| 83 | volumes: |
| 84 | - name: localtime |
| 85 | hostPath: |
| 86 | path: /etc/localtime |
| 87 | - name: docker-entrypoint-initdb-d |
| 88 | emptyDir: {} |
| 89 | - name: bin |
| 90 | configMap: |
| 91 | name: {{ include "common.fullname" . }}-bin |
| 92 | defaultMode: 0755 |
| 93 | - name: properties |
| 94 | configMap: |
| 95 | name: {{ include "common.fullname" . }}-properties |
| 96 | defaultMode: 0644 |
| 97 | {{ include "common.certInitializer.volumes" . | nindent 6 }} |
| 98 | restartPolicy: Never |
| 99 | imagePullSecrets: |
| 100 | - name: "{{ include "common.namespace" . }}-docker-registry-key" |
| 101 | |
| 102 | {{ end -}} |