| {{/* |
| # Copyright 2019-present Open Networking Foundation |
| |
| # SPDX-License-Identifier: LicenseRef-ONF-Member-Only-1.0 |
| */}} |
| |
| {{/* |
| It is the job to flush Redis database |
| */}} |
| --- |
| apiVersion: batch/v1 |
| kind: Job |
| metadata: |
| name: job-redis-init |
| labels: |
| {{ tuple "accelleran-cbrs-redis" . | include "accelleran-cbrs-common.metadata_labels" | indent 4 }} |
| spec: |
| template: |
| metadata: |
| {{ tuple "accelleran-cbrs-redis" . | include "accelleran-cbrs-common.metadata_labels" | indent 8 }} |
| spec: |
| {{- if .Values.nodeSelectors.enabled }} |
| nodeSelector: |
| {{ .Values.nodeSelectors.accelleranCBRSCommon.label }}: {{ .Values.nodeSelectors.accelleranCBRSCommon.value }} |
| {{- end }} |
| serviceAccountName: accelleran-cbrs-redis |
| restartPolicy: OnFailure |
| initContainers: |
| - name: accelleran-cbrs-redis-dep-check |
| image: {{ .Values.images.tags.depCheck | quote }} |
| imagePullPolicy: {{ .Values.images.pullPolicy }} |
| securityContext: |
| allowPrivilegeEscalation: false |
| readOnlyRootFilesystem: false |
| runAsUser: 0 |
| env: |
| - name: POD_NAME |
| valueFrom: |
| fieldRef: |
| apiVersion: v1 |
| fieldPath: metadata.name |
| - name: NAMESPACE |
| valueFrom: |
| fieldRef: |
| apiVersion: v1 |
| fieldPath: metadata.namespace |
| - name: PATH |
| value: /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/ |
| - name: COMMAND |
| value: "echo done" |
| - name: DEPENDENCY_POD_JSON |
| value: '[{"labels": {"app": "accelleran-cbrs-redis"}, "requireSameNode": false}]' |
| containers: |
| - name: accelleran-cbrs-redis-init |
| image: {{ .Values.images.tags.redisClient }} |
| imagePullPolicy: {{ .Values.images.pullPolicy }} |
| command: ["sh", "-c"] |
| args: |
| - redis-cli -h {{ .Values.config.redis.hostName }} -p {{ .Values.config.redis.ports.redisPort.port }} flushall; |
| 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 }}"; |
| redis-cli -h {{ .Values.config.redis.hostName }} -p {{ .Values.config.redis.ports.redisPort.port }} keys '*'; |