Woojoong Kim | 4feaddf | 2019-11-21 00:05:07 -0800 | [diff] [blame] | 1 | {{/* |
| 2 | Copyright 2019-present Open Networking Foundation |
| 3 | |
| 4 | Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | you may not use this file except in compliance with the License. |
| 6 | You may obtain a copy of the License at |
| 7 | |
| 8 | http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | |
| 10 | Unless required by applicable law or agreed to in writing, software |
| 11 | distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | See the License for the specific language governing permissions and |
| 14 | limitations under the License. |
| 15 | */}} |
| 16 | |
| 17 | {{/* |
| 18 | It is the job to flush Redis database |
| 19 | */}} |
| 20 | --- |
| 21 | apiVersion: batch/v1 |
| 22 | kind: Job |
| 23 | metadata: |
| 24 | name: job-redis-init |
| 25 | labels: |
| 26 | {{ tuple "accelleran-cbrs-redis" . | include "accelleran-cbrs-common.metadata_labels" | indent 4 }} |
| 27 | spec: |
| 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 Kim | 34eb8b6 | 2020-02-04 10:43:37 -0800 | [diff] [blame] | 69 | - 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 '*'; |