From f3fddaedd05931ac234565b1da22f3167e1253bb Mon Sep 17 00:00:00 2001 From: Karol Wychowaniec Date: Thu, 28 Sep 2017 16:01:27 +0200 Subject: [PATCH] Enable HorizontalPodAutoscalerUseRESTClients option --- cluster/gce/gci/configure-helper.sh | 4 ++++ .../app/options/options.go | 2 +- .../app/options/options_test.go | 19 ++++++++++--------- 3 files changed, 15 insertions(+), 10 deletions(-) diff --git a/cluster/gce/gci/configure-helper.sh b/cluster/gce/gci/configure-helper.sh index 2011dd6fee..0cc04fa473 100644 --- a/cluster/gce/gci/configure-helper.sh +++ b/cluster/gce/gci/configure-helper.sh @@ -1602,6 +1602,10 @@ function start-kube-controller-manager { if [[ -n "${CLUSTER_SIGNING_DURATION:-}" ]]; then params+=" --experimental-cluster-signing-duration=$CLUSTER_SIGNING_DURATION" fi + # disable using HPA metrics REST clients if metrics-server isn't enabled + if [[ "${ENABLE_METRICS_SERVER:-}" != "true" ]]; then + params+=" --horizontal-pod-autoscaler-use-rest-clients=false" + fi local -r kube_rc_docker_tag=$(cat /home/kubernetes/kube-docker-files/kube-controller-manager.docker_tag) local container_env="" diff --git a/cmd/kube-controller-manager/app/options/options.go b/cmd/kube-controller-manager/app/options/options.go index 12f6264dfb..dddfce2d97 100644 --- a/cmd/kube-controller-manager/app/options/options.go +++ b/cmd/kube-controller-manager/app/options/options.go @@ -115,7 +115,7 @@ func NewCMServer() *CMServer { ClusterSigningDuration: metav1.Duration{Duration: helpers.OneYear}, ReconcilerSyncLoopPeriod: metav1.Duration{Duration: 60 * time.Second}, EnableTaintManager: true, - HorizontalPodAutoscalerUseRESTClients: false, + HorizontalPodAutoscalerUseRESTClients: true, }, } s.LeaderElection.LeaderElect = true diff --git a/cmd/kube-controller-manager/app/options/options_test.go b/cmd/kube-controller-manager/app/options/options_test.go index ce5beff0ef..78addd5c86 100644 --- a/cmd/kube-controller-manager/app/options/options_test.go +++ b/cmd/kube-controller-manager/app/options/options_test.go @@ -192,15 +192,16 @@ func TestAddFlags(t *testing.T) { {Group: "apiregistration.k8s.io", Resource: "apiservices"}, {Group: "apiextensions.k8s.io", Resource: "customresourcedefinitions"}, }, - NodeEvictionRate: 0.2, - SecondaryNodeEvictionRate: 0.05, - LargeClusterSizeThreshold: 100, - UnhealthyZoneThreshold: 0.6, - DisableAttachDetachReconcilerSync: true, - ReconcilerSyncLoopPeriod: metav1.Duration{Duration: 30 * time.Second}, - Controllers: []string{"foo", "bar"}, - EnableTaintManager: false, - UseServiceAccountCredentials: true, + NodeEvictionRate: 0.2, + SecondaryNodeEvictionRate: 0.05, + LargeClusterSizeThreshold: 100, + UnhealthyZoneThreshold: 0.6, + DisableAttachDetachReconcilerSync: true, + ReconcilerSyncLoopPeriod: metav1.Duration{Duration: 30 * time.Second}, + Controllers: []string{"foo", "bar"}, + EnableTaintManager: false, + HorizontalPodAutoscalerUseRESTClients: true, + UseServiceAccountCredentials: true, }, Kubeconfig: "/kubeconfig", Master: "192.168.4.20",