Crane is a FinOps Platform for Cloud Resource Analytics and Economics in Kubernetes clusters. The goal is not only to help users to manage cloud cost easier but also ensure the quality of applications.
Specific code: https://github.com/gocrane/crane/blob/main/pkg/controller/ehpa/hpa.go#L165
The operator wants to update HPA A1, if the update conflicts, it will directly obtain the latest HPA object A2 from the cluster, and then use A2 to re-initiate the update. And this A2 is not the content A1 that is expected to be updated. At the same time, if A2 update is successful, the exception of update failure will also be lost, resulting in A1 not being updated, but operator thinks that HPA A1 has been updated
Describe the bug In the new feature (improvement hpa and substitute), if the update of hpa fails due to concurrency conflicts, the update content will be lost. https://github.com/gocrane/crane/commit/e977b5e0918c1b535df85a75476ef9da589e1a4f
Specific code: https://github.com/gocrane/crane/blob/main/pkg/controller/ehpa/hpa.go#L165 The operator wants to update HPA A1, if the update conflicts, it will directly obtain the latest HPA object A2 from the cluster, and then use A2 to re-initiate the update. And this A2 is not the content A1 that is expected to be updated. At the same time, if A2 update is successful, the exception of update failure will also be lost, resulting in A1 not being updated, but operator thinks that HPA A1 has been updated
Reproduce steps
Expected behavior
Screenshots
Environment (please complete the following information):