Skip to content

Commit

Permalink
Merge pull request #1589 from samjo-nyang/develop
Browse files Browse the repository at this point in the history
kubelet: add setting for configuring containerLogMaxFiles and MaxSize
  • Loading branch information
webern authored May 27, 2021
2 parents 0fe7e8f + aa6d1ae commit 94e0167
Show file tree
Hide file tree
Showing 12 changed files with 81 additions and 0 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -346,6 +346,8 @@ The following settings are optional and allow you to further configure your clus
* `settings.kubernetes.event-burst`: The maximum size of a burst of event creations.
* `settings.kubernetes.kube-api-qps`: The QPS to use while talking with kubernetes apiserver.
* `settings.kubernetes.kube-api-burst`: The burst to allow while talking with kubernetes.
* `settings.kubernetes.container-log-max-size`: The maximum size of container log file before it is rotated.
* `settings.kubernetes.container-log-max-files`: The maximum number of container log files that can be present for a container.
You can also optionally specify static pods for your node with the following settings.
Static pods can be particularly useful when running in standalone mode.
Expand Down
3 changes: 3 additions & 0 deletions Release.toml
Original file line number Diff line number Diff line change
Expand Up @@ -48,3 +48,6 @@ version = "1.1.1"
"migrate_v1.1.0_kubelet-kube-api-qps-kube-api-burst.lz4",
]
"(1.1.0, 1.1.1)" = []
"(1.1.1, 1.1.2)" = [
"migrate_v1.1.2_kubelet-container-log.lz4",
]
6 changes: 6 additions & 0 deletions packages/kubernetes-1.16/kubelet-config
Original file line number Diff line number Diff line change
Expand Up @@ -84,3 +84,9 @@ tlsCipherSuites:
- TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256
maxPods: {{default 110 settings.kubernetes.max-pods}}
staticPodPath: "/etc/kubernetes/static-pods/"
{{~#if settings.kubernetes.container-log-max-size includeZero=true}}
containerLogMaxSize: {{settings.kubernetes.container-log-max-size}}
{{~/if}}
{{~#if settings.kubernetes.container-log-max-files includeZero=true}}
containerLogMaxFiles: {{settings.kubernetes.container-log-max-files}}
{{~/if}}
6 changes: 6 additions & 0 deletions packages/kubernetes-1.17/kubelet-config
Original file line number Diff line number Diff line change
Expand Up @@ -85,3 +85,9 @@ tlsCipherSuites:
- TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256
maxPods: {{default 110 settings.kubernetes.max-pods}}
staticPodPath: "/etc/kubernetes/static-pods/"
{{~#if settings.kubernetes.container-log-max-size includeZero=true}}
containerLogMaxSize: {{settings.kubernetes.container-log-max-size}}
{{~/if}}
{{~#if settings.kubernetes.container-log-max-files includeZero=true}}
containerLogMaxFiles: {{settings.kubernetes.container-log-max-files}}
{{~/if}}
6 changes: 6 additions & 0 deletions packages/kubernetes-1.18/kubelet-config
Original file line number Diff line number Diff line change
Expand Up @@ -85,3 +85,9 @@ tlsCipherSuites:
- TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256
maxPods: {{default 110 settings.kubernetes.max-pods}}
staticPodPath: "/etc/kubernetes/static-pods/"
{{~#if settings.kubernetes.container-log-max-size includeZero=true}}
containerLogMaxSize: {{settings.kubernetes.container-log-max-size}}
{{~/if}}
{{~#if settings.kubernetes.container-log-max-files includeZero=true}}
containerLogMaxFiles: {{settings.kubernetes.container-log-max-files}}
{{~/if}}
6 changes: 6 additions & 0 deletions packages/kubernetes-1.19/kubelet-config
Original file line number Diff line number Diff line change
Expand Up @@ -86,3 +86,9 @@ tlsCipherSuites:
volumePluginDir: "/var/lib/kubelet/plugins/volume/exec"
maxPods: {{default 110 settings.kubernetes.max-pods}}
staticPodPath: "/etc/kubernetes/static-pods/"
{{~#if settings.kubernetes.container-log-max-size includeZero=true}}
containerLogMaxSize: {{settings.kubernetes.container-log-max-size}}
{{~/if}}
{{~#if settings.kubernetes.container-log-max-files includeZero=true}}
containerLogMaxFiles: {{settings.kubernetes.container-log-max-files}}
{{~/if}}
6 changes: 6 additions & 0 deletions packages/kubernetes-1.20/kubelet-config
Original file line number Diff line number Diff line change
Expand Up @@ -87,3 +87,9 @@ tlsCipherSuites:
volumePluginDir: "/var/lib/kubelet/plugins/volume/exec"
maxPods: {{default 110 settings.kubernetes.max-pods}}
staticPodPath: "/etc/kubernetes/static-pods/"
{{~#if settings.kubernetes.container-log-max-size includeZero=true}}
containerLogMaxSize: {{settings.kubernetes.container-log-max-size}}
{{~/if}}
{{~#if settings.kubernetes.container-log-max-files includeZero=true}}
containerLogMaxFiles: {{settings.kubernetes.container-log-max-files}}
{{~/if}}
7 changes: 7 additions & 0 deletions sources/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions sources/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ members = [
"api/migration/migrations/v1.1.0/kubelet-event-qps-event-burst",
"api/migration/migrations/v1.1.0/schnauzer-paws",
"api/migration/migrations/v1.1.0/kubelet-kube-api-qps-kube-api-burst",
"api/migration/migrations/v1.1.2/kubelet-container-log",

"bottlerocket-release",

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
[package]
name = "kubelet-container-log"
version = "0.1.0"
authors = ["Sungwon Cho <samjo.nyang@gmail.com>"]
license = "Apache-2.0 OR MIT"
edition = "2018"
publish = false
# Don't rebuild crate just because of changes to README.
exclude = ["README.md"]

[dependencies]
migration-helpers = { path = "../../../migration-helpers" }
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#![deny(rust_2018_idioms)]

use migration_helpers::common_migrations::AddSettingsMigration;
use migration_helpers::{migrate, Result};
use std::process;

/// We added a new settings for configuring kubelet, `settings.kubernetes.container-log-max-size`
/// and `settings.kubernetes.container-log-max-files`
fn run() -> Result<()> {
migrate(AddSettingsMigration(&[
"settings.kubernetes.container-log-max-size",
"settings.kubernetes.container-log-max-files",
]))
}

// Returning a Result from main makes it print a Debug representation of the error, but with Snafu
// we have nice Display representations of the error, so we wrap "main" (run) and print any error.
// https://github.com/shepmaster/snafu/issues/110
fn main() {
if let Err(e) = run() {
eprintln!("{}", e);
process::exit(1);
}
}
2 changes: 2 additions & 0 deletions sources/models/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,8 @@ struct KubernetesSettings {
event_burst: i32,
kube_api_qps: i32,
kube_api_burst: i32,
container_log_max_size: KubernetesQuantityValue,
container_log_max_files: i32,

// Settings where we generate a value based on the runtime environment. The user can specify a
// value to override the generated one, but typically would not.
Expand Down

0 comments on commit 94e0167

Please sign in to comment.