Skip to content

Commit

Permalink
Merge pull request #1541 from gthao313/kubelet-settings
Browse files Browse the repository at this point in the history
kubelet: add setting for configuring kubeAPIQPS and kubeAPIBurst
  • Loading branch information
gthao313 authored May 4, 2021
2 parents aefc551 + 4488db6 commit a3460a8
Show file tree
Hide file tree
Showing 12 changed files with 79 additions and 0 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -333,6 +333,8 @@ The following settings are optional and allow you to further configure your clus
* `settings.kubernetes.registry-burst`: The maximum size of bursty pulls.
* `settings.kubernetes.event-qps`: The maximum event creations per second.
* `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.

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 @@ -45,4 +45,5 @@ version = "1.0.8"
"migrate_v1.1.0_shared-containerd-configs.lz4",
"migrate_v1.1.0_kubelet-event-qps-event-burst.lz4",
"migrate_v1.1.0_schnauzer-paws.lz4",
"migrate_v1.1.0_kubelet-kube-api-qps-kube-api-burst.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 @@ -52,6 +52,12 @@ eventRecordQPS: {{settings.kubernetes.event-qps}}
{{~#if settings.kubernetes.event-burst includeZero=true}}
eventBurst: {{settings.kubernetes.event-burst}}
{{~/if}}
{{~#if settings.kubernetes.kube-api-qps includeZero=true}}
kubeAPIQPS: {{settings.kubernetes.kube-api-qps}}
{{~/if}}
{{~#if settings.kubernetes.kube-api-burst includeZero=true}}
kubeAPIBurst: {{settings.kubernetes.kube-api-burst}}
{{~/if}}
kubeReserved:
cpu: "{{kube_reserve_cpu settings.kubernetes.kube-reserved.cpu}}"
{{~#if settings.kubernetes.kube-reserved.memory}}
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 @@ -52,6 +52,12 @@ eventRecordQPS: {{settings.kubernetes.event-qps}}
{{~#if settings.kubernetes.event-burst includeZero=true}}
eventBurst: {{settings.kubernetes.event-burst}}
{{~/if}}
{{~#if settings.kubernetes.kube-api-qps includeZero=true}}
kubeAPIQPS: {{settings.kubernetes.kube-api-qps}}
{{~/if}}
{{~#if settings.kubernetes.kube-api-burst includeZero=true}}
kubeAPIBurst: {{settings.kubernetes.kube-api-burst}}
{{~/if}}
kubeReserved:
cpu: "{{kube_reserve_cpu settings.kubernetes.kube-reserved.cpu}}"
{{~#if settings.kubernetes.kube-reserved.memory}}
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 @@ -52,6 +52,12 @@ eventRecordQPS: {{settings.kubernetes.event-qps}}
{{~#if settings.kubernetes.event-burst includeZero=true}}
eventBurst: {{settings.kubernetes.event-burst}}
{{~/if}}
{{~#if settings.kubernetes.kube-api-qps includeZero=true}}
kubeAPIQPS: {{settings.kubernetes.kube-api-qps}}
{{~/if}}
{{~#if settings.kubernetes.kube-api-burst includeZero=true}}
kubeAPIBurst: {{settings.kubernetes.kube-api-burst}}
{{~/if}}
kubeReserved:
cpu: "{{kube_reserve_cpu settings.kubernetes.kube-reserved.cpu}}"
{{~#if settings.kubernetes.kube-reserved.memory}}
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 @@ -52,6 +52,12 @@ eventRecordQPS: {{settings.kubernetes.event-qps}}
{{~#if settings.kubernetes.event-burst includeZero=true}}
eventBurst: {{settings.kubernetes.event-burst}}
{{~/if}}
{{~#if settings.kubernetes.kube-api-qps includeZero=true}}
kubeAPIQPS: {{settings.kubernetes.kube-api-qps}}
{{~/if}}
{{~#if settings.kubernetes.kube-api-burst includeZero=true}}
kubeAPIBurst: {{settings.kubernetes.kube-api-burst}}
{{~/if}}
kubeReserved:
cpu: "{{kube_reserve_cpu settings.kubernetes.kube-reserved.cpu}}"
{{~#if settings.kubernetes.kube-reserved.memory}}
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 @@ -52,6 +52,12 @@ eventRecordQPS: {{settings.kubernetes.event-qps}}
{{~#if settings.kubernetes.event-burst includeZero=true}}
eventBurst: {{settings.kubernetes.event-burst}}
{{~/if}}
{{~#if settings.kubernetes.kube-api-qps includeZero=true}}
kubeAPIQPS: {{settings.kubernetes.kube-api-qps}}
{{~/if}}
{{~#if settings.kubernetes.kube-api-burst includeZero=true}}
kubeAPIBurst: {{settings.kubernetes.kube-api-burst}}
{{~/if}}
kubeReserved:
cpu: "{{kube_reserve_cpu settings.kubernetes.kube-reserved.cpu}}"
{{~#if settings.kubernetes.kube-reserved.memory}}
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 @@ -30,6 +30,7 @@ members = [
"api/migration/migrations/v1.1.0/shared-containerd-configs",
"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",

"bottlerocket-release",

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
[package]
name = "kubelet-kube-api-qps-kube-api-burst"
version = "0.1.0"
authors = ["Tianhao Geng <[email protected]>"]
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 two new settings for configuring kubelet, `settings.kubernetes.kube-api-qps`
/// and `settings.kubernetes.kube-api-burst`
fn run() -> Result<()> {
migrate(AddSettingsMigration(&[
"settings.kubernetes.kube-api-qps",
"settings.kubernetes.kube-api-burst",
]))
}

// 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 @@ -143,6 +143,8 @@ struct KubernetesSettings {
registry_burst: i32,
event_qps: i32,
event_burst: i32,
kube_api_qps: i32,
kube_api_burst: 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 a3460a8

Please sign in to comment.