Skip to content

Commit

Permalink
fix(kubernetes/v1): set currentCpuUtilization from currentMetrics (#3912
Browse files Browse the repository at this point in the history
) (#3914)

* fix(kubernetes/v1): remove currentCPUUtilization, does not exist in fabric8:4.1.1

* fix(kubernetes/v1): remove currentCPUUtilizationPercentage

* fix(kubernetes/v1): set currentCpuUtilization from currentMetrics
  • Loading branch information
spinnakerbot authored and maggieneterval committed Aug 3, 2019
1 parent e44f8ed commit ad9b3f3
Showing 1 changed file with 1 addition and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ import groovy.util.logging.Slf4j

@Slf4j
class KubernetesAutoscalerStatus {
Integer currentCpuUtilization
Integer currentReplicas
Integer desiredReplicas
Long lastScaleTime
Expand All @@ -33,7 +32,7 @@ class KubernetesAutoscalerStatus {
if (autoscaler.status == null) {
log.warn("Autoscaler on ${autoscaler.metadata.name} has a null status. The replicaset may be missing a CPU request.")
} else {
this.currentCpuUtilization = autoscaler.status.currentCPUUtilizationPercentage
this.currentCpuUtilization = autoscaler.status.currentMetrics?.find { metric -> metric.resource.name == "cpu" }?.resource?.currentAverageUtilization
this.currentReplicas = autoscaler.status.currentReplicas
this.desiredReplicas = autoscaler.status.desiredReplicas
this.lastScaleTime = KubernetesModelUtil.translateTime(autoscaler.status.lastScaleTime)
Expand Down

0 comments on commit ad9b3f3

Please sign in to comment.