Girish Gowdra | 75ae4db | 2021-05-27 15:52:04 -0700 | [diff] [blame] | 1 | --- |
| 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 }} |
| 17 | apiVersion: batch/v1beta1 |
| 18 | kind: CronJob |
| 19 | metadata: |
| 20 | name: etcd-db-defrag |
| 21 | spec: |
| 22 | schedule: {{ .Values.etcd.defrag.schedule | quote }} |
| 23 | jobTemplate: |
| 24 | spec: |
| 25 | template: |
| 26 | spec: |
| 27 | restartPolicy: OnFailure |
Matteo Scandolo | f65e875 | 2021-07-20 13:53:44 -0700 | [diff] [blame] | 28 | serviceAccountName: "{{ .Release.Name }}-service-account" |
Girish Gowdra | 75ae4db | 2021-05-27 15:52:04 -0700 | [diff] [blame] | 29 | containers: |
| 30 | - name: etcd-db-defrag |
Matteo Scandolo | f65e875 | 2021-07-20 13:53:44 -0700 | [diff] [blame] | 31 | 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 Gowdra | 75ae4db | 2021-05-27 15:52:04 -0700 | [diff] [blame] | 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 -}} |