mercari / tortoise

Tortoise: Shell-Shockingly-Good Kubernetes Autoscaling
MIT License
316 stars 14 forks source link

Tortoise-created HPA has "Unknown" target value #407

Closed e-volusian closed 2 weeks ago

e-volusian commented 2 weeks ago

Any HPA created by a Tortoise seems to have this:

$ k get hpa
NAME                            REFERENCE                   TARGETS         MINPODS   MAXPODS   REPLICAS   AGE
tortoise-hpa-default-tortoise   Deployment/load-generator   <unknown>/70%   3         100       0          12s

and this from kubectl describe tortoise:

  Type     Reason          Age   From                       Message
  ----     ------          ----  ----                       -------
  Warning  FailedGetScale  13s   horizontal-pod-autoscaler  no matches for kind "Deployment" in group ""

It appears to get resolved by adding apiVersion to spec.scaleTargetRef

spec:
  scaleTargetRef:
    apiVersion: apps/v1

I noticed this because the Tortoise seemed perpetually stuck in GatheringData status. I am hoping after making this change that the Tortoise will graduate to Working.

sanposhiho commented 2 weeks ago

Do you specify apiVersions in your tortoise? HPA created by Tortoise populates apiVersions from it. https://github.com/mercari/tortoise/blob/main/pkg/hpa/service.go#L261

e-volusian commented 2 weeks ago

Thank you for the response. I did not do that. I used the sample configurations as a template. Will try with APIVersion.