weave-gitops
weave-gitops copied to clipboard
Wrong status message displayed for HorizontalPodAutoscaler
Describe the bug
I have an HorizontalPodAutoscaler that has the following .spec.status:
status:
conditions:
- lastTransitionTime: "2023-03-01T16:49:53Z"
message: the HPA controller was able to get the target's current scale
reason: SucceededGetScale
status: "True"
type: AbleToScale
- lastTransitionTime: "2023-03-01T16:50:08Z"
message: 'the HPA was unable to compute the replica count: failed to get cpu utilization:
unable to get metrics for resource cpu: unable to fetch metrics from resource
metrics API: the server could not find the requested resource (get pods.metrics.k8s.io)'
reason: FailedGetResourceMetric
status: "False"
type: Scaling
The UI correctly shows that it's not ready but renders the wrong message:

The message that should be shows instead is the one causing the resource to be shown as not ready, i.e. "the HPA was unable to compute the replica count...".
@JamWils fyi
On top of this, even when the HPA status is good, weave-gitops shows not ready.
We got the following status:
status:
conditions:
- lastTransitionTime: "2023-09-09T18:33:56Z"
message: recent recommendations were higher than current one, applying the highest
recent recommendation
reason: ScaleDownStabilized
status: "True"
type: AbleToScale
- lastTransitionTime: "2023-10-05T09:14:23Z"
message: the HPA was able to successfully calculate a replica count from cpu resource
utilization (percentage of request)
reason: ValidMetricFound
status: "True"
type: ScalingActive
- lastTransitionTime: "2023-10-05T09:14:38Z"
message: the desired count is within the acceptable range
reason: DesiredWithinRange
status: "False"
type: ScalingLimited
This means that everything is right and working well but the UI shows Not Ready