-
Notifications
You must be signed in to change notification settings - Fork 7
/
drone-cleanup.yml
81 lines (75 loc) · 1.77 KB
/
drone-cleanup.yml
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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
apiVersion: v1
kind: ServiceAccount
metadata:
name: drone-cleanup
namespace: drone
---
kind: Role
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: drone-cleanup
namespace: drone
rules:
- apiGroups: [""]
resources: ["pods"]
verbs: ["get", "list", "delete"]
- apiGroups: ["", "batch"]
resources: ["jobs"]
verbs: ["get", "list", "delete"]
---
apiVersion: rbac.authorization.k8s.io/v1beta1
kind: RoleBinding
metadata:
name: drone-cleanup
namespace: drone
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: Role
name: drone-cleanup
subjects:
- kind: ServiceAccount
name: drone-cleanup
---
apiVersion: batch/v1beta1
kind: CronJob
metadata:
annotations:
name: drone-cleanup
namespace: drone
spec:
suspend: false
concurrencyPolicy: Allow
failedJobsHistoryLimit: 1
successfulJobsHistoryLimit: 3
schedule: "*/10 * * * *"
jobTemplate:
metadata:
creationTimestamp: null
spec:
template:
metadata:
creationTimestamp: null
spec:
serviceAccountName: drone-cleanup
containers:
- image: cargoxio/drone-cleanup:latest
imagePullPolicy: Always
name: drone-cleanup
command: [ "/bin/sh", "/kubectl/drone-cleanup.sh" ]
resources:
limits:
cpu: 50m
memory: 100Mi
requests:
cpu: 50m
memory: 100Mi
securityContext:
capabilities: {}
terminationMessagePath: /dev/termination-log
terminationMessagePolicy: File
dnsPolicy: Default
hostNetwork: true
restartPolicy: Never
schedulerName: default-scheduler
securityContext: {}
terminationGracePeriodSeconds: 10