mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-26 21:17:23 +00:00
Merge pull request #1234 from brendandburns/fix
Add initial logrotate support.
This commit is contained in:
commit
732b7ce7ef
11
cluster/saltbase/salt/logrotate/conf
Normal file
11
cluster/saltbase/salt/logrotate/conf
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
/var/log/{{ file }}.log {
|
||||||
|
rotate 5
|
||||||
|
copytruncate
|
||||||
|
missingok
|
||||||
|
notifempty
|
||||||
|
compress
|
||||||
|
maxsize 100m
|
||||||
|
daily
|
||||||
|
create 0644 root root
|
||||||
|
}
|
||||||
|
|
1
cluster/saltbase/salt/logrotate/cron
Normal file
1
cluster/saltbase/salt/logrotate/cron
Normal file
@ -0,0 +1 @@
|
|||||||
|
logrotate /etc/logrotate.conf
|
26
cluster/saltbase/salt/logrotate/init.sls
Normal file
26
cluster/saltbase/salt/logrotate/init.sls
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
logrotate:
|
||||||
|
pkg:
|
||||||
|
- installed
|
||||||
|
|
||||||
|
{% set logrotate_files = ['scheduler', 'kube-proxy', 'kubelet', 'apiserver', 'controller-manager'] %}
|
||||||
|
{% for file in logrotate_files %}
|
||||||
|
/etc/logrotate.d/{{ file }}:
|
||||||
|
file:
|
||||||
|
- managed
|
||||||
|
- source: salt://logrotate/conf
|
||||||
|
- template: jinja
|
||||||
|
- user: root
|
||||||
|
- group: root
|
||||||
|
- mode: 644
|
||||||
|
- context:
|
||||||
|
file: {{ file }}
|
||||||
|
{% endfor %}
|
||||||
|
|
||||||
|
/etc/cron.hourly/logrotate:
|
||||||
|
file:
|
||||||
|
- managed
|
||||||
|
- source: salt://logrotate/cron
|
||||||
|
- template: jinja
|
||||||
|
- user: root
|
||||||
|
- group: root
|
||||||
|
- mode: 644
|
@ -10,6 +10,7 @@ base:
|
|||||||
- kube-proxy
|
- kube-proxy
|
||||||
- cadvisor
|
- cadvisor
|
||||||
- nsinit
|
- nsinit
|
||||||
|
- logrotate
|
||||||
{% if grains['cloud'] is defined and grains['cloud'] == 'azure' %}
|
{% if grains['cloud'] is defined and grains['cloud'] == 'azure' %}
|
||||||
- openvpn-client
|
- openvpn-client
|
||||||
{% else %}
|
{% else %}
|
||||||
@ -24,6 +25,7 @@ base:
|
|||||||
- controller-manager
|
- controller-manager
|
||||||
- scheduler
|
- scheduler
|
||||||
- nginx
|
- nginx
|
||||||
|
- logrotate
|
||||||
{% if grains['cloud'] is defined and grains['cloud'] == 'azure' %}
|
{% if grains['cloud'] is defined and grains['cloud'] == 'azure' %}
|
||||||
- openvpn
|
- openvpn
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
Loading…
Reference in New Issue
Block a user