Merge pull request #20703 from mwielgus/hpa-cm-validation

Auto commit by PR queue bot
This commit is contained in:
k8s-merge-robot
2016-02-06 21:16:51 -08:00
4 changed files with 134 additions and 4 deletions

View File

@@ -39,8 +39,8 @@ const (
// TODO: make it a flag or HPA spec element.
tolerance = 0.1
HpaCustomMetricsDefinitionAnnotationName = "alpha/definiton.custom-metrics.podautoscaler.kubernetes.io"
HpaCustomMetricsStatusAnnotationName = "alpha/status.custom-metrics.podautoscaler.kubernetes.io"
HpaCustomMetricsTargetAnnotationName = "alpha/target.custom-metrics.podautoscaler.kubernetes.io"
HpaCustomMetricsStatusAnnotationName = "alpha/status.custom-metrics.podautoscaler.kubernetes.io"
)
type HorizontalController struct {
@@ -190,7 +190,7 @@ func (a *HorizontalController) reconcileAutoscaler(hpa extensions.HorizontalPodA
}
}
if cmAnnotation, cmAnnotationFound := hpa.Annotations[HpaCustomMetricsDefinitionAnnotationName]; cmAnnotationFound {
if cmAnnotation, cmAnnotationFound := hpa.Annotations[HpaCustomMetricsTargetAnnotationName]; cmAnnotationFound {
cmDesiredReplicas, cmStatus, cmTimestamp, err = a.computeReplicasForCustomMetrics(hpa, scale, cmAnnotation)
if err != nil {
a.eventRecorder.Event(&hpa, api.EventTypeWarning, "FailedComputeCMReplicas", err.Error())

View File

@@ -110,7 +110,7 @@ func (tc *testCase) prepareTestClient(t *testing.T) *fake.Clientset {
t.Fatalf("Failed to marshal cm: %v", err)
}
obj.Items[0].Annotations = make(map[string]string)
obj.Items[0].Annotations[HpaCustomMetricsDefinitionAnnotationName] = string(b)
obj.Items[0].Annotations[HpaCustomMetricsTargetAnnotationName] = string(b)
}
return true, obj, nil
})