blob: 29b8083a28c9fb577769058695e6fd2c8732bba7 [file] [log] [blame]
Girish Gowdra75ae4db2021-05-27 15:52:04 -07001---
2
3# Copyright 2021-present Open Networking Foundation
4#
5# Licensed under the Apache License, Version 2.0 (the "License");
6# you may not use this file except in compliance with the License.
7# You may obtain a copy of the License at
8#
9# http://www.apache.org/licenses/LICENSE-2.0
10#
11# Unless required by applicable law or agreed to in writing, software
12# distributed under the License is distributed on an "AS IS" BASIS,
13# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14# See the License for the specific language governing permissions and
15# limitations under the License.
16{{- if .Values.etcd.defrag.enabled }}
17apiVersion: batch/v1beta1
18kind: CronJob
19metadata:
20 name: etcd-db-defrag
21spec:
22 schedule: {{ .Values.etcd.defrag.schedule | quote }}
23 jobTemplate:
24 spec:
25 template:
26 spec:
27 restartPolicy: OnFailure
28 serviceAccountName: "{{ .Release.Name }}-onos-config-loader-service-account"
29 containers:
30 - name: etcd-db-defrag
31 image: '{{ tpl .Values.images.onos_config_loader.registry . }}{{ tpl .Values.images.onos_config_loader.repository . }}:{{ tpl .Values.images.onos_config_loader.tag . }}'
32 imagePullPolicy: {{ tpl .Values.images.onos_config_loader.pullPolicy . }}
33 command:
34 - /bin/sh
35 - -c
36 - kubectl exec -n {{ .Release.Namespace }} {{ .Release.Name }}-etcd-0 -- etcdctl defrag --cluster
37 volumeMounts:
38 - name: kube-config-volume
39 mountPath: /etc/kube
40 volumes:
41 - name: kube-config-volume
42 configMap:
43 name: kube-config
44{{- end -}}