blob: 7d2da6e2a5f9987be624fef19e6ebced30e6dc17 [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:
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 '*';