@@ -428,17 +428,19 @@ function ensure-local-ssds() {
428
428
# Installs logrotate configuration files
429
429
function setup-logrotate() {
430
430
mkdir -p /etc/logrotate.d/
431
- # Configure log rotation for all logs in /var/log, which is where k8s services
432
- # are configured to write their log files. Whenever logrotate is ran, this
433
- # config will:
434
- # * rotate the log file if its size is > 100Mb OR if one day has elapsed
435
- # * save rotated logs into a gzipped timestamped backup
436
- # * log file timestamp (controlled by 'dateformat') includes seconds too. This
437
- # ensures that logrotate can generate unique logfiles during each rotation
438
- # (otherwise it skips rotation if 'maxsize' is reached multiple times in a
439
- # day).
440
- # * keep only 5 old (rotated) logs, and will discard older logs.
441
- cat > /etc/logrotate.d/allvarlogs << EOF
431
+
432
+ if [[ " ${ENABLE_LOGROTATE_FILES:- false} " = " true" ]]; then
433
+ # Configure log rotation for all logs in /var/log, which is where k8s services
434
+ # are configured to write their log files. Whenever logrotate is ran, this
435
+ # config will:
436
+ # * rotate the log file if its size is > 100Mb OR if one day has elapsed
437
+ # * save rotated logs into a gzipped timestamped backup
438
+ # * log file timestamp (controlled by 'dateformat') includes seconds too. This
439
+ # ensures that logrotate can generate unique logfiles during each rotation
440
+ # (otherwise it skips rotation if 'maxsize' is reached multiple times in a
441
+ # day).
442
+ # * keep only 5 old (rotated) logs, and will discard older logs.
443
+ cat > /etc/logrotate.d/allvarlogs << EOF
442
444
/var/log/*.log {
443
445
rotate ${LOGROTATE_FILES_MAX_COUNT:- 5}
444
446
copytruncate
@@ -452,9 +454,11 @@ function setup-logrotate() {
452
454
create 0644 root root
453
455
}
454
456
EOF
457
+ fi
455
458
456
- # Configure log rotation for pod logs in /var/log/pods/NAMESPACE_NAME_UID.
457
- cat > /etc/logrotate.d/allpodlogs << EOF
459
+ if [[ " ${ENABLE_POD_LOG:- false} " = " true" ]]; then
460
+ # Configure log rotation for pod logs in /var/log/pods/NAMESPACE_NAME_UID.
461
+ cat > /etc/logrotate.d/allpodlogs << EOF
458
462
/var/log/pods/*/*.log {
459
463
rotate ${POD_LOG_MAX_FILE:- 5}
460
464
copytruncate
468
472
create 0644 root root
469
473
}
470
474
EOF
475
+ fi
471
476
}
472
477
473
478
# Finds the master PD device; returns it in MASTER_PD_DEVICE
924
929
limitedResources:
925
930
- resource: pods
926
931
matchScopes:
927
- - scopeName: PriorityClass
932
+ - scopeName: PriorityClass
928
933
operator: In
929
934
values: ["system-node-critical", "system-cluster-critical"]
930
935
EOF
0 commit comments