Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support to increase number of sole tenant nodes in node group #4275

Comments

@tamilvs
Copy link

tamilvs commented Aug 16, 2019

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or "me too" comments, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment. If the issue is assigned to the "modular-magician" user, it is either in the process of being autogenerated, or is planned to be autogenerated soon. If the issue is assigned to a user, that user is claiming responsibility for the issue. If the issue is assigned to "hashibot", a community member has claimed the issue already.

Description

Currently increasing number of sole tenant nodes in the node group is not supported. and can see a warning message on the resource page stating that "Due to limitations of the API, Terraform cannot update the number of nodes in a node group and changes to node group size either through Terraform config or through external changes will cause Terraform to delete and recreate the node group" but I could see addNodes api in GCP doc, please find the reference link and enhance the node group rosource

https://cloud.google.com/compute/docs/reference/rest/v1/nodeGroups/addNodes

New or Affected Resource(s)

  • google_compute_node_group

Potential Terraform Configuration

# Propose what you think the configuration to take advantage of this feature should look like.
# We may not use it verbatim, but it's helpful in understanding your intent.

References

  • b/185382242
@ghost ghost added the enhancement label Aug 16, 2019
@tamilvs
Copy link
Author

tamilvs commented Aug 20, 2019

No one owning this issue :(

@slevenick
Copy link
Collaborator

Thanks for the request. We have looked at adding support for this, but it is quite a difficult task in terraform due to the one-way direction of adding a node. We are exploring ways to support this functionality, so I'll leave this issue open.

@rileykarson
Copy link
Collaborator

This was brought up to cover autoscaling policies as well internally, which we don't super support without using lifecycle.ignore_changes on the size field. I think we can support the entire scaling use case better in a way that's backwards compatible:

  • Introduce an initial_node_count or initial_size field that is mutually exclusive with size, specifically marking them as AtLeastOneOf with each other. Whichever is specified is used on create as the initialNodeCount query parameter
    • We will never detect drift on this field, and changing it locally will recreate the resource.
  • Mark the size field as Optional + Computed, use CustomizeDiff to support updates only in the additive case
    • note: if a field is O+C and not present in user config, there will not be a diff on the field and the value in state will be the value stored on Read

Note that users are already able to specify size and autoscaling_policy together, and we have no reason to break them- it'll be a tiny bit of a footgun, but not worth a backwards incompatibility. Users could then use the following configurations, all of which are valid:

# works today
resource "google_compute_node_group" "nodes" {
  name          = "soletenant-group"
  node_template = google_compute_node_template.soletenant-tmpl.id

  size = 1
}
resource "google_compute_node_group" "nodes" {
  name          = "soletenant-group"
  node_template = google_compute_node_template.soletenant-tmpl.id

  initial_size  = 1
}
# works today
resource "google_compute_node_group" "nodes" {
  name          = "soletenant-group"
  node_template = google_compute_node_template.soletenant-tmpl.id

  size = 1
  autoscaling_policy {
    mode      = "ON"
    min_nodes = 1
    max_nodes = 10
  }

  lifecycle {
    ignore_changes = ["size"]
  }
}
resource "google_compute_node_group" "nodes" {
  name          = "soletenant-group"
  node_template = google_compute_node_template.soletenant-tmpl.id

  initial_size = 1
  autoscaling_policy {
    mode      = "ON"
    min_nodes = 1
    max_nodes = 10
  }
}

It's possible that this will be difficult/impossible to implement with our current code generator, in which case we can defer fixing it. I believe it'll be possible (specifically, I think we can d.Get the size value in the initial_size expander if d.Get initial_size is 0)

@github-actions
Copy link

github-actions bot commented Jun 5, 2021

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.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jun 5, 2021
@github-actions github-actions bot added forward/review In review; remove label to forward service/compute-sole-tenancy labels Jan 14, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.