blob: 34ec4cebc53d044e32857263c1d84b91284516c1 [file] [log] [blame]
Girish Gowdra75ae4db2021-05-27 15:52:04 -07001---
2
Joey Armstrong07475092023-01-26 10:56:13 -05003# Copyright 2021-2023 Open Networking Foundation (ONF) and the ONF Contributors
Girish Gowdra75ae4db2021-05-27 15:52:04 -07004#
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
Matteo Scandolof65e8752021-07-20 13:53:44 -070028 serviceAccountName: "{{ .Release.Name }}-service-account"
Girish Gowdra75ae4db2021-05-27 15:52:04 -070029 containers:
30 - name: etcd-db-defrag
Matteo Scandolof65e8752021-07-20 13:53:44 -070031 image: '{{ tpl .Values.etcd.defrag.image.registry . }}{{ tpl .Values.etcd.defrag.image.repository . }}:{{ tpl .Values.etcd.defrag.image.tag . }}'
32 imagePullPolicy: {{ tpl .Values.etcd.defrag.image.pullPolicy . }}
Girish Gowdra75ae4db2021-05-27 15:52:04 -070033 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 -}}