Skip to content

Commit

Permalink
Make scale_target_ref api_version match deployment
Browse files Browse the repository at this point in the history
In an attempt to fix the following error when creating the horizontal
pod autoscaler:

the HPA controller was unable to get the target's current scale: no
matches for kind "Deployment" in group ""

From what I can tell, this is caused when the referent (in this case the
deployment) version is different to what the autoscaler expects.

https://www.terraform.io/docs/providers/kubernetes/r/horizontal_pod_autoscaler.html#arguments-10
  • Loading branch information
dylannz-sailthru committed Jun 11, 2020
1 parent 94ddfae commit 7466d99
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions horizontal_pod_autoscaler.tf
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,9 @@ resource "kubernetes_horizontal_pod_autoscaler" "ambassador" {
target_cpu_utilization_percentage = var.autoscaling_target_cpu_utilization_percentage

scale_target_ref {
kind = "Deployment"
name = var.name
api_version = "extensions/v1beta1"
kind = "Deployment"
name = var.name
}
}

Expand Down

0 comments on commit 7466d99

Please sign in to comment.