diff --git a/nagios/templates/deployment.yaml b/nagios/templates/deployment.yaml index fb469192a..a8dbc626d 100644 --- a/nagios/templates/deployment.yaml +++ b/nagios/templates/deployment.yaml @@ -87,6 +87,19 @@ spec: terminationGracePeriodSeconds: {{ .Values.pod.lifecycle.termination_grace_period.nagios.timeout | default "30" }} initContainers: {{ tuple $envAll "nagios" list | include "helm-toolkit.snippets.kubernetes_entrypoint_init_container" | indent 8 }} + - name: nagios-log-ownership +{{ tuple $envAll "nagios" | include "helm-toolkit.snippets.image" | indent 10 }} + securityContext: + runAsUser: 0 + command: + - chown + - -R + - nagios:root + - /opt/nagios/var/log + volumeMounts: + - name: pod-var-log + mountPath: /opt/nagios/var/log + readOnly: false containers: - name: apache-proxy {{ tuple $envAll "apache_proxy" | include "helm-toolkit.snippets.image" | indent 10 }} @@ -170,7 +183,13 @@ spec: mountPath: /opt/nagios/etc/nagios_objects.cfg subPath: nagios_objects.cfg readOnly: true + - name: pod-var-log + mountPath: /opt/nagios/var/log + readOnly: false volumes: + - name: pod-var-log + hostPath: + path: /opt/nagios/var/log - name: nagios-etc secret: secretName: nagios-etc diff --git a/nagios/values.yaml b/nagios/values.yaml index bde51afcf..1186ff054 100644 --- a/nagios/values.yaml +++ b/nagios/values.yaml @@ -1071,7 +1071,7 @@ conf: check_command: check_ntp_sync hostgroup_name: base-os nagios: - log_file: /opt/nagios/var/nagios.log + log_file: /opt/nagios/var/log/nagios.log cfg_file: - /opt/nagios/etc/nagios_objects.cfg - /opt/nagios/etc/objects/commands.cfg @@ -1093,7 +1093,7 @@ conf: temp_path: /tmp event_broker_options: -1 log_rotation_method: d - log_archive_path: /opt/nagios/var/archives + log_archive_path: /opt/nagios/var/log/archives use_syslog: 1 log_service_retries: 1 log_host_retries: 1