forked from rancherlabs/support-tools
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdelete-part-files.yaml
59 lines (59 loc) · 1.44 KB
/
delete-part-files.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
apiVersion: apps/v1
kind: DaemonSet
metadata:
name: cleanup-etcd
namespace: kube-system
labels:
app: cleanup-etcd
spec:
selector:
matchLabels:
app: cleanup-etcd
template:
metadata:
labels:
app: cleanup-etcd
spec:
affinity:
nodeAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
nodeSelectorTerms:
- matchExpressions:
- key: beta.kubernetes.io/os
operator: NotIn
values:
- windows
- key: node-role.kubernetes.io/etcd
operator: In
values:
- "true"
containers:
- args:
- while true;
do
echo "Before cleanup";
ls -lh /opt/rke/etcd-snapshots/;
find /opt/rke/etcd-snapshots/ -mindepth 1 -type f -name *.* -mmin +15 | grep -v '.zip' | xargs rm -f;
echo "Post cleanup";
ls -lh /opt/rke/etcd-snapshots/;
echo "Sleeping...";
sleep 360;
done;
command:
- /bin/sh
- -c
image: busybox
name: cleanup-etcd
volumeMounts:
- mountPath: /opt/rke
name: rke
tolerations:
- effect: NoExecute
key: node-role.kubernetes.io/etcd
operator: Equal
value: "true"
volumes:
- hostPath:
path: /opt/rke
type: ""
name: rke