Skip to content

Commit

Permalink
fix status
Browse files Browse the repository at this point in the history
  • Loading branch information
Yisaer committed Jul 8, 2020
1 parent 52f72af commit efe3d76
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion pkg/autoscaler/autoscaler/tikv_autoscaler.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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)
}

Expand Down
5 changes: 4 additions & 1 deletion pkg/autoscaler/autoscaler/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down

0 comments on commit efe3d76

Please sign in to comment.