first commit
This commit is contained in:
64
templates/fluent-bit/logrotate/logrotate-cronjob.yaml
Normal file
64
templates/fluent-bit/logrotate/logrotate-cronjob.yaml
Normal file
@@ -0,0 +1,64 @@
|
||||
{{- if and .Values.fluentBit.enabled .Values.fluentBit.logrotate.enabled -}}
|
||||
apiVersion: batch/v1
|
||||
kind: CronJob
|
||||
metadata:
|
||||
name: logrotate-{{ template "fluent-bit.appName" . }}
|
||||
namespace: {{ .Release.Namespace }}
|
||||
labels:
|
||||
dplane: "logrotate-job"
|
||||
spec:
|
||||
concurrencyPolicy: Forbid
|
||||
failedJobsHistoryLimit: 1
|
||||
jobTemplate:
|
||||
spec:
|
||||
ttlSecondsAfterFinished: {{ .Values.fluentBit.logrotate.job_ttl }}
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
dplane: "logrotate-job"
|
||||
spec:
|
||||
serviceAccountName: {{ include "logrotate.serviceAccountName" . }}
|
||||
containers:
|
||||
- image: "{{ default .Values.global.image.repository .Values.global.alpinetools.image.repository }}/{{ .Values.global.alpinetools.image.name }}:{{ .Values.global.alpinetools.image.tag }}"
|
||||
imagePullPolicy: {{ .Values.global.image.pullPolicy }}
|
||||
command: [ "/bin/sh", "-c" ]
|
||||
args:
|
||||
- |
|
||||
sh /etc/logrotate.d/dynamic-logrotate.sh
|
||||
name: logrotate
|
||||
{{- with .Values.fluentBit.logrotate.securityContext }}
|
||||
securityContext:
|
||||
{{- toYaml . | nindent 16 }}
|
||||
{{- end }}
|
||||
volumeMounts:
|
||||
- mountPath: /etc/logrotate.d
|
||||
name: logrotate-config
|
||||
- mountPath: /efs
|
||||
name: {{ .Values.global.volumeStorageName }}
|
||||
- mountPath: /tmp
|
||||
name: tmpdir
|
||||
restartPolicy: OnFailure
|
||||
{{- with .Values.global.image.imagePullSecrets }}
|
||||
imagePullSecrets:
|
||||
{{- toYaml . | nindent 10 }}
|
||||
{{- end }}
|
||||
{{- if .Values.fluentBit.logrotate.podSecurityContextEnabled -}}
|
||||
{{- with .Values.fluentBit.logrotate.podSecurityContext }}
|
||||
securityContext:
|
||||
{{- toYaml . | nindent 12 }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
volumes:
|
||||
- configMap:
|
||||
defaultMode: 420
|
||||
name: logrotate-{{ template "fluent-bit.appName" . }}
|
||||
name: logrotate-config
|
||||
- name: {{ .Values.global.volumeStorageName }}
|
||||
persistentVolumeClaim:
|
||||
claimName: {{ .Release.Namespace }}-{{ .Values.global.claimName }}
|
||||
- emptyDir: {}
|
||||
name: tmpdir
|
||||
schedule: "{{ .Values.fluentBit.logrotate.schedule }}"
|
||||
successfulJobsHistoryLimit: 1
|
||||
suspend: false
|
||||
{{- end }}
|
||||
Reference in New Issue
Block a user