blob: 8b9607397540a454ebf27df5f3b0fda4d1cd3c44 [file] [log] [blame]
Woojoong Kim4feaddf2019-11-21 00:05:07 -08001{{/*
2Copyright 2019-present Open Networking Foundation
3
4Licensed under the Apache License, Version 2.0 (the "License");
5you may not use this file except in compliance with the License.
6You may obtain a copy of the License at
7
8http://www.apache.org/licenses/LICENSE-2.0
9
10Unless required by applicable law or agreed to in writing, software
11distributed under the License is distributed on an "AS IS" BASIS,
12WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13See the License for the specific language governing permissions and
14limitations under the License.
15*/}}
16
17{{/*
18It is the job to flush Redis database
19*/}}
20---
21apiVersion: batch/v1
22kind: Job
23metadata:
24 name: job-redis-init
25 labels:
26{{ tuple "accelleran-cbrs-redis" . | include "accelleran-cbrs-common.metadata_labels" | indent 4 }}
27spec:
28 template:
29 metadata:
30{{ tuple "accelleran-cbrs-redis" . | include "accelleran-cbrs-common.metadata_labels" | indent 8 }}
31 spec:
32 {{- if .Values.nodeSelectors.enabled }}
33 nodeSelector:
34 {{ .Values.nodeSelectors.accelleranCBRSCommon.label }}: {{ .Values.nodeSelectors.accelleranCBRSCommon.value }}
35 {{- end }}
36 serviceAccountName: accelleran-cbrs-redis
37 restartPolicy: OnFailure
38 initContainers:
39 - name: accelleran-cbrs-redis-dep-check
40 image: {{ .Values.images.tags.depCheck | quote }}
41 imagePullPolicy: {{ .Values.images.pullPolicy }}
42 securityContext:
43 allowPrivilegeEscalation: false
44 readOnlyRootFilesystem: false
45 runAsUser: 0
46 env:
47 - name: POD_NAME
48 valueFrom:
49 fieldRef:
50 apiVersion: v1
51 fieldPath: metadata.name
52 - name: NAMESPACE
53 valueFrom:
54 fieldRef:
55 apiVersion: v1
56 fieldPath: metadata.namespace
57 - name: PATH
58 value: /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/
59 - name: COMMAND
60 value: "echo done"
61 - name: DEPENDENCY_POD_JSON
62 value: '[{"labels": {"app": "accelleran-cbrs-redis"}, "requireSameNode": false}]'
63 containers:
64 - name: accelleran-cbrs-redis-init
65 image: {{ .Values.images.tags.redisClient }}
66 imagePullPolicy: {{ .Values.images.pullPolicy }}
67 command: ["sh", "-c"]
68 args:
Woojoong Kim34eb8b62020-02-04 10:43:37 -080069 - redis-cli -h {{ .Values.config.redis.hostName }} -p {{ .Values.config.redis.ports.redisPort.port }} flushall;
70 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 }}";
71 redis-cli -h {{ .Values.config.redis.hostName }} -p {{ .Values.config.redis.ports.redisPort.port }} keys '*';