Skip to content

Commit

Permalink
Add CPU CFS quota configs
Browse files Browse the repository at this point in the history
  • Loading branch information
stanley98yu committed Oct 20, 2021
1 parent 2b142ad commit 2f367e9
Show file tree
Hide file tree
Showing 10 changed files with 45 additions and 10 deletions.
2 changes: 2 additions & 0 deletions autogen/main/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,8 @@ The node_pools variable takes the following parameters:
| auto_upgrade | Whether the nodes will be automatically upgraded | true (if cluster is regional) | Optional |
{% if beta_cluster %}
| cpu_manager_policy | The CPU manager policy on the node. One of "none" or "static". | "none" | Optional |
| cpu_cfs_quota | Enforces the Pod's CPU limit. Setting this value to false means that the CPU limits for Pods are ignored | true | Optional |
| cpu_cfs_quota_period | The CPU CFS quota period value, which specifies the period of how often a cgroup's access to CPU resources should be reallocated | "100ms" | Optional |
{% endif %}
| disk_size_gb | Size of the disk attached to each node, specified in GB. The smallest allowed disk size is 10GB | 100 | Optional |
| disk_type | Type of the disk attached to each node (e.g. 'pd-standard' or 'pd-ssd') | pd-standard | Optional |
Expand Down
9 changes: 7 additions & 2 deletions autogen/main/cluster.tf.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -588,10 +588,15 @@ resource "google_container_node_pool" "pools" {
boot_disk_kms_key = lookup(each.value, "boot_disk_kms_key", "")

dynamic "kubelet_config" {
for_each = contains(keys(each.value), "cpu_manager_policy") ? [1] : []
for_each = length(setintersection(
keys(each.value),
["cpu_manager_policy", "cpu_cfs_quota", "cpu_cfs_quota_period"]
)) != 0 ? [1] : []

content {
cpu_manager_policy = lookup(each.value, "cpu_manager_policy")
cpu_manager_policy = lookup(each.value, "cpu_manager_policy", "none")
cpu_cfs_quota = lookup(each.value, "cpu_cfs_quota", true)
cpu_cfs_quota_period = lookup(each.value, "cpu_cfs_quota_period", "100ms")
}
}

Expand Down
2 changes: 2 additions & 0 deletions modules/beta-private-cluster-update-variant/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -299,6 +299,8 @@ The node_pools variable takes the following parameters:
| autoscaling | Configuration required by cluster autoscaler to adjust the size of the node pool to the current cluster usage | true | Optional |
| auto_upgrade | Whether the nodes will be automatically upgraded | true (if cluster is regional) | Optional |
| cpu_manager_policy | The CPU manager policy on the node. One of "none" or "static". | "none" | Optional |
| cpu_cfs_quota | Enforces the Pod's CPU limit. Setting this value to false means that the CPU limits for Pods are ignored | true | Optional |
| cpu_cfs_quota_period | The CPU CFS quota period value, which specifies the period of how often a cgroup's access to CPU resources should be reallocated | "100ms" | Optional |
| disk_size_gb | Size of the disk attached to each node, specified in GB. The smallest allowed disk size is 10GB | 100 | Optional |
| disk_type | Type of the disk attached to each node (e.g. 'pd-standard' or 'pd-ssd') | pd-standard | Optional |
| effect | Effect for the taint | | Required |
Expand Down
9 changes: 7 additions & 2 deletions modules/beta-private-cluster-update-variant/cluster.tf
Original file line number Diff line number Diff line change
Expand Up @@ -534,10 +534,15 @@ resource "google_container_node_pool" "pools" {
boot_disk_kms_key = lookup(each.value, "boot_disk_kms_key", "")

dynamic "kubelet_config" {
for_each = contains(keys(each.value), "cpu_manager_policy") ? [1] : []
for_each = length(setintersection(
keys(each.value),
["cpu_manager_policy", "cpu_cfs_quota", "cpu_cfs_quota_period"]
)) != 0 ? [1] : []

content {
cpu_manager_policy = lookup(each.value, "cpu_manager_policy")
cpu_manager_policy = lookup(each.value, "cpu_manager_policy", "none")
cpu_cfs_quota = lookup(each.value, "cpu_cfs_quota", true)
cpu_cfs_quota_period = lookup(each.value, "cpu_cfs_quota_period", "100ms")
}
}

Expand Down
2 changes: 2 additions & 0 deletions modules/beta-private-cluster/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,8 @@ The node_pools variable takes the following parameters:
| autoscaling | Configuration required by cluster autoscaler to adjust the size of the node pool to the current cluster usage | true | Optional |
| auto_upgrade | Whether the nodes will be automatically upgraded | true (if cluster is regional) | Optional |
| cpu_manager_policy | The CPU manager policy on the node. One of "none" or "static". | "none" | Optional |
| cpu_cfs_quota | Enforces the Pod's CPU limit. Setting this value to false means that the CPU limits for Pods are ignored | true | Optional |
| cpu_cfs_quota_period | The CPU CFS quota period value, which specifies the period of how often a cgroup's access to CPU resources should be reallocated | "100ms" | Optional |
| disk_size_gb | Size of the disk attached to each node, specified in GB. The smallest allowed disk size is 10GB | 100 | Optional |
| disk_type | Type of the disk attached to each node (e.g. 'pd-standard' or 'pd-ssd') | pd-standard | Optional |
| effect | Effect for the taint | | Required |
Expand Down
9 changes: 7 additions & 2 deletions modules/beta-private-cluster/cluster.tf
Original file line number Diff line number Diff line change
Expand Up @@ -450,10 +450,15 @@ resource "google_container_node_pool" "pools" {
boot_disk_kms_key = lookup(each.value, "boot_disk_kms_key", "")

dynamic "kubelet_config" {
for_each = contains(keys(each.value), "cpu_manager_policy") ? [1] : []
for_each = length(setintersection(
keys(each.value),
["cpu_manager_policy", "cpu_cfs_quota", "cpu_cfs_quota_period"]
)) != 0 ? [1] : []

content {
cpu_manager_policy = lookup(each.value, "cpu_manager_policy")
cpu_manager_policy = lookup(each.value, "cpu_manager_policy", "none")
cpu_cfs_quota = lookup(each.value, "cpu_cfs_quota", true)
cpu_cfs_quota_period = lookup(each.value, "cpu_cfs_quota_period", "100ms")
}
}

Expand Down
2 changes: 2 additions & 0 deletions modules/beta-public-cluster-update-variant/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -286,6 +286,8 @@ The node_pools variable takes the following parameters:
| autoscaling | Configuration required by cluster autoscaler to adjust the size of the node pool to the current cluster usage | true | Optional |
| auto_upgrade | Whether the nodes will be automatically upgraded | true (if cluster is regional) | Optional |
| cpu_manager_policy | The CPU manager policy on the node. One of "none" or "static". | "none" | Optional |
| cpu_cfs_quota | Enforces the Pod's CPU limit. Setting this value to false means that the CPU limits for Pods are ignored | true | Optional |
| cpu_cfs_quota_period | The CPU CFS quota period value, which specifies the period of how often a cgroup's access to CPU resources should be reallocated | "100ms" | Optional |
| disk_size_gb | Size of the disk attached to each node, specified in GB. The smallest allowed disk size is 10GB | 100 | Optional |
| disk_type | Type of the disk attached to each node (e.g. 'pd-standard' or 'pd-ssd') | pd-standard | Optional |
| effect | Effect for the taint | | Required |
Expand Down
9 changes: 7 additions & 2 deletions modules/beta-public-cluster-update-variant/cluster.tf
Original file line number Diff line number Diff line change
Expand Up @@ -515,10 +515,15 @@ resource "google_container_node_pool" "pools" {
boot_disk_kms_key = lookup(each.value, "boot_disk_kms_key", "")

dynamic "kubelet_config" {
for_each = contains(keys(each.value), "cpu_manager_policy") ? [1] : []
for_each = length(setintersection(
keys(each.value),
["cpu_manager_policy", "cpu_cfs_quota", "cpu_cfs_quota_period"]
)) != 0 ? [1] : []

content {
cpu_manager_policy = lookup(each.value, "cpu_manager_policy")
cpu_manager_policy = lookup(each.value, "cpu_manager_policy", "none")
cpu_cfs_quota = lookup(each.value, "cpu_cfs_quota", true)
cpu_cfs_quota_period = lookup(each.value, "cpu_cfs_quota_period", "100ms")
}
}

Expand Down
2 changes: 2 additions & 0 deletions modules/beta-public-cluster/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,8 @@ The node_pools variable takes the following parameters:
| autoscaling | Configuration required by cluster autoscaler to adjust the size of the node pool to the current cluster usage | true | Optional |
| auto_upgrade | Whether the nodes will be automatically upgraded | true (if cluster is regional) | Optional |
| cpu_manager_policy | The CPU manager policy on the node. One of "none" or "static". | "none" | Optional |
| cpu_cfs_quota | Enforces the Pod's CPU limit. Setting this value to false means that the CPU limits for Pods are ignored | true | Optional |
| cpu_cfs_quota_period | The CPU CFS quota period value, which specifies the period of how often a cgroup's access to CPU resources should be reallocated | "100ms" | Optional |
| disk_size_gb | Size of the disk attached to each node, specified in GB. The smallest allowed disk size is 10GB | 100 | Optional |
| disk_type | Type of the disk attached to each node (e.g. 'pd-standard' or 'pd-ssd') | pd-standard | Optional |
| effect | Effect for the taint | | Required |
Expand Down
9 changes: 7 additions & 2 deletions modules/beta-public-cluster/cluster.tf
Original file line number Diff line number Diff line change
Expand Up @@ -431,10 +431,15 @@ resource "google_container_node_pool" "pools" {
boot_disk_kms_key = lookup(each.value, "boot_disk_kms_key", "")

dynamic "kubelet_config" {
for_each = contains(keys(each.value), "cpu_manager_policy") ? [1] : []
for_each = length(setintersection(
keys(each.value),
["cpu_manager_policy", "cpu_cfs_quota", "cpu_cfs_quota_period"]
)) != 0 ? [1] : []

content {
cpu_manager_policy = lookup(each.value, "cpu_manager_policy")
cpu_manager_policy = lookup(each.value, "cpu_manager_policy", "none")
cpu_cfs_quota = lookup(each.value, "cpu_cfs_quota", true)
cpu_cfs_quota_period = lookup(each.value, "cpu_cfs_quota_period", "100ms")
}
}

Expand Down

0 comments on commit 2f367e9

Please sign in to comment.