blob: ec301798286d4580ff9a904f0a7fc04c96fcf10c [file] [log] [blame]
Jeremy Ronquillo223db002020-06-05 10:28:22 -07001{{/*
Jeremy Ronquilloec2d3e42020-06-05 11:33:39 -07002# Copyright 2019-present Open Networking Foundation
Jeremy Ronquillo223db002020-06-05 10:28:22 -07003
Jeremy Ronquillo6046ce32020-06-18 11:06:29 -07004# SPDX-License-Identifier: LicenseRef-ONF-Member-Only-1.0
Jeremy Ronquillo223db002020-06-05 10:28:22 -07005*/}}
6
7{{/*
8It is the job to flush Redis database
9*/}}
10---
11apiVersion: batch/v1
12kind: Job
13metadata:
14 name: job-redis-init
15 labels:
16{{ tuple "accelleran-cbrs-redis" . | include "accelleran-cbrs-common.metadata_labels" | indent 4 }}
17spec:
18 template:
19 metadata:
Hyunsun Moon5f3e5362021-05-03 20:49:08 -070020 labels:
Jeremy Ronquillo223db002020-06-05 10:28:22 -070021{{ 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 '*';