hashicorp / terraform-cloud-operator

Kubernetes Operator allows managing HCP Terraform resources via Kubernetes Custom Resources.
https://developer.hashicorp.com/terraform/cloud-docs
Mozilla Public License 2.0
114 stars 27 forks source link

πŸ› fix: autoscaling doesn't respect queued items #436

Open akozhuharov opened 6 days ago

akozhuharov commented 6 days ago

Description

We encountered a bug where the autoscaling agentpool controller doesn't take into account generally queued items in TFC and hence the replicas stay at the minimum number set in the agent pool. Steps to reproduce:

  1. Create an agent pool with autoscaling set to minimum 1
  2. Trigger runs on several workspaces

Usage Example

I have attached a script using parts of the code in the controller which can highlight the difference(line 32 can be added/removed). main.go.zip

References

Community Note

hashicorp-cla-app[bot] commented 6 days ago

CLA assistant check
All committers have signed the CLA.

arybolovlev commented 23 hours ago

Hi @akozhuharov,

I was not able to reproduce this behavior. With no registered agents, runs transition to the plan_queued state.

Are there any other conditions for a run stuck in the queuing state?

Thanks.