Skip to content

Commit acbb453

Browse files
authored
feat(TPG>=5.25.0)!: Add support for StatefulHA Addon (#1948)
1 parent 748e1ed commit acbb453

File tree

40 files changed

+145
-14
lines changed

40 files changed

+145
-14
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -228,6 +228,7 @@ Then perform the following commands on the root folder:
228228
| shadow\_firewall\_rules\_log\_config | The log\_config for shadow firewall rules. You can set this variable to `null` to disable logging. | <pre>object({<br> metadata = string<br> })</pre> | <pre>{<br> "metadata": "INCLUDE_ALL_METADATA"<br>}</pre> | no |
229229
| shadow\_firewall\_rules\_priority | The firewall priority of GKE shadow firewall rules. The priority should be less than default firewall, which is 1000. | `number` | `999` | no |
230230
| stack\_type | The stack type to use for this cluster. Either `IPV4` or `IPV4_IPV6`. Defaults to `IPV4`. | `string` | `"IPV4"` | no |
231+
| stateful\_ha | Whether the Stateful HA Addon is enabled for this cluster. | `bool` | `false` | no |
231232
| 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 |
232233
| subnetwork | The subnetwork to host the cluster in (required) | `string` | n/a | yes |
233234
| timeouts | Timeout for cluster operations. | `map(string)` | `{}` | no |

autogen/main/cluster.tf.tmpl

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -309,6 +309,14 @@ resource "google_container_cluster" "primary" {
309309
}
310310
}
311311

312+
dynamic "stateful_ha_config" {
313+
for_each = local.stateful_ha_config
314+
315+
content {
316+
enabled = stateful_ha_config.value.enabled
317+
}
318+
}
319+
312320
config_connector_config {
313321
enabled = var.config_connector
314322
}

autogen/main/main.tf.tmpl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,7 @@ locals {
109109
logmon_config_is_set = length(var.logging_enabled_components) > 0 || length(var.monitoring_enabled_components) > 0 || var.monitoring_enable_managed_prometheus
110110
gke_backup_agent_config = var.gke_backup_agent_config ? [{ enabled = true }] : [{ enabled = false }]
111111
gcs_fuse_csi_driver_config = var.gcs_fuse_csi_driver ? [{ enabled = true }] : []
112+
stateful_ha_config = var.stateful_ha ? [{ enabled = true }] : []
112113
{% endif %}
113114
{% if beta_cluster and autopilot_cluster != true %}
114115
cluster_cloudrun_config_load_balancer_config = (var.cloudrun && var.cloudrun_load_balancer_type != "") ? {

autogen/main/variables.tf.tmpl

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -725,6 +725,12 @@ variable "gcs_fuse_csi_driver" {
725725
default = false
726726
}
727727

728+
variable "stateful_ha" {
729+
type = bool
730+
description = "Whether the Stateful HA Addon is enabled for this cluster."
731+
default = false
732+
}
733+
728734
{% endif %}
729735
variable "timeouts" {
730736
type = map(string)

autogen/main/versions.tf.tmpl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,11 @@ terraform {
2424
required_providers {
2525
google = {
2626
source = "hashicorp/google"
27-
version = ">= 5.9.0, < 6"
27+
version = ">= 5.25.0, < 6"
2828
}
2929
google-beta = {
3030
source = "hashicorp/google-beta"
31-
version = ">= 5.9.0, < 6"
31+
version = ">= 5.25.0, < 6"
3232
}
3333
kubernetes = {
3434
source = "hashicorp/kubernetes"

cluster.tf

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -229,6 +229,14 @@ resource "google_container_cluster" "primary" {
229229
}
230230
}
231231

232+
dynamic "stateful_ha_config" {
233+
for_each = local.stateful_ha_config
234+
235+
content {
236+
enabled = stateful_ha_config.value.enabled
237+
}
238+
}
239+
232240
config_connector_config {
233241
enabled = var.config_connector
234242
}

examples/simple_regional/main.tf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,4 +45,5 @@ module "gke" {
4545
gcs_fuse_csi_driver = true
4646
fleet_project = var.project_id
4747
deletion_protection = false
48+
stateful_ha = true
4849
}

main.tf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@ locals {
9494
logmon_config_is_set = length(var.logging_enabled_components) > 0 || length(var.monitoring_enabled_components) > 0 || var.monitoring_enable_managed_prometheus
9595
gke_backup_agent_config = var.gke_backup_agent_config ? [{ enabled = true }] : [{ enabled = false }]
9696
gcs_fuse_csi_driver_config = var.gcs_fuse_csi_driver ? [{ enabled = true }] : []
97+
stateful_ha_config = var.stateful_ha ? [{ enabled = true }] : []
9798

9899
cluster_authenticator_security_group = var.authenticator_security_group == null ? [] : [{
99100
security_group = var.authenticator_security_group

modules/beta-autopilot-private-cluster/versions.tf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,11 @@ terraform {
2121
required_providers {
2222
google = {
2323
source = "hashicorp/google"
24-
version = ">= 5.9.0, < 6"
24+
version = ">= 5.25.0, < 6"
2525
}
2626
google-beta = {
2727
source = "hashicorp/google-beta"
28-
version = ">= 5.9.0, < 6"
28+
version = ">= 5.25.0, < 6"
2929
}
3030
kubernetes = {
3131
source = "hashicorp/kubernetes"

modules/beta-autopilot-public-cluster/versions.tf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,11 @@ terraform {
2121
required_providers {
2222
google = {
2323
source = "hashicorp/google"
24-
version = ">= 5.9.0, < 6"
24+
version = ">= 5.25.0, < 6"
2525
}
2626
google-beta = {
2727
source = "hashicorp/google-beta"
28-
version = ">= 5.9.0, < 6"
28+
version = ">= 5.25.0, < 6"
2929
}
3030
kubernetes = {
3131
source = "hashicorp/kubernetes"

0 commit comments

Comments
 (0)