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: |
Hyunsun Moon | 5f3e536 | 2021-05-03 20:49:08 -0700 | [diff] [blame] | 20 | labels: |
Jeremy Ronquillo | 223db00 | 2020-06-05 10:28:22 -0700 | [diff] [blame] | 21 | {{ tuple "accelleran-cbrs-redis" . | include "accelleran-cbrs-common.metadata_labels" | indent 8 }} |
| 22 | spec: |
| 23 | {{- if .Values.nodeSelectors.enabled }} |
| 24 | nodeSelector: |
| 25 | {{ .Values.nodeSelectors.accelleranCBRSCommon.label }}: {{ .Values.nodeSelectors.accelleranCBRSCommon.value }} |
| 26 | {{- end }} |
| 27 | serviceAccountName: accelleran-cbrs-redis |
| 28 | restartPolicy: OnFailure |
| 29 | initContainers: |
| 30 | - name: accelleran-cbrs-redis-dep-check |
| 31 | image: {{ .Values.images.tags.depCheck | quote }} |
| 32 | imagePullPolicy: {{ .Values.images.pullPolicy }} |
| 33 | securityContext: |
| 34 | allowPrivilegeEscalation: false |
| 35 | readOnlyRootFilesystem: false |
| 36 | runAsUser: 0 |
| 37 | env: |
| 38 | - name: POD_NAME |
| 39 | valueFrom: |
| 40 | fieldRef: |
| 41 | apiVersion: v1 |
| 42 | fieldPath: metadata.name |
| 43 | - name: NAMESPACE |
| 44 | valueFrom: |
| 45 | fieldRef: |
| 46 | apiVersion: v1 |
| 47 | fieldPath: metadata.namespace |
| 48 | - name: PATH |
| 49 | value: /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/ |
| 50 | - name: COMMAND |
| 51 | value: "echo done" |
| 52 | - name: DEPENDENCY_POD_JSON |
| 53 | value: '[{"labels": {"app": "accelleran-cbrs-redis"}, "requireSameNode": false}]' |
| 54 | containers: |
| 55 | - name: accelleran-cbrs-redis-init |
| 56 | image: {{ .Values.images.tags.redisClient }} |
| 57 | imagePullPolicy: {{ .Values.images.pullPolicy }} |
| 58 | command: ["sh", "-c"] |
| 59 | args: |
| 60 | - redis-cli -h {{ .Values.config.redis.hostName }} -p {{ .Values.config.redis.ports.redisPort.port }} flushall; |
| 61 | 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 }}"; |
| 62 | redis-cli -h {{ .Values.config.redis.hostName }} -p {{ .Values.config.redis.ports.redisPort.port }} keys '*'; |