Skip to content

Commit eeb3f4f

Browse files
Tolseenaveen230
authored andcommitted
feat!: promote gke_backup_agent_config to ga (terraform-google-modules#1513)
1 parent d7f71f6 commit eeb3f4f

File tree

45 files changed

+254
-96
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+254
-96
lines changed

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ Then perform the following commands on the root folder:
131131
| add\_master\_webhook\_firewall\_rules | Create master\_webhook firewall rules for ports defined in `firewall_inbound_ports` | `bool` | `false` | no |
132132
| add\_shadow\_firewall\_rules | Create GKE shadow firewall (the same as default firewall rules with firewall logs enabled). | `bool` | `false` | no |
133133
| authenticator\_security\_group | The name of the RBAC security group for use with Google security groups in Kubernetes RBAC. Group name must be in format [email protected] | `string` | `null` | no |
134-
| cluster\_autoscaling | Cluster autoscaling configuration. See [more details](https://cloud.google.com/kubernetes-engine/docs/reference/rest/v1beta1/projects.locations.clusters#clusterautoscaling) | <pre>object({<br> enabled = bool<br> min_cpu_cores = number<br> max_cpu_cores = number<br> min_memory_gb = number<br> max_memory_gb = number<br> gpu_resources = list(object({ resource_type = string, minimum = number, maximum = number }))<br> })</pre> | <pre>{<br> "enabled": false,<br> "gpu_resources": [],<br> "max_cpu_cores": 0,<br> "max_memory_gb": 0,<br> "min_cpu_cores": 0,<br> "min_memory_gb": 0<br>}</pre> | no |
134+
| cluster\_autoscaling | Cluster autoscaling configuration. See [more details](https://cloud.google.com/kubernetes-engine/docs/reference/rest/v1beta1/projects.locations.clusters#clusterautoscaling) | <pre>object({<br> enabled = bool<br> min_cpu_cores = number<br> max_cpu_cores = number<br> min_memory_gb = number<br> max_memory_gb = number<br> gpu_resources = list(object({ resource_type = string, minimum = number, maximum = number }))<br> auto_repair = bool<br> auto_upgrade = bool<br> })</pre> | <pre>{<br> "auto_repair": true,<br> "auto_upgrade": true,<br> "enabled": false,<br> "gpu_resources": [],<br> "max_cpu_cores": 0,<br> "max_memory_gb": 0,<br> "min_cpu_cores": 0,<br> "min_memory_gb": 0<br>}</pre> | no |
135135
| cluster\_dns\_domain | The suffix used for all cluster service records. | `string` | `""` | no |
136136
| cluster\_dns\_provider | Which in-cluster DNS provider should be used. PROVIDER\_UNSPECIFIED (default) or PLATFORM\_DEFAULT or CLOUD\_DNS. | `string` | `"PROVIDER_UNSPECIFIED"` | no |
137137
| cluster\_dns\_scope | The scope of access to cluster DNS records. DNS\_SCOPE\_UNSPECIFIED (default) or CLUSTER\_SCOPE or VPC\_SCOPE. | `string` | `"DNS_SCOPE_UNSPECIFIED"` | no |
@@ -158,6 +158,7 @@ Then perform the following commands on the root folder:
158158
| firewall\_priority | Priority rule for firewall rules | `number` | `1000` | no |
159159
| gateway\_api\_channel | The gateway api channel of this cluster. Accepted values are `CHANNEL_STANDARD` and `CHANNEL_DISABLED`. | `string` | `null` | no |
160160
| gce\_pd\_csi\_driver | Whether this cluster should enable the Google Compute Engine Persistent Disk Container Storage Interface (CSI) Driver. | `bool` | `true` | no |
161+
| gke\_backup\_agent\_config | Whether Backup for GKE agent is enabled for this cluster. | `bool` | `false` | no |
161162
| grant\_registry\_access | Grants created cluster-specific service account storage.objectViewer and artifactregistry.reader roles. | `bool` | `false` | no |
162163
| horizontal\_pod\_autoscaling | Enable horizontal pod autoscaling addon | `bool` | `true` | no |
163164
| http\_load\_balancing | Enable httpload balancer addon | `bool` | `true` | no |

autogen/main/cluster.tf.tmpl

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,14 @@ resource "google_container_cluster" "primary" {
151151
maximum = lookup(resource_limits.value, "maximum")
152152
}
153153
}
154+
dynamic "management" {
155+
for_each = var.cluster_autoscaling.enabled ? [1] : []
156+
157+
content {
158+
auto_repair = var.cluster_autoscaling.auto_repair
159+
auto_upgrade = var.cluster_autoscaling.auto_upgrade
160+
}
161+
}
154162
}
155163
{% endif %}
156164
{% if autopilot_cluster == true %}
@@ -259,6 +267,14 @@ resource "google_container_cluster" "primary" {
259267
enabled = gce_persistent_disk_csi_driver_config.value.enabled
260268
}
261269
}
270+
271+
dynamic "gke_backup_agent_config" {
272+
for_each = local.gke_backup_agent_config
273+
274+
content {
275+
enabled = gke_backup_agent_config.value.enabled
276+
}
277+
}
262278
{% endif %}
263279
{% if beta_cluster and autopilot_cluster != true %}
264280

@@ -282,14 +298,6 @@ resource "google_container_cluster" "primary" {
282298
config_connector_config {
283299
enabled = var.config_connector
284300
}
285-
286-
dynamic "gke_backup_agent_config" {
287-
for_each = local.gke_backup_agent_config
288-
289-
content {
290-
enabled = gke_backup_agent_config.value.enabled
291-
}
292-
}
293301
{% endif %}
294302
}
295303

autogen/main/main.tf.tmpl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ locals {
6868
resource_type = "memory"
6969
minimum = var.cluster_autoscaling.min_memory_gb
7070
maximum = var.cluster_autoscaling.max_memory_gb
71-
}], var.cluster_autoscaling.gpu_resources) : []
71+
}], var.cluster_autoscaling.gpu_resources) : []
7272
{% endif %}
7373

7474

@@ -103,6 +103,7 @@ locals {
103103
}]
104104
cluster_gce_pd_csi_config = var.gce_pd_csi_driver ? [{ enabled = true }] : [{ enabled = false }]
105105
logmon_config_is_set = length(var.logging_enabled_components) > 0 || length(var.monitoring_enabled_components) > 0 || var.monitoring_enable_managed_prometheus
106+
gke_backup_agent_config = var.gke_backup_agent_config ? [{ enabled = true }] : [{ enabled = false }]
106107
{% endif %}
107108
{% if beta_cluster and autopilot_cluster != true %}
108109
cluster_cloudrun_config_load_balancer_config = (var.cloudrun && var.cloudrun_load_balancer_type != "") ? {
@@ -117,7 +118,6 @@ locals {
117118
)
118119
] : []
119120
cluster_cloudrun_enabled = var.cloudrun
120-
gke_backup_agent_config = var.gke_backup_agent_config ? [{ enabled = true }] : [{ enabled = false }]
121121
{% endif %}
122122

123123
cluster_authenticator_security_group = var.authenticator_security_group == null ? [] : [{

autogen/main/variables.tf.tmpl

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -241,6 +241,8 @@ variable "cluster_autoscaling" {
241241
min_memory_gb = number
242242
max_memory_gb = number
243243
gpu_resources = list(object({ resource_type = string, minimum = number, maximum = number }))
244+
auto_repair = bool
245+
auto_upgrade = bool
244246
})
245247
default = {
246248
enabled = false
@@ -252,6 +254,8 @@ variable "cluster_autoscaling" {
252254
max_memory_gb = 0
253255
min_memory_gb = 0
254256
gpu_resources = []
257+
auto_repair = true
258+
auto_upgrade = true
255259
}
256260
description = "Cluster autoscaling configuration. See [more details](https://cloud.google.com/kubernetes-engine/docs/reference/rest/v1beta1/projects.locations.clusters#clusterautoscaling)"
257261
}
@@ -641,6 +645,12 @@ variable "gce_pd_csi_driver" {
641645
default = true
642646
}
643647

648+
variable "gke_backup_agent_config" {
649+
type = bool
650+
description = "Whether Backup for GKE agent is enabled for this cluster."
651+
default = false
652+
}
653+
644654
{% endif %}
645655
variable "timeouts" {
646656
type = map(string)
@@ -703,12 +713,6 @@ variable "config_connector" {
703713
default = false
704714
}
705715

706-
variable "gke_backup_agent_config" {
707-
type = bool
708-
description = "(Beta) Whether Backup for GKE agent is enabled for this cluster."
709-
default = false
710-
}
711-
712716
variable "cloudrun" {
713717
description = "(Beta) Enable CloudRun addon"
714718
default = false

autogen/main/versions.tf.tmpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ terraform {
2424
required_providers {
2525
google-beta = {
2626
source = "hashicorp/google-beta"
27-
version = ">= 4.46.0, < 5.0"
27+
version = ">= 4.47.0, < 5.0"
2828
}
2929
kubernetes = {
3030
source = "hashicorp/kubernetes"

autogen/safer-cluster/variables.tf.tmpl

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -227,6 +227,8 @@ variable "cluster_autoscaling" {
227227
min_memory_gb = number
228228
max_memory_gb = number
229229
gpu_resources = list(object({ resource_type = string, minimum = number, maximum = number }))
230+
auto_repair = bool
231+
auto_upgrade = bool
230232
})
231233
default = {
232234
enabled = false
@@ -236,6 +238,8 @@ variable "cluster_autoscaling" {
236238
max_memory_gb = 0
237239
min_memory_gb = 0
238240
gpu_resources = []
241+
auto_repair = true
242+
auto_upgrade = true
239243
}
240244
description = "Cluster autoscaling configuration. See [more details](https://cloud.google.com/kubernetes-engine/docs/reference/rest/v1beta1/projects.locations.clusters#clusterautoscaling)"
241245
}

cluster.tf

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,14 @@ resource "google_container_cluster" "primary" {
114114
maximum = lookup(resource_limits.value, "maximum")
115115
}
116116
}
117+
dynamic "management" {
118+
for_each = var.cluster_autoscaling.enabled ? [1] : []
119+
120+
content {
121+
auto_repair = var.cluster_autoscaling.auto_repair
122+
auto_upgrade = var.cluster_autoscaling.auto_upgrade
123+
}
124+
}
117125
}
118126
vertical_pod_autoscaling {
119127
enabled = var.enable_vertical_pod_autoscaling
@@ -184,6 +192,14 @@ resource "google_container_cluster" "primary" {
184192
enabled = gce_persistent_disk_csi_driver_config.value.enabled
185193
}
186194
}
195+
196+
dynamic "gke_backup_agent_config" {
197+
for_each = local.gke_backup_agent_config
198+
199+
content {
200+
enabled = gke_backup_agent_config.value.enabled
201+
}
202+
}
187203
}
188204

189205
datapath_provider = var.datapath_provider

main.tf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ locals {
8585
}]
8686
cluster_gce_pd_csi_config = var.gce_pd_csi_driver ? [{ enabled = true }] : [{ enabled = false }]
8787
logmon_config_is_set = length(var.logging_enabled_components) > 0 || length(var.monitoring_enabled_components) > 0 || var.monitoring_enable_managed_prometheus
88+
gke_backup_agent_config = var.gke_backup_agent_config ? [{ enabled = true }] : [{ enabled = false }]
8889

8990
cluster_authenticator_security_group = var.authenticator_security_group == null ? [] : [{
9091
security_group = var.authenticator_security_group

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ terraform {
2121
required_providers {
2222
google-beta = {
2323
source = "hashicorp/google-beta"
24-
version = ">= 4.46.0, < 5.0"
24+
version = ">= 4.47.0, < 5.0"
2525
}
2626
kubernetes = {
2727
source = "hashicorp/kubernetes"

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ terraform {
2121
required_providers {
2222
google-beta = {
2323
source = "hashicorp/google-beta"
24-
version = ">= 4.46.0, < 5.0"
24+
version = ">= 4.47.0, < 5.0"
2525
}
2626
kubernetes = {
2727
source = "hashicorp/kubernetes"

modules/beta-private-cluster-update-variant/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ Then perform the following commands on the root folder:
165165
| authenticator\_security\_group | The name of the RBAC security group for use with Google security groups in Kubernetes RBAC. Group name must be in format [email protected] | `string` | `null` | no |
166166
| cloudrun | (Beta) Enable CloudRun addon | `bool` | `false` | no |
167167
| cloudrun\_load\_balancer\_type | (Beta) Configure the Cloud Run load balancer type. External by default. Set to `LOAD_BALANCER_TYPE_INTERNAL` to configure as an internal load balancer. | `string` | `""` | no |
168-
| cluster\_autoscaling | Cluster autoscaling configuration. See [more details](https://cloud.google.com/kubernetes-engine/docs/reference/rest/v1beta1/projects.locations.clusters#clusterautoscaling) | <pre>object({<br> enabled = bool<br> autoscaling_profile = string<br> min_cpu_cores = number<br> max_cpu_cores = number<br> min_memory_gb = number<br> max_memory_gb = number<br> gpu_resources = list(object({ resource_type = string, minimum = number, maximum = number }))<br> })</pre> | <pre>{<br> "autoscaling_profile": "BALANCED",<br> "enabled": false,<br> "gpu_resources": [],<br> "max_cpu_cores": 0,<br> "max_memory_gb": 0,<br> "min_cpu_cores": 0,<br> "min_memory_gb": 0<br>}</pre> | no |
168+
| cluster\_autoscaling | Cluster autoscaling configuration. See [more details](https://cloud.google.com/kubernetes-engine/docs/reference/rest/v1beta1/projects.locations.clusters#clusterautoscaling) | <pre>object({<br> enabled = bool<br> autoscaling_profile = string<br> min_cpu_cores = number<br> max_cpu_cores = number<br> min_memory_gb = number<br> max_memory_gb = number<br> gpu_resources = list(object({ resource_type = string, minimum = number, maximum = number }))<br> auto_repair = bool<br> auto_upgrade = bool<br> })</pre> | <pre>{<br> "auto_repair": true,<br> "auto_upgrade": true,<br> "autoscaling_profile": "BALANCED",<br> "enabled": false,<br> "gpu_resources": [],<br> "max_cpu_cores": 0,<br> "max_memory_gb": 0,<br> "min_cpu_cores": 0,<br> "min_memory_gb": 0<br>}</pre> | no |
169169
| cluster\_dns\_domain | The suffix used for all cluster service records. | `string` | `""` | no |
170170
| cluster\_dns\_provider | Which in-cluster DNS provider should be used. PROVIDER\_UNSPECIFIED (default) or PLATFORM\_DEFAULT or CLOUD\_DNS. | `string` | `"PROVIDER_UNSPECIFIED"` | no |
171171
| cluster\_dns\_scope | The scope of access to cluster DNS records. DNS\_SCOPE\_UNSPECIFIED (default) or CLUSTER\_SCOPE or VPC\_SCOPE. | `string` | `"DNS_SCOPE_UNSPECIFIED"` | no |
@@ -203,7 +203,7 @@ Then perform the following commands on the root folder:
203203
| firewall\_priority | Priority rule for firewall rules | `number` | `1000` | no |
204204
| gateway\_api\_channel | The gateway api channel of this cluster. Accepted values are `CHANNEL_STANDARD` and `CHANNEL_DISABLED`. | `string` | `null` | no |
205205
| gce\_pd\_csi\_driver | Whether this cluster should enable the Google Compute Engine Persistent Disk Container Storage Interface (CSI) Driver. | `bool` | `true` | no |
206-
| gke\_backup\_agent\_config | (Beta) Whether Backup for GKE agent is enabled for this cluster. | `bool` | `false` | no |
206+
| gke\_backup\_agent\_config | Whether Backup for GKE agent is enabled for this cluster. | `bool` | `false` | no |
207207
| grant\_registry\_access | Grants created cluster-specific service account storage.objectViewer and artifactregistry.reader roles. | `bool` | `false` | no |
208208
| horizontal\_pod\_autoscaling | Enable horizontal pod autoscaling addon | `bool` | `true` | no |
209209
| http\_load\_balancing | Enable httpload balancer addon | `bool` | `true` | no |

modules/beta-private-cluster-update-variant/cluster.tf

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,14 @@ resource "google_container_cluster" "primary" {
128128
maximum = lookup(resource_limits.value, "maximum")
129129
}
130130
}
131+
dynamic "management" {
132+
for_each = var.cluster_autoscaling.enabled ? [1] : []
133+
134+
content {
135+
auto_repair = var.cluster_autoscaling.auto_repair
136+
auto_upgrade = var.cluster_autoscaling.auto_upgrade
137+
}
138+
}
131139
}
132140
vertical_pod_autoscaling {
133141
enabled = var.enable_vertical_pod_autoscaling
@@ -217,6 +225,14 @@ resource "google_container_cluster" "primary" {
217225
}
218226
}
219227

228+
dynamic "gke_backup_agent_config" {
229+
for_each = local.gke_backup_agent_config
230+
231+
content {
232+
enabled = gke_backup_agent_config.value.enabled
233+
}
234+
}
235+
220236
istio_config {
221237
disabled = !var.istio
222238
auth = var.istio_auth
@@ -237,14 +253,6 @@ resource "google_container_cluster" "primary" {
237253
config_connector_config {
238254
enabled = var.config_connector
239255
}
240-
241-
dynamic "gke_backup_agent_config" {
242-
for_each = local.gke_backup_agent_config
243-
244-
content {
245-
enabled = gke_backup_agent_config.value.enabled
246-
}
247-
}
248256
}
249257

250258
datapath_provider = var.datapath_provider

modules/beta-private-cluster-update-variant/main.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ locals {
8686
}]
8787
cluster_gce_pd_csi_config = var.gce_pd_csi_driver ? [{ enabled = true }] : [{ enabled = false }]
8888
logmon_config_is_set = length(var.logging_enabled_components) > 0 || length(var.monitoring_enabled_components) > 0 || var.monitoring_enable_managed_prometheus
89+
gke_backup_agent_config = var.gke_backup_agent_config ? [{ enabled = true }] : [{ enabled = false }]
8990
cluster_cloudrun_config_load_balancer_config = (var.cloudrun && var.cloudrun_load_balancer_type != "") ? {
9091
load_balancer_type = var.cloudrun_load_balancer_type
9192
} : {}
@@ -98,7 +99,6 @@ locals {
9899
)
99100
] : []
100101
cluster_cloudrun_enabled = var.cloudrun
101-
gke_backup_agent_config = var.gke_backup_agent_config ? [{ enabled = true }] : [{ enabled = false }]
102102

103103
cluster_authenticator_security_group = var.authenticator_security_group == null ? [] : [{
104104
security_group = var.authenticator_security_group

modules/beta-private-cluster-update-variant/variables.tf

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -234,6 +234,8 @@ variable "cluster_autoscaling" {
234234
min_memory_gb = number
235235
max_memory_gb = number
236236
gpu_resources = list(object({ resource_type = string, minimum = number, maximum = number }))
237+
auto_repair = bool
238+
auto_upgrade = bool
237239
})
238240
default = {
239241
enabled = false
@@ -243,6 +245,8 @@ variable "cluster_autoscaling" {
243245
max_memory_gb = 0
244246
min_memory_gb = 0
245247
gpu_resources = []
248+
auto_repair = true
249+
auto_upgrade = true
246250
}
247251
description = "Cluster autoscaling configuration. See [more details](https://cloud.google.com/kubernetes-engine/docs/reference/rest/v1beta1/projects.locations.clusters#clusterautoscaling)"
248252
}
@@ -614,6 +618,12 @@ variable "gce_pd_csi_driver" {
614618
default = true
615619
}
616620

621+
variable "gke_backup_agent_config" {
622+
type = bool
623+
description = "Whether Backup for GKE agent is enabled for this cluster."
624+
default = false
625+
}
626+
617627
variable "timeouts" {
618628
type = map(string)
619629
description = "Timeout for cluster operations."
@@ -671,12 +681,6 @@ variable "config_connector" {
671681
default = false
672682
}
673683

674-
variable "gke_backup_agent_config" {
675-
type = bool
676-
description = "(Beta) Whether Backup for GKE agent is enabled for this cluster."
677-
default = false
678-
}
679-
680684
variable "cloudrun" {
681685
description = "(Beta) Enable CloudRun addon"
682686
default = false

modules/beta-private-cluster-update-variant/versions.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ terraform {
2121
required_providers {
2222
google-beta = {
2323
source = "hashicorp/google-beta"
24-
version = ">= 4.46.0, < 5.0"
24+
version = ">= 4.47.0, < 5.0"
2525
}
2626
kubernetes = {
2727
source = "hashicorp/kubernetes"

0 commit comments

Comments
 (0)