Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

kubelet: add setting for configuring systemReserved #1606

Merged
merged 2 commits into from
Jun 9, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -340,6 +340,14 @@ The following settings are optional and allow you to further configure your clus
```
gthao313 marked this conversation as resolved.
Show resolved Hide resolved
allowed-unsafe-sysctls = ["net.core.somaxconn", "net.ipv4.ip_local_port_range"]
```
* `settings.kubernetes.system-reserved`: Resources reserved for system components.
* Example user data for setting up system reserved:
```
[settings.kubernetes.system-reserved]
cpu = "10m"
gthao313 marked this conversation as resolved.
Show resolved Hide resolved
memory = "100Mi"
ephemeral-storage= "1Gi"
```
* `settings.kubernetes.registry-qps`: The registry pull QPS.
* `settings.kubernetes.registry-burst`: The maximum size of bursty pulls.
* `settings.kubernetes.event-qps`: The maximum event creations per second.
Expand Down
1 change: 1 addition & 0 deletions Release.toml
Original file line number Diff line number Diff line change
Expand Up @@ -50,4 +50,5 @@ version = "1.1.1"
"(1.1.0, 1.1.1)" = []
"(1.1.1, 1.1.2)" = [
"migrate_v1.1.2_kubelet-container-log.lz4",
"migrate_v1.1.2_kubelet-system-reserved.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 @@ -68,6 +68,12 @@ kubeReserved:
{{~/if}}
{{~/if}}
ephemeral-storage: "{{default "1Gi" settings.kubernetes.kube-reserved.ephemeral-storage}}"
{{~#if settings.kubernetes.system-reserved}}
webern marked this conversation as resolved.
Show resolved Hide resolved
systemReserved:
{{~#each settings.kubernetes.system-reserved}}
{{@key}}: "{{this}}"
{{~/each}}
{{~/if}}
resolvConf: "/etc/resolv.conf"
hairpinMode: hairpin-veth
readOnlyPort: 0
Expand Down
6 changes: 6 additions & 0 deletions packages/kubernetes-1.17/kubelet-config
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,12 @@ kubeReserved:
{{~/if}}
{{~/if}}
ephemeral-storage: "{{default "1Gi" settings.kubernetes.kube-reserved.ephemeral-storage}}"
{{~#if settings.kubernetes.system-reserved}}
systemReserved:
{{~#each settings.kubernetes.system-reserved}}
{{@key}}: "{{this}}"
{{~/each}}
{{~/if}}
resolvConf: "/etc/resolv.conf"
hairpinMode: hairpin-veth
readOnlyPort: 0
Expand Down
6 changes: 6 additions & 0 deletions packages/kubernetes-1.18/kubelet-config
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,12 @@ kubeReserved:
{{~/if}}
{{~/if}}
ephemeral-storage: "{{default "1Gi" settings.kubernetes.kube-reserved.ephemeral-storage}}"
{{~#if settings.kubernetes.system-reserved}}
systemReserved:
{{~#each settings.kubernetes.system-reserved}}
{{@key}}: "{{this}}"
{{~/each}}
{{~/if}}
resolvConf: "/etc/resolv.conf"
hairpinMode: hairpin-veth
readOnlyPort: 0
Expand Down
6 changes: 6 additions & 0 deletions packages/kubernetes-1.19/kubelet-config
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,12 @@ kubeReserved:
{{~/if}}
{{~/if}}
ephemeral-storage: "{{default "1Gi" settings.kubernetes.kube-reserved.ephemeral-storage}}"
{{~#if settings.kubernetes.system-reserved}}
systemReserved:
{{~#each settings.kubernetes.system-reserved}}
{{@key}}: "{{this}}"
{{~/each}}
{{~/if}}
resolvConf: "/etc/resolv.conf"
hairpinMode: hairpin-veth
readOnlyPort: 0
Expand Down
6 changes: 6 additions & 0 deletions packages/kubernetes-1.20/kubelet-config
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,12 @@ kubeReserved:
{{~/if}}
{{~/if}}
ephemeral-storage: "{{default "1Gi" settings.kubernetes.kube-reserved.ephemeral-storage}}"
{{~#if settings.kubernetes.system-reserved}}
systemReserved:
{{~#each settings.kubernetes.system-reserved}}
{{@key}}: "{{this}}"
{{~/each}}
{{~/if}}
cpuManagerPolicy: "static"
resolvConf: "/etc/resolv.conf"
hairpinMode: hairpin-veth
Expand Down
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 @@ -32,6 +32,7 @@ members = [
"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",
"api/migration/migrations/v1.1.2/kubelet-system-reserved",

"bottlerocket-release",

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
[package]
name = "kubelet-system-reserved"
version = "0.1.0"
authors = ["Tianhao Geng <tianhg@amazon.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,22 @@
#![deny(rust_2018_idioms)]

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

/// We added a new settings for configuring kubelet, `settings.kubernetes.system-reserved`
fn run() -> Result<()> {
migrate(AddPrefixesMigration(vec![
"settings.kubernetes.system-reserved",
]))
}

// 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);
}
}
1 change: 1 addition & 0 deletions sources/models/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@ struct KubernetesSettings {
standalone_mode: bool,
eviction_hard: HashMap<KubernetesEvictionHardKey, KubernetesThresholdValue>,
kube_reserved: HashMap<KubernetesReservedResourceKey, KubernetesQuantityValue>,
system_reserved: HashMap<KubernetesReservedResourceKey, KubernetesQuantityValue>,
allowed_unsafe_sysctls: Vec<SingleLineString>,
server_tls_bootstrap: bool,
cloud_provider: KubernetesCloudProvider,
Expand Down