From efe3d76d25b5ef499eb0bb6c1599611bb63d03ce Mon Sep 17 00:00:00 2001 From: Song Gao Date: Wed, 8 Jul 2020 19:28:03 +0800 Subject: [PATCH] fix status --- pkg/autoscaler/autoscaler/tikv_autoscaler.go | 2 +- pkg/autoscaler/autoscaler/util.go | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/pkg/autoscaler/autoscaler/tikv_autoscaler.go b/pkg/autoscaler/autoscaler/tikv_autoscaler.go index c5b65e063cf..95989499e5a 100644 --- a/pkg/autoscaler/autoscaler/tikv_autoscaler.go +++ b/pkg/autoscaler/autoscaler/tikv_autoscaler.go @@ -122,6 +122,7 @@ func calculateTiKVStorageMetrics(tac *v1alpha1.TidbClusterAutoScaler, tc *v1alph return err } if !ableToScale { + klog.Infof("tac[%s/%s]'s tikv won't scale out by storage pressure due to scale-out cool-down interval", tac.Namespace, tac.Name) return nil } storagePressure, err := calculate.CalculateWhetherStoragePressure(tac, capSq, avaSq, client, metric) @@ -140,7 +141,6 @@ func calculateTiKVStorageMetrics(tac *v1alpha1.TidbClusterAutoScaler, tc *v1alph } currentReplicas := tc.Spec.TiKV.Replicas targetReplicas := currentReplicas + 1 - emptyStoragePressureStatus(tac) return updateTacIfTiKVScale(tc, tac, targetReplicas) } diff --git a/pkg/autoscaler/autoscaler/util.go b/pkg/autoscaler/autoscaler/util.go index c9886b029ef..b33013c3a6d 100644 --- a/pkg/autoscaler/autoscaler/util.go +++ b/pkg/autoscaler/autoscaler/util.go @@ -172,11 +172,14 @@ func genMetricsEndpoint(tac *v1alpha1.TidbClusterAutoScaler) (string, error) { return fmt.Sprintf("http://%s-prometheus.%s.svc:9090", tac.Spec.Monitor.Name, tac.Spec.Monitor.Namespace), nil } -func emptyStoragePressureStatus(tac *v1alpha1.TidbClusterAutoScaler) { +func emptyStorageMetricsStatus(tac *v1alpha1.TidbClusterAutoScaler) { for id, m := range tac.Status.TiKV.MetricsStatusList { if m.Name == string(corev1.ResourceStorage) { m.StoragePressure = nil m.StoragePressureStartTime = nil + m.CapacityStorage = nil + m.AvailableStorage = nil + m.BaselineAvailableStorage = nil tac.Status.TiKV.MetricsStatusList[id] = m return }