Jeremy Ronquillo | 223db00 | 2020-06-05 10:28:22 -0700 | [diff] [blame] | 1 | {{/* |
Jeremy Ronquillo | ec2d3e4 | 2020-06-05 11:33:39 -0700 | [diff] [blame] | 2 | # Copyright 2019-present Open Networking Foundation |
Jeremy Ronquillo | 223db00 | 2020-06-05 10:28:22 -0700 | [diff] [blame] | 3 | |
Jeremy Ronquillo | 6046ce3 | 2020-06-18 11:06:29 -0700 | [diff] [blame] | 4 | # SPDX-License-Identifier: LicenseRef-ONF-Member-Only-1.0 |
Jeremy Ronquillo | 223db00 | 2020-06-05 10:28:22 -0700 | [diff] [blame] | 5 | */}} |
| 6 | |
| 7 | {{/* |
| 8 | It is the job to flush Redis database |
| 9 | */}} |
| 10 | --- |
| 11 | apiVersion: batch/v1 |
| 12 | kind: Job |
| 13 | metadata: |
| 14 | name: job-redis-init |
| 15 | labels: |
| 16 | {{ tuple "accelleran-cbrs-redis" . | include "accelleran-cbrs-common.metadata_labels" | indent 4 }} |
| 17 | spec: |
| 18 | template: |
| 19 | metadata: |
| 20 | {{ tuple "accelleran-cbrs-redis" . | include "accelleran-cbrs-common.metadata_labels" | indent 8 }} |
| 21 | spec: |
| 22 | {{- if .Values.nodeSelectors.enabled }} |
| 23 | nodeSelector: |
| 24 | {{ .Values.nodeSelectors.accelleranCBRSCommon.label }}: {{ .Values.nodeSelectors.accelleranCBRSCommon.value }} |
| 25 | {{- end }} |
| 26 | serviceAccountName: accelleran-cbrs-redis |
| 27 | restartPolicy: OnFailure |
| 28 | initContainers: |
| 29 | - name: accelleran-cbrs-redis-dep-check |
| 30 | image: {{ .Values.images.tags.depCheck | quote }} |
| 31 | imagePullPolicy: {{ .Values.images.pullPolicy }} |
| 32 | securityContext: |
| 33 | allowPrivilegeEscalation: false |
| 34 | readOnlyRootFilesystem: false |
| 35 | runAsUser: 0 |
| 36 | env: |
| 37 | - name: POD_NAME |
| 38 | valueFrom: |
| 39 | fieldRef: |
| 40 | apiVersion: v1 |
| 41 | fieldPath: metadata.name |
| 42 | - name: NAMESPACE |
| 43 | valueFrom: |
| 44 | fieldRef: |
| 45 | apiVersion: v1 |
| 46 | fieldPath: metadata.namespace |
| 47 | - name: PATH |
| 48 | value: /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/ |
| 49 | - name: COMMAND |
| 50 | value: "echo done" |
| 51 | - name: DEPENDENCY_POD_JSON |
| 52 | value: '[{"labels": {"app": "accelleran-cbrs-redis"}, "requireSameNode": false}]' |
| 53 | containers: |
| 54 | - name: accelleran-cbrs-redis-init |
| 55 | image: {{ .Values.images.tags.redisClient }} |
| 56 | imagePullPolicy: {{ .Values.images.pullPolicy }} |
| 57 | command: ["sh", "-c"] |
| 58 | args: |
| 59 | - redis-cli -h {{ .Values.config.redis.hostName }} -p {{ .Values.config.redis.ports.redisPort.port }} flushall; |
| 60 | redis-cli -h {{ .Values.config.redis.hostName }} -p {{ .Values.config.redis.ports.redisPort.port }} set NATS_SERVICE_URL "nat://{{ .Values.config.nats.ip }}:{{ .Values.config.nats.ports.natsPort.nodePort }}"; |
| 61 | redis-cli -h {{ .Values.config.redis.hostName }} -p {{ .Values.config.redis.ports.redisPort.port }} keys '*'; |