-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathcronjob-logs-pruning.yaml
More file actions
77 lines (69 loc) · 2.53 KB
/
cronjob-logs-pruning.yaml
File metadata and controls
77 lines (69 loc) · 2.53 KB
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
apiVersion: batch/v1
kind: CronJob
metadata:
name: {{ include "geoserver.fullname" . }}-logs-pruning
labels:
{{- include "geoserver.labels" . | nindent 4 }}
spec:
schedule: '0 1 * * *'
jobTemplate:
metadata:
name: {{ include "geoserver.fullname" . }}-logs-pruning
spec:
template:
metadata: {}
spec:
restartPolicy: Never
containers:
- name: prune
image: busybox:1.37
imagePullPolicy: IfNotPresent
command:
- /bin/sh
- -eux
- -c
- |
date
printf "Pruning log files...\n\n"
if [ -d /var/geoserver/audits ]; then
find /var/geoserver/audits/ -name '*.log' -type f -mtime +14 -print -delete
fi
if [ -d /usr/local/tomcat/logs ]; then
find /usr/local/tomcat/logs/ -name '*.catalina.*.log' -type f -mtime +14 -print -delete
find /usr/local/tomcat/logs/ -name '*.host-manager.*.log' -type f -mtime +14 -print -delete
find /usr/local/tomcat/logs/ -name '*.localhost.*.log' -type f -mtime +14 -print -delete
find /usr/local/tomcat/logs/ -name '*.localhost_access_log.*.txt' -type f -mtime +14 -print -delete
find /usr/local/tomcat/logs/ -name '*.manager.*.log' -type f -mtime +14 -print -delete
fi
volumeMounts:
{{- if .Values.persistence.tomcatlogs }}
- name: gs-tomcatlogs
mountPath: /usr/local/tomcat/logs
{{- end }}
{{- if .Values.persistence.audits }}
- name: gs-audits
mountPath: /var/geoserver/audits
{{- end }}
{{- with .Values.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 12 }}
{{- end }}
{{- with .Values.affinity }}
affinity:
{{- toYaml . | nindent 12 }}
{{- end }}
{{- with .Values.tolerations }}
tolerations:
{{- toYaml . | nindent 12 }}
{{- end }}
volumes:
{{- if .Values.persistence.tomcatlogs }}
- name: gs-tomcatlogs
persistentVolumeClaim:
claimName: {{ include "geoserver.fullname" . }}-tomcatlogs
{{- end }}
{{- if .Values.persistence.audits }}
- name: gs-audits
persistentVolumeClaim:
claimName: {{ include "geoserver.fullname" . }}-audits
{{- end }}