Skip to content

Commit

Permalink
feat: expose timeouts
Browse files Browse the repository at this point in the history
  • Loading branch information
bharathkkb authored Jun 1, 2022
1 parent 4bba52f commit 6011c80
Show file tree
Hide file tree
Showing 29 changed files with 163 additions and 54 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,7 @@ Then perform the following commands on the root folder:
| skip\_provisioners | Flag to skip all local-exec provisioners. It breaks `stub_domains` and `upstream_nameservers` variables functionality. | `bool` | `false` | no |
| stub\_domains | Map of stub domains and their resolvers to forward DNS queries for a certain domain to an external DNS server | `map(list(string))` | `{}` | no |
| subnetwork | The subnetwork to host the cluster in (required) | `string` | n/a | yes |
| timeouts | Timeout for cluster operations. | `map(string)` | `{}` | no |
| upstream\_nameservers | If specified, the values replace the nameservers taken by default from the node’s /etc/resolv.conf | `list(string)` | `[]` | no |
| zones | The zones to host the cluster in (optional if regional cluster / required if zonal) | `list(string)` | `[]` | no |

Expand Down
12 changes: 6 additions & 6 deletions autogen/main/cluster.tf.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -276,9 +276,9 @@ resource "google_container_cluster" "primary" {
{% endif %}

timeouts {
create = "45m"
update = "45m"
delete = "45m"
create = lookup(var.timeouts, "create", "45m")
update = lookup(var.timeouts, "update", "45m")
delete = lookup(var.timeouts, "delete", "45m")
}
{% if autopilot_cluster != true %}
node_pool {
Expand Down Expand Up @@ -718,9 +718,9 @@ resource "google_container_node_pool" "pools" {
}

timeouts {
create = "45m"
update = "45m"
delete = "45m"
create = lookup(var.timeouts, "create", "45m")
update = lookup(var.timeouts, "update", "45m")
delete = lookup(var.timeouts, "delete", "45m")
}
}
{% endif %}
10 changes: 10 additions & 0 deletions autogen/main/variables.tf.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -573,6 +573,16 @@ variable "node_metadata" {
}
}
{% endif %}

variable "timeouts" {
type = map(string)
description = "Timeout for cluster operations."
default = {}
validation {
condition = !contains([for t in keys(var.timeouts): contains(["create", "update", "delete"],t)], false)
error_message = "Only create, update, delete timeouts can be specified."
}
}
{% if beta_cluster and autopilot_cluster != true %}

variable "enable_kubernetes_alpha" {
Expand Down
12 changes: 6 additions & 6 deletions cluster.tf
Original file line number Diff line number Diff line change
Expand Up @@ -155,9 +155,9 @@ resource "google_container_cluster" "primary" {
}

timeouts {
create = "45m"
update = "45m"
delete = "45m"
create = lookup(var.timeouts, "create", "45m")
update = lookup(var.timeouts, "update", "45m")
delete = lookup(var.timeouts, "delete", "45m")
}
node_pool {
name = "default-pool"
Expand Down Expand Up @@ -383,8 +383,8 @@ resource "google_container_node_pool" "pools" {
}

timeouts {
create = "45m"
update = "45m"
delete = "45m"
create = lookup(var.timeouts, "create", "45m")
update = lookup(var.timeouts, "update", "45m")
delete = lookup(var.timeouts, "delete", "45m")
}
}
1 change: 1 addition & 0 deletions modules/beta-autopilot-private-cluster/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ Then perform the following commands on the root folder:
| skip\_provisioners | Flag to skip all local-exec provisioners. It breaks `stub_domains` and `upstream_nameservers` variables functionality. | `bool` | `false` | no |
| stub\_domains | Map of stub domains and their resolvers to forward DNS queries for a certain domain to an external DNS server | `map(list(string))` | `{}` | no |
| subnetwork | The subnetwork to host the cluster in (required) | `string` | n/a | yes |
| timeouts | Timeout for cluster operations. | `map(string)` | `{}` | no |
| upstream\_nameservers | If specified, the values replace the nameservers taken by default from the node’s /etc/resolv.conf | `list(string)` | `[]` | no |
| zones | The zones to host the cluster in (optional if regional cluster / required if zonal) | `list(string)` | `[]` | no |

Expand Down
6 changes: 3 additions & 3 deletions modules/beta-autopilot-private-cluster/cluster.tf
Original file line number Diff line number Diff line change
Expand Up @@ -126,9 +126,9 @@ resource "google_container_cluster" "primary" {


timeouts {
create = "45m"
update = "45m"
delete = "45m"
create = lookup(var.timeouts, "create", "45m")
update = lookup(var.timeouts, "update", "45m")
delete = lookup(var.timeouts, "delete", "45m")
}

dynamic "resource_usage_export_config" {
Expand Down
10 changes: 10 additions & 0 deletions modules/beta-autopilot-private-cluster/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -382,3 +382,13 @@ variable "database_encryption" {
}]
}


variable "timeouts" {
type = map(string)
description = "Timeout for cluster operations."
default = {}
validation {
condition = !contains([for t in keys(var.timeouts) : contains(["create", "update", "delete"], t)], false)
error_message = "Only create, update, delete timeouts can be specified."
}
}
1 change: 1 addition & 0 deletions modules/beta-autopilot-public-cluster/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ Then perform the following commands on the root folder:
| skip\_provisioners | Flag to skip all local-exec provisioners. It breaks `stub_domains` and `upstream_nameservers` variables functionality. | `bool` | `false` | no |
| stub\_domains | Map of stub domains and their resolvers to forward DNS queries for a certain domain to an external DNS server | `map(list(string))` | `{}` | no |
| subnetwork | The subnetwork to host the cluster in (required) | `string` | n/a | yes |
| timeouts | Timeout for cluster operations. | `map(string)` | `{}` | no |
| upstream\_nameservers | If specified, the values replace the nameservers taken by default from the node’s /etc/resolv.conf | `list(string)` | `[]` | no |
| zones | The zones to host the cluster in (optional if regional cluster / required if zonal) | `list(string)` | `[]` | no |

Expand Down
6 changes: 3 additions & 3 deletions modules/beta-autopilot-public-cluster/cluster.tf
Original file line number Diff line number Diff line change
Expand Up @@ -126,9 +126,9 @@ resource "google_container_cluster" "primary" {


timeouts {
create = "45m"
update = "45m"
delete = "45m"
create = lookup(var.timeouts, "create", "45m")
update = lookup(var.timeouts, "update", "45m")
delete = lookup(var.timeouts, "delete", "45m")
}

dynamic "resource_usage_export_config" {
Expand Down
10 changes: 10 additions & 0 deletions modules/beta-autopilot-public-cluster/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -351,3 +351,13 @@ variable "database_encryption" {
}]
}


variable "timeouts" {
type = map(string)
description = "Timeout for cluster operations."
default = {}
validation {
condition = !contains([for t in keys(var.timeouts) : contains(["create", "update", "delete"], t)], false)
error_message = "Only create, update, delete timeouts can be specified."
}
}
1 change: 1 addition & 0 deletions modules/beta-private-cluster-update-variant/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,7 @@ Then perform the following commands on the root folder:
| skip\_provisioners | Flag to skip all local-exec provisioners. It breaks `stub_domains` and `upstream_nameservers` variables functionality. | `bool` | `false` | no |
| stub\_domains | Map of stub domains and their resolvers to forward DNS queries for a certain domain to an external DNS server | `map(list(string))` | `{}` | no |
| subnetwork | The subnetwork to host the cluster in (required) | `string` | n/a | yes |
| timeouts | Timeout for cluster operations. | `map(string)` | `{}` | no |
| upstream\_nameservers | If specified, the values replace the nameservers taken by default from the node’s /etc/resolv.conf | `list(string)` | `[]` | no |
| zones | The zones to host the cluster in (optional if regional cluster / required if zonal) | `list(string)` | `[]` | no |

Expand Down
12 changes: 6 additions & 6 deletions modules/beta-private-cluster-update-variant/cluster.tf
Original file line number Diff line number Diff line change
Expand Up @@ -240,9 +240,9 @@ resource "google_container_cluster" "primary" {
}

timeouts {
create = "45m"
update = "45m"
delete = "45m"
create = lookup(var.timeouts, "create", "45m")
update = lookup(var.timeouts, "update", "45m")
delete = lookup(var.timeouts, "delete", "45m")
}
node_pool {
name = "default-pool"
Expand Down Expand Up @@ -641,8 +641,8 @@ resource "google_container_node_pool" "pools" {
}

timeouts {
create = "45m"
update = "45m"
delete = "45m"
create = lookup(var.timeouts, "create", "45m")
update = lookup(var.timeouts, "update", "45m")
delete = lookup(var.timeouts, "delete", "45m")
}
}
10 changes: 10 additions & 0 deletions modules/beta-private-cluster-update-variant/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -544,6 +544,16 @@ variable "node_metadata" {
}
}

variable "timeouts" {
type = map(string)
description = "Timeout for cluster operations."
default = {}
validation {
condition = !contains([for t in keys(var.timeouts) : contains(["create", "update", "delete"], t)], false)
error_message = "Only create, update, delete timeouts can be specified."
}
}

variable "enable_kubernetes_alpha" {
type = bool
description = "Whether to enable Kubernetes Alpha features for this cluster. Note that when this option is enabled, the cluster cannot be upgraded and will be automatically deleted after 30 days."
Expand Down
1 change: 1 addition & 0 deletions modules/beta-private-cluster/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,7 @@ Then perform the following commands on the root folder:
| skip\_provisioners | Flag to skip all local-exec provisioners. It breaks `stub_domains` and `upstream_nameservers` variables functionality. | `bool` | `false` | no |
| stub\_domains | Map of stub domains and their resolvers to forward DNS queries for a certain domain to an external DNS server | `map(list(string))` | `{}` | no |
| subnetwork | The subnetwork to host the cluster in (required) | `string` | n/a | yes |
| timeouts | Timeout for cluster operations. | `map(string)` | `{}` | no |
| upstream\_nameservers | If specified, the values replace the nameservers taken by default from the node’s /etc/resolv.conf | `list(string)` | `[]` | no |
| zones | The zones to host the cluster in (optional if regional cluster / required if zonal) | `list(string)` | `[]` | no |

Expand Down
12 changes: 6 additions & 6 deletions modules/beta-private-cluster/cluster.tf
Original file line number Diff line number Diff line change
Expand Up @@ -240,9 +240,9 @@ resource "google_container_cluster" "primary" {
}

timeouts {
create = "45m"
update = "45m"
delete = "45m"
create = lookup(var.timeouts, "create", "45m")
update = lookup(var.timeouts, "update", "45m")
delete = lookup(var.timeouts, "delete", "45m")
}
node_pool {
name = "default-pool"
Expand Down Expand Up @@ -553,8 +553,8 @@ resource "google_container_node_pool" "pools" {
}

timeouts {
create = "45m"
update = "45m"
delete = "45m"
create = lookup(var.timeouts, "create", "45m")
update = lookup(var.timeouts, "update", "45m")
delete = lookup(var.timeouts, "delete", "45m")
}
}
10 changes: 10 additions & 0 deletions modules/beta-private-cluster/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -544,6 +544,16 @@ variable "node_metadata" {
}
}

variable "timeouts" {
type = map(string)
description = "Timeout for cluster operations."
default = {}
validation {
condition = !contains([for t in keys(var.timeouts) : contains(["create", "update", "delete"], t)], false)
error_message = "Only create, update, delete timeouts can be specified."
}
}

variable "enable_kubernetes_alpha" {
type = bool
description = "Whether to enable Kubernetes Alpha features for this cluster. Note that when this option is enabled, the cluster cannot be upgraded and will be automatically deleted after 30 days."
Expand Down
1 change: 1 addition & 0 deletions modules/beta-public-cluster-update-variant/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,7 @@ Then perform the following commands on the root folder:
| skip\_provisioners | Flag to skip all local-exec provisioners. It breaks `stub_domains` and `upstream_nameservers` variables functionality. | `bool` | `false` | no |
| stub\_domains | Map of stub domains and their resolvers to forward DNS queries for a certain domain to an external DNS server | `map(list(string))` | `{}` | no |
| subnetwork | The subnetwork to host the cluster in (required) | `string` | n/a | yes |
| timeouts | Timeout for cluster operations. | `map(string)` | `{}` | no |
| upstream\_nameservers | If specified, the values replace the nameservers taken by default from the node’s /etc/resolv.conf | `list(string)` | `[]` | no |
| zones | The zones to host the cluster in (optional if regional cluster / required if zonal) | `list(string)` | `[]` | no |

Expand Down
12 changes: 6 additions & 6 deletions modules/beta-public-cluster-update-variant/cluster.tf
Original file line number Diff line number Diff line change
Expand Up @@ -240,9 +240,9 @@ resource "google_container_cluster" "primary" {
}

timeouts {
create = "45m"
update = "45m"
delete = "45m"
create = lookup(var.timeouts, "create", "45m")
update = lookup(var.timeouts, "update", "45m")
delete = lookup(var.timeouts, "delete", "45m")
}
node_pool {
name = "default-pool"
Expand Down Expand Up @@ -622,8 +622,8 @@ resource "google_container_node_pool" "pools" {
}

timeouts {
create = "45m"
update = "45m"
delete = "45m"
create = lookup(var.timeouts, "create", "45m")
update = lookup(var.timeouts, "update", "45m")
delete = lookup(var.timeouts, "delete", "45m")
}
}
10 changes: 10 additions & 0 deletions modules/beta-public-cluster-update-variant/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -513,6 +513,16 @@ variable "node_metadata" {
}
}

variable "timeouts" {
type = map(string)
description = "Timeout for cluster operations."
default = {}
validation {
condition = !contains([for t in keys(var.timeouts) : contains(["create", "update", "delete"], t)], false)
error_message = "Only create, update, delete timeouts can be specified."
}
}

variable "enable_kubernetes_alpha" {
type = bool
description = "Whether to enable Kubernetes Alpha features for this cluster. Note that when this option is enabled, the cluster cannot be upgraded and will be automatically deleted after 30 days."
Expand Down
1 change: 1 addition & 0 deletions modules/beta-public-cluster/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,7 @@ Then perform the following commands on the root folder:
| skip\_provisioners | Flag to skip all local-exec provisioners. It breaks `stub_domains` and `upstream_nameservers` variables functionality. | `bool` | `false` | no |
| stub\_domains | Map of stub domains and their resolvers to forward DNS queries for a certain domain to an external DNS server | `map(list(string))` | `{}` | no |
| subnetwork | The subnetwork to host the cluster in (required) | `string` | n/a | yes |
| timeouts | Timeout for cluster operations. | `map(string)` | `{}` | no |
| upstream\_nameservers | If specified, the values replace the nameservers taken by default from the node’s /etc/resolv.conf | `list(string)` | `[]` | no |
| zones | The zones to host the cluster in (optional if regional cluster / required if zonal) | `list(string)` | `[]` | no |

Expand Down
12 changes: 6 additions & 6 deletions modules/beta-public-cluster/cluster.tf
Original file line number Diff line number Diff line change
Expand Up @@ -240,9 +240,9 @@ resource "google_container_cluster" "primary" {
}

timeouts {
create = "45m"
update = "45m"
delete = "45m"
create = lookup(var.timeouts, "create", "45m")
update = lookup(var.timeouts, "update", "45m")
delete = lookup(var.timeouts, "delete", "45m")
}
node_pool {
name = "default-pool"
Expand Down Expand Up @@ -534,8 +534,8 @@ resource "google_container_node_pool" "pools" {
}

timeouts {
create = "45m"
update = "45m"
delete = "45m"
create = lookup(var.timeouts, "create", "45m")
update = lookup(var.timeouts, "update", "45m")
delete = lookup(var.timeouts, "delete", "45m")
}
}
10 changes: 10 additions & 0 deletions modules/beta-public-cluster/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -513,6 +513,16 @@ variable "node_metadata" {
}
}

variable "timeouts" {
type = map(string)
description = "Timeout for cluster operations."
default = {}
validation {
condition = !contains([for t in keys(var.timeouts) : contains(["create", "update", "delete"], t)], false)
error_message = "Only create, update, delete timeouts can be specified."
}
}

variable "enable_kubernetes_alpha" {
type = bool
description = "Whether to enable Kubernetes Alpha features for this cluster. Note that when this option is enabled, the cluster cannot be upgraded and will be automatically deleted after 30 days."
Expand Down
1 change: 1 addition & 0 deletions modules/private-cluster-update-variant/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,7 @@ Then perform the following commands on the root folder:
| skip\_provisioners | Flag to skip all local-exec provisioners. It breaks `stub_domains` and `upstream_nameservers` variables functionality. | `bool` | `false` | no |
| stub\_domains | Map of stub domains and their resolvers to forward DNS queries for a certain domain to an external DNS server | `map(list(string))` | `{}` | no |
| subnetwork | The subnetwork to host the cluster in (required) | `string` | n/a | yes |
| timeouts | Timeout for cluster operations. | `map(string)` | `{}` | no |
| upstream\_nameservers | If specified, the values replace the nameservers taken by default from the node’s /etc/resolv.conf | `list(string)` | `[]` | no |
| zones | The zones to host the cluster in (optional if regional cluster / required if zonal) | `list(string)` | `[]` | no |

Expand Down
12 changes: 6 additions & 6 deletions modules/private-cluster-update-variant/cluster.tf
Original file line number Diff line number Diff line change
Expand Up @@ -155,9 +155,9 @@ resource "google_container_cluster" "primary" {
}

timeouts {
create = "45m"
update = "45m"
delete = "45m"
create = lookup(var.timeouts, "create", "45m")
update = lookup(var.timeouts, "update", "45m")
delete = lookup(var.timeouts, "delete", "45m")
}
node_pool {
name = "default-pool"
Expand Down Expand Up @@ -483,8 +483,8 @@ resource "google_container_node_pool" "pools" {
}

timeouts {
create = "45m"
update = "45m"
delete = "45m"
create = lookup(var.timeouts, "create", "45m")
update = lookup(var.timeouts, "update", "45m")
delete = lookup(var.timeouts, "delete", "45m")
}
}
10 changes: 10 additions & 0 deletions modules/private-cluster-update-variant/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -489,3 +489,13 @@ variable "node_metadata" {
error_message = "The node_metadata value must be one of GKE_METADATA, GCE_METADATA or UNSPECIFIED."
}
}

variable "timeouts" {
type = map(string)
description = "Timeout for cluster operations."
default = {}
validation {
condition = !contains([for t in keys(var.timeouts) : contains(["create", "update", "delete"], t)], false)
error_message = "Only create, update, delete timeouts can be specified."
}
}
Loading

0 comments on commit 6011c80

Please sign in to comment.