Merge pull request #41824 from DirectXMan12/feature/hpa-v2-use-cm-api

Automatic merge from submit-queue

HPA Controller: Use Custom Metrics API

This commit switches over the HPA controller to use the custom metrics
API.  It also converts the HPA controller to use the generated client
in k8s.io/metrics for the resource metrics API.

In order to enable support, you must enable
`--horizontal-pod-autoscaler-use-rest-clients` on the
controller-manager, which will switch the HPA controller's MetricsClient
implementation over to use the standard rest clients for both custom
metrics and resource metrics.  This requires that at the least resource
metrics API is registered with kube-aggregator, and that the controller
manager is pointed at kube-aggregator.  For this to work, Heapster
must be serving the new-style API server (`--api-server=true`).

Before this merges, this will need kubernetes/metrics#2 to merge, and a godeps update to pull that in.
It's also semi-dependent on kubernetes/heapster#1537, but that is not required in order for this to merge.

**Release note**:
```release-note
Allow the Horizontal Pod Autoscaler controller to talk to the metrics API and custom metrics API as standard APIs.
```
This commit is contained in:
Kubernetes Submit Queue
2017-03-01 12:56:58 -08:00
committed by GitHub
67 changed files with 13124 additions and 206 deletions

28
hack/godep-restore.sh Executable file
View File

@@ -0,0 +1,28 @@
#!/bin/bash
# Copyright 2017 The Kubernetes Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
set -o errexit
set -o nounset
set -o pipefail
KUBE_ROOT=$(dirname "${BASH_SOURCE}")/..
source "${KUBE_ROOT}/hack/lib/init.sh"
export GOPATH=${GOPATH}:${KUBE_ROOT}/staging
GODEP="${GODEP:-godep}"
echo "Starting to download all kubernetes godeps. This takes a while"
"${GODEP}" restore "$@"
echo "Download finished"

View File

@@ -39,7 +39,7 @@ cd /go/src/k8s.io/kubernetes
# hack/verify-client-go.sh requires all dependencies exist in the GOPATH.
# the retry helps avoid flakes while keeping total time bounded.
godep restore || godep restore
./hack/godep-restore.sh || ./hack/godep-restore.sh
./hack/install-etcd.sh
make verify

View File

@@ -691,3 +691,4 @@ www-prefix
zone-id
zone-name
horizontal-pod-autoscaler-use-rest-clients

View File

@@ -99,6 +99,7 @@ pushd "${_kubetmp}" 2>&1 > /dev/null
pin-godep 'v74'
"${GODEP}" version
export GOPATH="${GOPATH}:${_kubetmp}/staging"
# Fill out that nice clean place with the kube godeps
echo "Starting to download all kubernetes godeps. This takes a while"
"${GODEP}" restore