openstack-helm/panko/templates/cron-job-events-cleaner.yaml
Pete Birley 31bd9c832d Logs: Make it optional to use log_config_append option
This PS enables the use of simple logging options if desired.

Change-Id: If6ea420c6ed595b3b6b6eedf99a0bf26a20b6abf
Signed-off-by: Pete Birley <pete@port.direct>
2019-06-17 13:51:21 -05:00

91 lines
3.8 KiB
YAML

{{/*
Copyright 2019 Wind River Systems, Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/}}
{{- if .Values.manifests.cron_job_events_cleaner }}
{{- $envAll := . }}
{{- $mounts_panko_events_cleaner := .Values.pod.mounts.panko_events_cleaner.panko_events_cleaner }}
{{- $mounts_panko_events_cleaner_init := .Values.pod.mounts.panko_events_cleaner.init_container }}
{{- $serviceAccountName := "panko-events-cleaner" }}
{{ tuple $envAll "events_cleaner" $serviceAccountName | include "helm-toolkit.snippets.kubernetes_pod_rbac_serviceaccount" }}
---
apiVersion: batch/v1beta1
kind: CronJob
metadata:
name: panko-events-cleaner
annotations:
{{ tuple $envAll | include "helm-toolkit.snippets.release_uuid" }}
spec:
schedule: {{ .Values.jobs.events_cleaner.cron | quote }}
successfulJobsHistoryLimit: {{ .Values.jobs.events_cleaner.history.success }}
failedJobsHistoryLimit: {{ .Values.jobs.events_cleaner.history.failed }}
concurrencyPolicy: Forbid
jobTemplate:
metadata:
labels:
{{ tuple $envAll "panko" "events-cleaner" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 8 }}
spec:
template:
spec:
serviceAccountName: {{ $serviceAccountName }}
restartPolicy: OnFailure
nodeSelector:
{{ .Values.labels.job.node_selector_key }}: {{ .Values.labels.job.node_selector_value }}
initContainers:
{{ tuple $envAll "events_cleaner" $mounts_panko_events_cleaner_init | include "helm-toolkit.snippets.kubernetes_entrypoint_init_container" | indent 12 }}
containers:
- name: panko-events-cleaner
{{ tuple $envAll "panko_events_cleaner" | include "helm-toolkit.snippets.image" | indent 14 }}
{{ tuple $envAll $envAll.Values.pod.resources.jobs.events_cleaner | include "helm-toolkit.snippets.kubernetes_resources" | indent 14 }}
command:
- /tmp/panko-events-cleaner.sh
volumeMounts:
- name: pod-tmp
mountPath: /tmp
- name: panko-bin
mountPath: /tmp/panko-events-cleaner.sh
subPath: panko-events-cleaner.sh
readOnly: true
- name: etcpanko
mountPath: /etc/panko
- name: panko-etc
mountPath: /etc/panko/panko.conf
subPath: panko.conf
readOnly: true
{{- if .Values.conf.panko.DEFAULT.log_config_append }}
- name: panko-etc
mountPath: {{ .Values.conf.panko.DEFAULT.log_config_append }}
subPath: {{ base .Values.conf.panko.DEFAULT.log_config_append }}
readOnly: true
{{- end }}
{{ if $mounts_panko_events_cleaner.volumeMounts }}{{ toYaml $mounts_panko_events_cleaner.volumeMounts | indent 16 }}{{ end }}
volumes:
- name: pod-tmp
mountPath: /tmp
- name: etcpanko
emptyDir: {}
- name: panko-etc
secret:
secretName: panko-etc
defaultMode: 0444
- name: panko-bin
configMap:
name: panko-bin
defaultMode: 0555
{{ if $mounts_panko_events_cleaner.volumes }}{{ toYaml $mounts_panko_events_cleaner.volumes | indent 12 }}{{ end }}
{{- end }}