mirror of
https://github.com/bokysan/docker-postfix.git
synced 2025-09-06 22:44:59 +08:00
test out logrotate
This commit is contained in:
parent
3067057cd7
commit
1fb414efa6
3 changed files with 44 additions and 0 deletions
25
helm/mail/templates/configmap-logrotate.yaml
Normal file
25
helm/mail/templates/configmap-logrotate.yaml
Normal file
|
@ -0,0 +1,25 @@
|
|||
{{- if .Values.metrics.enabled }}
|
||||
{{- if .Values.metrics.logrotate.enabled }}
|
||||
{{- $chart := "mail" -}}
|
||||
{{- $labels := include (print $chart ".labels") . -}}
|
||||
apiVersion: v1
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
name: logrotate-config
|
||||
labels:
|
||||
{{- $labels | nindent 4 }}
|
||||
data:
|
||||
logrotate.conf: |
|
||||
/var/log/mail.log {
|
||||
rotate 1
|
||||
monthly
|
||||
minsize 1M
|
||||
compress
|
||||
missingok
|
||||
notifempty
|
||||
dateext
|
||||
olddir /var/log/old
|
||||
maxage 90
|
||||
}
|
||||
{{- end }}
|
||||
{{- end }}
|
|
@ -156,6 +156,15 @@ spec:
|
|||
- mountPath: /var/log/
|
||||
name: {{ $fullName }}
|
||||
subPath: logs
|
||||
{{- if .Values.metrics.logrotate.enabled }}
|
||||
- name: logrotate
|
||||
image: blacklabelops/logrotate
|
||||
volumeMounts:
|
||||
- mountPath: /var/log
|
||||
name: {{ $fullName }}
|
||||
- mountPath: /etc/logrotate.d
|
||||
name: logrotate-config
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- if .Values.extraContainers }}
|
||||
{{- tpl .Values.extraContainers $root | nindent 8 }}
|
||||
|
@ -186,6 +195,14 @@ spec:
|
|||
secret:
|
||||
secretName: {{ $fullName }}-mount
|
||||
{{- end }}
|
||||
|
||||
{{- if .Values.metrics.enabled }}
|
||||
{{- if .Values.metrics.logrotate.enabled }}
|
||||
- name: logrotate-config
|
||||
configMap:
|
||||
name: logrotate-config
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- if .Values.extraVolumes }}{{- toYaml .Values.extraVolumes | nindent 8 }}{{ end }}
|
||||
{{- if and .Values.persistence.enabled (not .Values.persistence.existingClaim) }}
|
||||
volumeClaimTemplates:
|
||||
|
|
|
@ -27,6 +27,8 @@ metrics:
|
|||
image: ""
|
||||
#This is what https://github.com/kumina/postfix_exporter is expecting, so setting as default
|
||||
maillog: /var/log/mail.log
|
||||
logrotate:
|
||||
enabled: true
|
||||
|
||||
# Tell helm to restart (recreate) pods on every deploy. Setting this to true will inject
|
||||
# `date/deploy-date: <timestamp>` annotation into pod specification for StateFulset. This
|
||||
|
|
Loading…
Add table
Reference in a new issue