Skip to content

Commit

Permalink
Merge pull request #2138 from gthao313/kubelet-setting
Browse files Browse the repository at this point in the history
Add a new Kubelet setting podPidsLimit
  • Loading branch information
gthao313 authored May 19, 2022
2 parents 1ca3c31 + fbc6585 commit 72c0321
Show file tree
Hide file tree
Showing 11 changed files with 57 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -383,6 +383,7 @@ The following settings are optional and allow you to further configure your clus
* `settings.kubernetes.cpu-manager-reconcile-period`: Specifies the CPU manager reconcile period, which controls how often updated CPU assignments are written to cgroupfs. The value is a duration like `30s` for 30 seconds or `1h5m` for 1 hour and 5 minutes.
* `settings.kubernetes.topology-manager-policy`: Specifies the topology manager policy. Possible values are `none`, `restricted`, `best-effort`, and `single-numa-node`. Defaults to `none`.
* `settings.kubernetes.topology-manager-scope`: Specifies the topology manager scope. Possible values are `container` and `pod`. Defaults to `container`. If you want to group all containers in a pod to a common set of NUMA nodes, you can set this setting to `pod`.
* `settings.kubernetes.pod-pids-limit`: The maximum number of processes per pod.
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
1 change: 1 addition & 0 deletions Release.toml
Original file line number Diff line number Diff line change
Expand Up @@ -117,4 +117,5 @@ version = "1.7.2"
"(1.7.2, 1.8.0)" = [
"migrate_v1.8.0_boot-setting.lz4",
"migrate_v1.8.0_boot-setting-metadata.lz4",
"migrate_v1.8.0_kubelet-pod-pids-limit.lz4",
]
3 changes: 3 additions & 0 deletions packages/kubernetes-1.19/kubelet-config
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,9 @@ topologyManagerScope: {{settings.kubernetes.topology-manager-scope}}
{{#if settings.kubernetes.topology-manager-policy}}
topologyManagerPolicy: {{settings.kubernetes.topology-manager-policy}}
{{/if}}
{{#if settings.kubernetes.pod-pids-limit includeZero=true}}
podPidsLimit: {{settings.kubernetes.pod-pids-limit}}
{{/if}}
resolvConf: "/etc/resolv.conf"
hairpinMode: hairpin-veth
readOnlyPort: 0
Expand Down
3 changes: 3 additions & 0 deletions packages/kubernetes-1.20/kubelet-config
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,9 @@ topologyManagerScope: {{settings.kubernetes.topology-manager-scope}}
{{#if settings.kubernetes.topology-manager-policy}}
topologyManagerPolicy: {{settings.kubernetes.topology-manager-policy}}
{{/if}}
{{#if settings.kubernetes.pod-pids-limit includeZero=true}}
podPidsLimit: {{settings.kubernetes.pod-pids-limit}}
{{/if}}
resolvConf: "/etc/resolv.conf"
hairpinMode: hairpin-veth
readOnlyPort: 0
Expand Down
3 changes: 3 additions & 0 deletions packages/kubernetes-1.21/kubelet-config
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,9 @@ topologyManagerScope: {{settings.kubernetes.topology-manager-scope}}
{{#if settings.kubernetes.topology-manager-policy}}
topologyManagerPolicy: {{settings.kubernetes.topology-manager-policy}}
{{/if}}
{{#if settings.kubernetes.pod-pids-limit includeZero=true}}
podPidsLimit: {{settings.kubernetes.pod-pids-limit}}
{{/if}}
resolvConf: "/etc/resolv.conf"
hairpinMode: hairpin-veth
readOnlyPort: 0
Expand Down
3 changes: 3 additions & 0 deletions packages/kubernetes-1.22/kubelet-config
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,9 @@ topologyManagerScope: {{settings.kubernetes.topology-manager-scope}}
{{#if settings.kubernetes.topology-manager-policy}}
topologyManagerPolicy: {{settings.kubernetes.topology-manager-policy}}
{{/if}}
{{#if settings.kubernetes.pod-pids-limit includeZero=true}}
podPidsLimit: {{settings.kubernetes.pod-pids-limit}}
{{/if}}
resolvConf: "/etc/resolv.conf"
hairpinMode: hairpin-veth
readOnlyPort: 0
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 @@ -50,6 +50,7 @@ members = [
"api/migration/migrations/v1.7.0/public-control-container-v0-6-0",
"api/migration/migrations/v1.8.0/boot-setting",
"api/migration/migrations/v1.8.0/boot-setting-metadata",
"api/migration/migrations/v1.8.0/kubelet-pod-pids-limit",

"bottlerocket-release",

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
[package]
name = "kubelet-pod-pids-limit"
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", version = "0.1.0"}
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 setting for configuring pod-pids-limit, `settings.kubernetes.pod-pids-limit`
fn run() -> Result<()> {
migrate(AddPrefixesMigration(vec![
"settings.kubernetes.pod-pids-limit",
]))
}

// 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 @@ -196,6 +196,7 @@ struct KubernetesSettings {
cpu_manager_reconcile_period: KubernetesDurationValue,
topology_manager_scope: TopologyManagerScope,
topology_manager_policy: TopologyManagerPolicy,
pod_pids_limit: i64,

// 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 72c0321

Please sign in to comment.