Files
homelab/components/defrag-etcd/base/cronjob.yaml
rblundon fe564d7227 Squashed 'cluster-config/' content from commit 654f2390
git-subtree-dir: cluster-config
git-subtree-split: 654f23903bd1f9a27a4810bd289d165b6cfdbb0c
2025-03-30 15:46:16 -05:00

26 lines
841 B
YAML

apiVersion: batch/v1
kind: CronJob
metadata:
name: defrag-etcd
spec:
schedule: "0 11 * * *"
jobTemplate:
spec:
template:
spec:
containers:
- name: defrag-etcd
image: registry.redhat.io/openshift4/ose-cli:latest
imagePullPolicy: IfNotPresent
command:
- /bin/bash
- -c
- |
#!/usr/bin/env bash
oc get pods -l app=etcd -n openshift-etcd --no-headers -o custom-columns=":metadata.name" | while read -r pod ; do
oc exec -n openshift-etcd $pod --container etcdctl -- sh -c "unset ETCDCTL_ENDPOINTS && etcdctl --command-timeout=30s --endpoints=https://localhost:2379 defrag"
done
serviceAccountName: defrag-etcd
restartPolicy: OnFailure