From 8617f70addbb38deb64c4219867e61b5551eca3e Mon Sep 17 00:00:00 2001 From: gmarek Date: Fri, 10 Jun 2016 16:17:17 +0200 Subject: [PATCH] Adjust heapster cpu request/limit --- .../google/heapster-controller.yaml | 12 ++++++++---- .../googleinfluxdb/heapster-controller-combined.yaml | 12 ++++++++---- .../influxdb/heapster-controller.yaml | 12 ++++++++---- .../standalone/heapster-controller.yaml | 12 ++++++++---- cluster/gce/gci/configure-helper.sh | 7 +++++++ cluster/gce/trusty/configure-helper.sh | 7 +++++++ 6 files changed, 46 insertions(+), 16 deletions(-) diff --git a/cluster/addons/cluster-monitoring/google/heapster-controller.yaml b/cluster/addons/cluster-monitoring/google/heapster-controller.yaml index fb842aa076663..0fbd6972a0997 100644 --- a/cluster/addons/cluster-monitoring/google/heapster-controller.yaml +++ b/cluster/addons/cluster-monitoring/google/heapster-controller.yaml @@ -1,14 +1,18 @@ {% set base_metrics_memory = "140Mi" -%} {% set metrics_memory = base_metrics_memory -%} +{% set base_metrics_cpu = "80m" -%} +{% set metrics_cpu = base_metrics_cpu -%} {% set base_eventer_memory = "190Mi" -%} {% set eventer_memory = base_eventer_memory -%} {% set metrics_memory_per_node = 4 -%} +{% set metrics_cpu_per_node = 0.5 -%} {% set eventer_memory_per_node = 500 -%} {% set num_nodes = pillar.get('num_nodes', -1) -%} {% set nanny_memory = "90Mi" -%} {% set nanny_memory_per_node = 200 -%} {% if num_nodes >= 0 -%} {% set metrics_memory = (200 + num_nodes * metrics_memory_per_node)|string + "Mi" -%} + {% set metrics_cpu = (80 + num_nodes * metrics_cpu_per_node)|string + "m" -%} {% set eventer_memory = (200 * 1024 + num_nodes * eventer_memory_per_node)|string + "Ki" -%} {% set nanny_memory = (90 * 1024 + num_nodes * nanny_memory_per_node)|string + "Ki" -%} {% endif -%} @@ -40,10 +44,10 @@ spec: resources: # keep request = limit to keep this container in guaranteed class limits: - cpu: 100m + cpu: {{ metrics_cpu }} memory: {{ metrics_memory }} requests: - cpu: 100m + cpu: {{ metrics_cpu }} memory: {{ metrics_memory }} command: - /heapster @@ -91,8 +95,8 @@ spec: fieldPath: metadata.namespace command: - /pod_nanny - - --cpu=80m - - --extra-cpu=0.5m + - --cpu={{ base_metrics_cpu }} + - --extra-cpu={{ metrics_cpu_per_node }}m - --memory={{ base_metrics_memory }} - --extra-memory={{metrics_memory_per_node}}Mi - --threshold=5 diff --git a/cluster/addons/cluster-monitoring/googleinfluxdb/heapster-controller-combined.yaml b/cluster/addons/cluster-monitoring/googleinfluxdb/heapster-controller-combined.yaml index 11f66f268c838..13d514710c973 100644 --- a/cluster/addons/cluster-monitoring/googleinfluxdb/heapster-controller-combined.yaml +++ b/cluster/addons/cluster-monitoring/googleinfluxdb/heapster-controller-combined.yaml @@ -1,14 +1,18 @@ {% set base_metrics_memory = "140Mi" -%} {% set metrics_memory = base_metrics_memory -%} +{% set base_metrics_cpu = "80m" -%} +{% set metrics_cpu = base_metrics_cpu -%} {% set base_eventer_memory = "190Mi" -%} {% set eventer_memory = base_eventer_memory -%} {% set metrics_memory_per_node = 4 -%} +{% set metrics_cpu_per_node = 0.5 -%} {% set eventer_memory_per_node = 500 -%} {% set num_nodes = pillar.get('num_nodes', -1) -%} {% set nanny_memory = "90Mi" -%} {% set nanny_memory_per_node = 200 -%} {% if num_nodes >= 0 -%} {% set metrics_memory = (200 + num_nodes * metrics_memory_per_node)|string + "Mi" -%} + {% set metrics_cpu = (80 + num_nodes * metrics_cpu_per_node)|string + "m" -%} {% set eventer_memory = (200 * 1024 + num_nodes * eventer_memory_per_node)|string + "Ki" -%} {% set nanny_memory = (90 * 1024 + num_nodes * nanny_memory_per_node)|string + "Ki" -%} {% endif -%} @@ -40,10 +44,10 @@ spec: resources: # keep request = limit to keep this container in guaranteed class limits: - cpu: 100m + cpu: {{ metrics_cpu }} memory: {{ metrics_memory }} requests: - cpu: 100m + cpu: {{ metrics_cpu }} memory: {{ metrics_memory }} command: - /heapster @@ -92,8 +96,8 @@ spec: fieldPath: metadata.namespace command: - /pod_nanny - - --cpu=80m - - --extra-cpu=0.5m + - --cpu={{ base_metrics_cpu }} + - --extra-cpu={{ metrics_cpu_per_node }}m - --memory={{ base_metrics_memory }} - --extra-memory={{ metrics_memory_per_node }}Mi - --threshold=5 diff --git a/cluster/addons/cluster-monitoring/influxdb/heapster-controller.yaml b/cluster/addons/cluster-monitoring/influxdb/heapster-controller.yaml index eaee0c1b6fa2c..86aabe0ea6691 100644 --- a/cluster/addons/cluster-monitoring/influxdb/heapster-controller.yaml +++ b/cluster/addons/cluster-monitoring/influxdb/heapster-controller.yaml @@ -1,14 +1,18 @@ {% set base_metrics_memory = "140Mi" -%} {% set metrics_memory = base_metrics_memory -%} +{% set base_metrics_cpu = "80m" -%} +{% set metrics_cpu = base_metrics_cpu -%} {% set base_eventer_memory = "190Mi" -%} {% set eventer_memory = base_eventer_memory -%} {% set metrics_memory_per_node = 4 -%} +{% set metrics_cpu_per_node = 0.5|float -%} {% set eventer_memory_per_node = 500 -%} {% set num_nodes = pillar.get('num_nodes', -1) -%} {% set nanny_memory = "90Mi" -%} {% set nanny_memory_per_node = 200 -%} {% if num_nodes >= 0 -%} {% set metrics_memory = (200 + num_nodes * metrics_memory_per_node)|string + "Mi" -%} + {% set metrics_cpu = (80 + num_nodes * metrics_cpu_per_node)|string + "m" -%} {% set eventer_memory = (200 * 1024 + num_nodes * eventer_memory_per_node)|string + "Ki" -%} {% set nanny_memory = (90 * 1024 + num_nodes * nanny_memory_per_node)|string + "Ki" -%} {% endif -%} @@ -40,10 +44,10 @@ spec: resources: # keep request = limit to keep this container in guaranteed class limits: - cpu: 100m + cpu: {{ metrics_cpu }} memory: {{ metrics_memory }} requests: - cpu: 100m + cpu: {{ metrics_cpu }} memory: {{ metrics_memory }} command: - /heapster @@ -83,8 +87,8 @@ spec: fieldPath: metadata.namespace command: - /pod_nanny - - --cpu=80m - - --extra-cpu=0.5m + - --cpu={{ base_metrics_cpu }} + - --extra-cpu={{ metrics_cpu_per_node }}m - --memory={{ base_metrics_memory }} - --extra-memory={{ metrics_memory_per_node }}Mi - --threshold=5 diff --git a/cluster/addons/cluster-monitoring/standalone/heapster-controller.yaml b/cluster/addons/cluster-monitoring/standalone/heapster-controller.yaml index 134a692350d13..c7a7b37f681d3 100644 --- a/cluster/addons/cluster-monitoring/standalone/heapster-controller.yaml +++ b/cluster/addons/cluster-monitoring/standalone/heapster-controller.yaml @@ -1,12 +1,16 @@ {% set base_metrics_memory = "140Mi" -%} {% set metrics_memory = base_metrics_memory -%} {% set metrics_memory_per_node = 4 -%} +{% set base_metrics_cpu = "80m" -%} +{% set metrics_cpu = base_metrics_cpu -%} +{% set metrics_cpu_per_node = 0.5 -%} {% set num_nodes = pillar.get('num_nodes', -1) -%} {% set nanny_memory = "90Mi" -%} {% set nanny_memory_per_node = 200 -%} {% if num_nodes >= 0 -%} {% set metrics_memory = (200 + num_nodes * metrics_memory_per_node)|string + "Mi" -%} {% set nanny_memory = (90 * 1024 + num_nodes * nanny_memory_per_node)|string + "Ki" -%} + {% set metrics_cpu = (80 + num_nodes * metrics_cpu_per_node)|string + "m" -%} {% endif -%} apiVersion: extensions/v1beta1 @@ -36,10 +40,10 @@ spec: resources: # keep request = limit to keep this container in guaranteed class limits: - cpu: 100m + cpu: {{ metrics_cpu }} memory: {{ metrics_memory }} requests: - cpu: 100m + cpu: {{ metrics_cpu }} memory: {{ metrics_memory }} command: - /heapster @@ -64,8 +68,8 @@ spec: fieldPath: metadata.namespace command: - /pod_nanny - - --cpu=80m - - --extra-cpu=0.5m + - --cpu={{ base_metrics_cpu }} + - --extra-cpu={{ metrics_cpu_per_node }}m - --memory={{ base_metrics_memory }} - --extra-memory={{ metrics_memory_per_node }}Mi - --threshold=5 diff --git a/cluster/gce/gci/configure-helper.sh b/cluster/gce/gci/configure-helper.sh index 71999c0c81a4e..8cf853a7a05f8 100644 --- a/cluster/gce/gci/configure-helper.sh +++ b/cluster/gce/gci/configure-helper.sh @@ -725,9 +725,12 @@ function start-kube-addons { base_metrics_memory="140Mi" metrics_memory="${base_metrics_memory}" base_eventer_memory="190Mi" + base_metrics_cpu="80m" + metrics_cpu="${base_metrics_cpu}" eventer_memory="${base_eventer_memory}" nanny_memory="90Mi" local -r metrics_memory_per_node="4" + local -r metrics_cpu_per_node="0.5" local -r eventer_memory_per_node="500" local -r nanny_memory_per_node="200" if [[ -n "${NUM_NODES:-}" && "${NUM_NODES}" -ge 1 ]]; then @@ -735,6 +738,7 @@ function start-kube-addons { metrics_memory="$((${num_kube_nodes} * ${metrics_memory_per_node} + 200))Mi" eventer_memory="$((${num_kube_nodes} * ${eventer_memory_per_node} + 200 * 1024))Ki" nanny_memory="$((${num_kube_nodes} * ${nanny_memory_per_node} + 90 * 1024))Ki" + metrics_cpu=$(echo - | awk "{print ${num_kube_nodes} * ${metrics_cpu_per_node} + 80}")m fi controller_yaml="${dst_dir}/${file_dir}" if [[ "${ENABLE_CLUSTER_MONITORING:-}" == "googleinfluxdb" ]]; then @@ -745,11 +749,14 @@ function start-kube-addons { remove-salt-config-comments "${controller_yaml}" sed -i -e "s@{{ *base_metrics_memory *}}@${base_metrics_memory}@g" "${controller_yaml}" sed -i -e "s@{{ *metrics_memory *}}@${metrics_memory}@g" "${controller_yaml}" + sed -i -e "s@{{ *base_metrics_cpu *}}@${base_metrics_cpu}@g" "${controller_yaml}" + sed -i -e "s@{{ *metrics_cpu *}}@${metrics_cpu}@g" "${controller_yaml}" sed -i -e "s@{{ *base_eventer_memory *}}@${base_eventer_memory}@g" "${controller_yaml}" sed -i -e "s@{{ *eventer_memory *}}@${eventer_memory}@g" "${controller_yaml}" sed -i -e "s@{{ *metrics_memory_per_node *}}@${metrics_memory_per_node}@g" "${controller_yaml}" sed -i -e "s@{{ *eventer_memory_per_node *}}@${eventer_memory_per_node}@g" "${controller_yaml}" sed -i -e "s@{{ *nanny_memory *}}@${nanny_memory}@g" "${controller_yaml}" + sed -i -e "s@{{ *metrics_cpu_per_node *}}@${metrics_cpu_per_node}@g" "${controller_yaml}" fi if [[ "${ENABLE_CLUSTER_DNS:-}" == "true" ]]; then setup-addon-manifests "addons" "dns" diff --git a/cluster/gce/trusty/configure-helper.sh b/cluster/gce/trusty/configure-helper.sh index cb1123824429a..432fb26980962 100644 --- a/cluster/gce/trusty/configure-helper.sh +++ b/cluster/gce/trusty/configure-helper.sh @@ -717,9 +717,12 @@ start_kube_addons() { base_metrics_memory="140Mi" metrics_memory="${base_metrics_memory}" base_eventer_memory="190Mi" + base_metrics_cpu="80m" + metrics_cpu="${base_metrics_cpu}" eventer_memory="${base_eventer_memory}" nanny_memory="90Mi" readonly metrics_memory_per_node="4" + readonly metrics_cpu_per_node="0.5" readonly eventer_memory_per_node="500" readonly nanny_memory_per_node="200" if [ -n "${NUM_NODES:-}" ] && [ "${NUM_NODES}" -ge 1 ]; then @@ -727,6 +730,7 @@ start_kube_addons() { metrics_memory="$((${num_kube_nodes} * ${metrics_memory_per_node} + 200))Mi" eventer_memory="$((${num_kube_nodes} * ${eventer_memory_per_node} + 200 * 1024))Ki" nanny_memory="$((${num_kube_nodes} * ${nanny_memory_per_node} + 90 * 1024))Ki" + metrics_cpu=$(echo - | awk "{print ${num_kube_nodes} * ${metrics_cpu_per_node} + 80}")m fi controller_yaml="${addon_dst_dir}/${file_dir}" if [ "${ENABLE_CLUSTER_MONITORING:-}" = "googleinfluxdb" ]; then @@ -737,11 +741,14 @@ start_kube_addons() { remove_salt_config_comments "${controller_yaml}" sed -i -e "s@{{ *base_metrics_memory *}}@${base_metrics_memory}@g" "${controller_yaml}" sed -i -e "s@{{ *metrics_memory *}}@${metrics_memory}@g" "${controller_yaml}" + sed -i -e "s@{{ *base_metrics_cpu *}}@${base_metrics_cpu}@g" "${controller_yaml}" + sed -i -e "s@{{ *metrics_cpu *}}@${metrics_cpu}@g" "${controller_yaml}" sed -i -e "s@{{ *base_eventer_memory *}}@${base_eventer_memory}@g" "${controller_yaml}" sed -i -e "s@{{ *eventer_memory *}}@${eventer_memory}@g" "${controller_yaml}" sed -i -e "s@{{ *metrics_memory_per_node *}}@${metrics_memory_per_node}@g" "${controller_yaml}" sed -i -e "s@{{ *eventer_memory_per_node *}}@${eventer_memory_per_node}@g" "${controller_yaml}" sed -i -e "s@{{ *nanny_memory *}}@${nanny_memory}@g" "${controller_yaml}" + sed -i -e "s@{{ *metrics_cpu_per_node *}}@${metrics_cpu_per_node}@g" "${controller_yaml}" fi if [ "${ENABLE_L7_LOADBALANCING:-}" = "glbc" ]; then setup_addon_manifests "addons" "cluster-loadbalancing/glbc"