Terraform: [GKE] Support autoscaling

Created on 1 Sep 2016  ยท  24Comments  ยท  Source: hashicorp/terraform

hey all,

Google cloud supports autoscaling for nodes which is very useful in high traffic kubernetes deployments. Could you add this feature to terraform? Currently i use local exec like this:

  # enable autoscaling
  provisioner "local-exec" {
      command = "gcloud container clusters update ${var.google_container_cluster.name} --enable-autoscaling --min-nodes=${var.min_nodes} --max-nodes=${var.max_nodes} --project='${var.project_name}'"
  }

Documentation is here
https://cloud.google.com/container-engine/docs/clusters/operations

enhancement providegoogle-cloud

Most helpful comment

@roberthbailey @cblecker I'm working with the Go team to get the autogen library updated. When that's done, I'll revendor and add NodePool support.

All 24 comments

Hey @stack72 --
I think this should be provider/google instead of provider/aws :)

@evandbrown @roberthbailey --
It appears that google.golang.org/api/container/v1 has fallen behind the public documentation (similar to how it did in https://github.com/google/google-api-go-client/issues/127). The API documentation (https://cloud.google.com/container-engine/reference/rest/v1/projects.zones.clusters.nodePools) indicates there is an autoscaling field, however https://www.googleapis.com/discovery/v1/apis/container/v1/rest doesn't specify that this field exists.

I'm guessing that if https://www.googleapis.com/discovery/v1/apis/container/v1/rest is updated, that the auto-generated google.golang.org/api/container/v1 will update, and then can be re-vendored into Terraform.

Is there a place to open an issue to get the API discovery point updated?

https://container.googleapis.com/$discovery/rest?version=v1 shows the autoscaling field. And that link is referenced from https://cloud.google.com/container-engine/reference/rest/ as the discovery URL for the API. What led you to the googleapis.com URL?

@cblecker I'm mobile at the moment but agree this is likely due to an old version of the vendored package. I'll get that updated tomorrow and add the necessary field to the cluster resource.

@roberthbailey: That Github issue I linked to from earlier this year pointed me at that URL: https://github.com/google/google-api-go-client/issues/127 .

It also appears that https://github.com/google/google-api-go-client/blob/master/api-list.json#L1334 in the google-api-go-client package points to that discovery URL. Perhaps that means it could be as simple as updating the discovery URL in the google-api-go-client?

@evandbrown: I had checked for an outdated vendor first, but the vendored version inside Terraform is the latest available at google.golang.org/api/container/v1.

@roberthbailey @cblecker I'm working with the Go team to get the autogen library updated. When that's done, I'll revendor and add NodePool support.

Hey @evandbrown --
Any update on this? Seems the go client library was updated, but the container API is still pointing to the outdated discovery link.

@thecodeassassin @cblecker I'm working on this today. Current plan it to implement this as support for the NodePool resource. Sound OK?

@evandbrown Yay! That makes total sense to me.

Did the endpoint get updated? I still don't see it exposed at https://www.googleapis.com/discovery/v1/apis/container/v1/rest, and the google-api-go-client still seems ot point to https://container.googleapis.com/%24discovery/rest?version=v1

@cblecker Agh, I saw the client libs were regenerated 21 days ago and assumed they reflected the new types. That's not the case. I've pinged the team and will keep this thread updated. At any rate, when it's available we'll expect to implement as a NodePools field in the manifest which will have some nice features in addition to autoscaling.

Thanks for continuing to track this down, @evandbrown!

@evandbrown Sounds good to me :) Thanks!

Hey @evandbrown --
I actually came across another situation where this feature would be useful. I don't know if the teams have made any progress, but wondering if there is an update.

Thanks again!

@roberthbailey, any ETA on the discovery doc update?

@cblecker once that doc is updated, I'll do my best to get the client lib updated, and will push the change as soon as that's done :)

I think the change is in progress, but I'm not sure how long it'll take before it goes live.

@evandbrown @roberthbailey any update on this? :)

@fabioy might have an eta

@evandbrown @roberthbailey @fabioy --
Any update on this?
Where we are at from what I can see:
The google-api-go-client is currently using https://www.googleapis.com/discovery/v1/apis/container/v1/rest as it's discovery API. The last time this was updated and regenerated into the google-api-go-client library was on May 1, 2016, over 260 days ago.

There is also the https://container.googleapis.com/$discovery/rest?version=v1 endpoint that seems to be more up to date, but those updates aren't making it into https://www.googleapis.com/discovery/v1/apis/container/v1/rest.

I'm not sure what it will take to get these discovery endpoints updated, but it's really stalling out writing tools (terraform or otherwise) for GKE when the go api library is over 9 months out of date.

@cblecker -- I've just updated the discovery doc to include the recent changes in the GKE API. The google-api-go-client should be updated soon.

All right, the go client has been updated. @cblecker were you planning on doing the dev work for this? I have it as a high priority goal of mine this quarter but if you're planning on doing it I certainly don't mind.

@danawillow I was gonna take a stab at it this weekend. If I've got a WIP, mind if I ping you next week for review? If I'm not able to carve out the time, then I have no problem handing it over :)

Works for me!

@danawillow Sorry, some stuff has come up and I haven't had a chance to get to this. If it's urgent for you, please feel free to take it over.

I'm going to lock this issue because it has been closed for _30 days_ โณ. This helps our maintainers find and focus on the active issues.

If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

Was this page helpful?
0 / 5 - 0 ratings