mercari / tortoise

Tortoise: Shell-Shockingly-Good Kubernetes Autoscaling
MIT License
400 stars 15 forks source link

stop depending on tortoise name annotation #359

Closed sanposhiho closed 7 months ago

sanposhiho commented 7 months ago

What this PR does / why we need it:

Before this PR, we gave the annotation tortoise-name and used them in the Pod/HPA mutating webhook. But, it could make a problem in this kind of scenario:

  1. HPA is managed by Tortoise, which means it has tortoise annotation.
  2. HPA is updated by a user. Tortoise name annotation is given at a tortoise reconciliation, this update may remove tortoise name annotation. The annotation will be restored at a next reconciliation.
  3. At (2), Tortoise's HPA mutating webhook cannot notice a updated HPA is managed by Tortoise.

This PR stops depending on tortoise name annotation. Instead, we find an appropriate tortoise by checking all tortoises in the same namespace as HPA/Pod.

Which issue(s) this PR fixes:

Fixes #

Special notes for your reviewer: