Skip to content

Commit 425bf93

Browse files
authored
feat!: support maintenance_exclusion (#1273)
1 parent 23228a8 commit 425bf93

File tree

34 files changed

+95
-25
lines changed

34 files changed

+95
-25
lines changed

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ Then perform the following commands on the root folder:
161161
| kubernetes\_version | The Kubernetes version of the masters. If set to 'latest' it will pull latest available version in the selected region. | `string` | `"latest"` | no |
162162
| logging\_service | The logging service that the cluster should write logs to. Available options include logging.googleapis.com, logging.googleapis.com/kubernetes (beta), and none | `string` | `"logging.googleapis.com/kubernetes"` | no |
163163
| maintenance\_end\_time | Time window specified for recurring maintenance operations in RFC3339 format | `string` | `""` | no |
164-
| maintenance\_exclusions | List of maintenance exclusions. A cluster can have up to three | `list(object({ name = string, start_time = string, end_time = string }))` | `[]` | no |
164+
| maintenance\_exclusions | List of maintenance exclusions. A cluster can have up to three | `list(object({ name = string, start_time = string, end_time = string, exclusion_scope = string }))` | `[]` | no |
165165
| maintenance\_recurrence | Frequency of the recurring maintenance window in RFC5545 format. | `string` | `""` | no |
166166
| maintenance\_start\_time | Time window specified for daily or recurring maintenance operations in RFC3339 format | `string` | `"05:00"` | no |
167167
| master\_authorized\_networks | List of master authorized networks. If none are provided, disallow external access (except the cluster node IPs, which GKE automatically whitelists). | `list(object({ cidr_block = string, display_name = string }))` | `[]` | no |

autogen/main/cluster.tf.tmpl

+7
Original file line numberDiff line numberDiff line change
@@ -265,6 +265,13 @@ resource "google_container_cluster" "primary" {
265265
exclusion_name = maintenance_exclusion.value.name
266266
start_time = maintenance_exclusion.value.start_time
267267
end_time = maintenance_exclusion.value.end_time
268+
269+
dynamic "exclusion_options" {
270+
for_each = maintenance_exclusion.value.exclusion_scope == null ? [] : [maintenance_exclusion.value.exclusion_scope]
271+
content {
272+
scope = exclusion_options.value
273+
}
274+
}
268275
}
269276
}
270277
}

autogen/main/variables.tf.tmpl

+1-1
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ variable "maintenance_start_time" {
109109
}
110110

111111
variable "maintenance_exclusions" {
112-
type = list(object({ name = string, start_time = string, end_time = string }))
112+
type = list(object({ name = string, start_time = string, end_time = string, exclusion_scope = string }))
113113
description = "List of maintenance exclusions. A cluster can have up to three"
114114
default = []
115115
}

autogen/safer-cluster/variables.tf.tmpl

+2-2
Original file line numberDiff line numberDiff line change
@@ -108,9 +108,9 @@ variable "maintenance_start_time" {
108108
}
109109

110110
variable "maintenance_exclusions" {
111-
type = list(object({ name = string, start_time = string, end_time = string }))
111+
type = list(object({ name = string, start_time = string, end_time = string, exclusion_scope = string }))
112112
description = "List of maintenance exclusions. A cluster can have up to three"
113-
default = []
113+
default = []
114114
}
115115

116116
variable "maintenance_end_time" {

cluster.tf

+7
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,13 @@ resource "google_container_cluster" "primary" {
146146
exclusion_name = maintenance_exclusion.value.name
147147
start_time = maintenance_exclusion.value.start_time
148148
end_time = maintenance_exclusion.value.end_time
149+
150+
dynamic "exclusion_options" {
151+
for_each = maintenance_exclusion.value.exclusion_scope == null ? [] : [maintenance_exclusion.value.exclusion_scope]
152+
content {
153+
scope = exclusion_options.value
154+
}
155+
}
149156
}
150157
}
151158
}

modules/beta-autopilot-private-cluster/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ Then perform the following commands on the root folder:
104104
| kubernetes\_version | The Kubernetes version of the masters. If set to 'latest' it will pull latest available version in the selected region. | `string` | `"latest"` | no |
105105
| logging\_service | The logging service that the cluster should write logs to. Available options include logging.googleapis.com, logging.googleapis.com/kubernetes (beta), and none | `string` | `"logging.googleapis.com/kubernetes"` | no |
106106
| maintenance\_end\_time | Time window specified for recurring maintenance operations in RFC3339 format | `string` | `""` | no |
107-
| maintenance\_exclusions | List of maintenance exclusions. A cluster can have up to three | `list(object({ name = string, start_time = string, end_time = string }))` | `[]` | no |
107+
| maintenance\_exclusions | List of maintenance exclusions. A cluster can have up to three | `list(object({ name = string, start_time = string, end_time = string, exclusion_scope = string }))` | `[]` | no |
108108
| maintenance\_recurrence | Frequency of the recurring maintenance window in RFC5545 format. | `string` | `""` | no |
109109
| maintenance\_start\_time | Time window specified for daily or recurring maintenance operations in RFC3339 format | `string` | `"05:00"` | no |
110110
| master\_authorized\_networks | List of master authorized networks. If none are provided, disallow external access (except the cluster node IPs, which GKE automatically whitelists). | `list(object({ cidr_block = string, display_name = string }))` | `[]` | no |

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

+7
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,13 @@ resource "google_container_cluster" "primary" {
120120
exclusion_name = maintenance_exclusion.value.name
121121
start_time = maintenance_exclusion.value.start_time
122122
end_time = maintenance_exclusion.value.end_time
123+
124+
dynamic "exclusion_options" {
125+
for_each = maintenance_exclusion.value.exclusion_scope == null ? [] : [maintenance_exclusion.value.exclusion_scope]
126+
content {
127+
scope = exclusion_options.value
128+
}
129+
}
123130
}
124131
}
125132
}

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ variable "maintenance_start_time" {
109109
}
110110

111111
variable "maintenance_exclusions" {
112-
type = list(object({ name = string, start_time = string, end_time = string }))
112+
type = list(object({ name = string, start_time = string, end_time = string, exclusion_scope = string }))
113113
description = "List of maintenance exclusions. A cluster can have up to three"
114114
default = []
115115
}

modules/beta-autopilot-public-cluster/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ Then perform the following commands on the root folder:
9595
| kubernetes\_version | The Kubernetes version of the masters. If set to 'latest' it will pull latest available version in the selected region. | `string` | `"latest"` | no |
9696
| logging\_service | The logging service that the cluster should write logs to. Available options include logging.googleapis.com, logging.googleapis.com/kubernetes (beta), and none | `string` | `"logging.googleapis.com/kubernetes"` | no |
9797
| maintenance\_end\_time | Time window specified for recurring maintenance operations in RFC3339 format | `string` | `""` | no |
98-
| maintenance\_exclusions | List of maintenance exclusions. A cluster can have up to three | `list(object({ name = string, start_time = string, end_time = string }))` | `[]` | no |
98+
| maintenance\_exclusions | List of maintenance exclusions. A cluster can have up to three | `list(object({ name = string, start_time = string, end_time = string, exclusion_scope = string }))` | `[]` | no |
9999
| maintenance\_recurrence | Frequency of the recurring maintenance window in RFC5545 format. | `string` | `""` | no |
100100
| maintenance\_start\_time | Time window specified for daily or recurring maintenance operations in RFC3339 format | `string` | `"05:00"` | no |
101101
| master\_authorized\_networks | List of master authorized networks. If none are provided, disallow external access (except the cluster node IPs, which GKE automatically whitelists). | `list(object({ cidr_block = string, display_name = string }))` | `[]` | no |

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

+7
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,13 @@ resource "google_container_cluster" "primary" {
120120
exclusion_name = maintenance_exclusion.value.name
121121
start_time = maintenance_exclusion.value.start_time
122122
end_time = maintenance_exclusion.value.end_time
123+
124+
dynamic "exclusion_options" {
125+
for_each = maintenance_exclusion.value.exclusion_scope == null ? [] : [maintenance_exclusion.value.exclusion_scope]
126+
content {
127+
scope = exclusion_options.value
128+
}
129+
}
123130
}
124131
}
125132
}

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ variable "maintenance_start_time" {
109109
}
110110

111111
variable "maintenance_exclusions" {
112-
type = list(object({ name = string, start_time = string, end_time = string }))
112+
type = list(object({ name = string, start_time = string, end_time = string, exclusion_scope = string }))
113113
description = "List of maintenance exclusions. A cluster can have up to three"
114114
default = []
115115
}

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@ Then perform the following commands on the root folder:
215215
| logging\_enabled\_components | List of services to monitor: SYSTEM\_COMPONENTS, WORKLOADS. Empty list is default GKE configuration. | `list(string)` | `[]` | no |
216216
| logging\_service | The logging service that the cluster should write logs to. Available options include logging.googleapis.com, logging.googleapis.com/kubernetes (beta), and none | `string` | `"logging.googleapis.com/kubernetes"` | no |
217217
| maintenance\_end\_time | Time window specified for recurring maintenance operations in RFC3339 format | `string` | `""` | no |
218-
| maintenance\_exclusions | List of maintenance exclusions. A cluster can have up to three | `list(object({ name = string, start_time = string, end_time = string }))` | `[]` | no |
218+
| maintenance\_exclusions | List of maintenance exclusions. A cluster can have up to three | `list(object({ name = string, start_time = string, end_time = string, exclusion_scope = string }))` | `[]` | no |
219219
| maintenance\_recurrence | Frequency of the recurring maintenance window in RFC5545 format. | `string` | `""` | no |
220220
| maintenance\_start\_time | Time window specified for daily or recurring maintenance operations in RFC3339 format | `string` | `"05:00"` | no |
221221
| master\_authorized\_networks | List of master authorized networks. If none are provided, disallow external access (except the cluster node IPs, which GKE automatically whitelists). | `list(object({ cidr_block = string, display_name = string }))` | `[]` | no |

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

+7
Original file line numberDiff line numberDiff line change
@@ -231,6 +231,13 @@ resource "google_container_cluster" "primary" {
231231
exclusion_name = maintenance_exclusion.value.name
232232
start_time = maintenance_exclusion.value.start_time
233233
end_time = maintenance_exclusion.value.end_time
234+
235+
dynamic "exclusion_options" {
236+
for_each = maintenance_exclusion.value.exclusion_scope == null ? [] : [maintenance_exclusion.value.exclusion_scope]
237+
content {
238+
scope = exclusion_options.value
239+
}
240+
}
234241
}
235242
}
236243
}

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ variable "maintenance_start_time" {
109109
}
110110

111111
variable "maintenance_exclusions" {
112-
type = list(object({ name = string, start_time = string, end_time = string }))
112+
type = list(object({ name = string, start_time = string, end_time = string, exclusion_scope = string }))
113113
description = "List of maintenance exclusions. A cluster can have up to three"
114114
default = []
115115
}

modules/beta-private-cluster/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ Then perform the following commands on the root folder:
193193
| logging\_enabled\_components | List of services to monitor: SYSTEM\_COMPONENTS, WORKLOADS. Empty list is default GKE configuration. | `list(string)` | `[]` | no |
194194
| logging\_service | The logging service that the cluster should write logs to. Available options include logging.googleapis.com, logging.googleapis.com/kubernetes (beta), and none | `string` | `"logging.googleapis.com/kubernetes"` | no |
195195
| maintenance\_end\_time | Time window specified for recurring maintenance operations in RFC3339 format | `string` | `""` | no |
196-
| maintenance\_exclusions | List of maintenance exclusions. A cluster can have up to three | `list(object({ name = string, start_time = string, end_time = string }))` | `[]` | no |
196+
| maintenance\_exclusions | List of maintenance exclusions. A cluster can have up to three | `list(object({ name = string, start_time = string, end_time = string, exclusion_scope = string }))` | `[]` | no |
197197
| maintenance\_recurrence | Frequency of the recurring maintenance window in RFC5545 format. | `string` | `""` | no |
198198
| maintenance\_start\_time | Time window specified for daily or recurring maintenance operations in RFC3339 format | `string` | `"05:00"` | no |
199199
| master\_authorized\_networks | List of master authorized networks. If none are provided, disallow external access (except the cluster node IPs, which GKE automatically whitelists). | `list(object({ cidr_block = string, display_name = string }))` | `[]` | no |

modules/beta-private-cluster/cluster.tf

+7
Original file line numberDiff line numberDiff line change
@@ -231,6 +231,13 @@ resource "google_container_cluster" "primary" {
231231
exclusion_name = maintenance_exclusion.value.name
232232
start_time = maintenance_exclusion.value.start_time
233233
end_time = maintenance_exclusion.value.end_time
234+
235+
dynamic "exclusion_options" {
236+
for_each = maintenance_exclusion.value.exclusion_scope == null ? [] : [maintenance_exclusion.value.exclusion_scope]
237+
content {
238+
scope = exclusion_options.value
239+
}
240+
}
234241
}
235242
}
236243
}

modules/beta-private-cluster/variables.tf

+1-1
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ variable "maintenance_start_time" {
109109
}
110110

111111
variable "maintenance_exclusions" {
112-
type = list(object({ name = string, start_time = string, end_time = string }))
112+
type = list(object({ name = string, start_time = string, end_time = string, exclusion_scope = string }))
113113
description = "List of maintenance exclusions. A cluster can have up to three"
114114
default = []
115115
}

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@ Then perform the following commands on the root folder:
206206
| logging\_enabled\_components | List of services to monitor: SYSTEM\_COMPONENTS, WORKLOADS. Empty list is default GKE configuration. | `list(string)` | `[]` | no |
207207
| logging\_service | The logging service that the cluster should write logs to. Available options include logging.googleapis.com, logging.googleapis.com/kubernetes (beta), and none | `string` | `"logging.googleapis.com/kubernetes"` | no |
208208
| maintenance\_end\_time | Time window specified for recurring maintenance operations in RFC3339 format | `string` | `""` | no |
209-
| maintenance\_exclusions | List of maintenance exclusions. A cluster can have up to three | `list(object({ name = string, start_time = string, end_time = string }))` | `[]` | no |
209+
| maintenance\_exclusions | List of maintenance exclusions. A cluster can have up to three | `list(object({ name = string, start_time = string, end_time = string, exclusion_scope = string }))` | `[]` | no |
210210
| maintenance\_recurrence | Frequency of the recurring maintenance window in RFC5545 format. | `string` | `""` | no |
211211
| maintenance\_start\_time | Time window specified for daily or recurring maintenance operations in RFC3339 format | `string` | `"05:00"` | no |
212212
| master\_authorized\_networks | List of master authorized networks. If none are provided, disallow external access (except the cluster node IPs, which GKE automatically whitelists). | `list(object({ cidr_block = string, display_name = string }))` | `[]` | no |

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

+7
Original file line numberDiff line numberDiff line change
@@ -231,6 +231,13 @@ resource "google_container_cluster" "primary" {
231231
exclusion_name = maintenance_exclusion.value.name
232232
start_time = maintenance_exclusion.value.start_time
233233
end_time = maintenance_exclusion.value.end_time
234+
235+
dynamic "exclusion_options" {
236+
for_each = maintenance_exclusion.value.exclusion_scope == null ? [] : [maintenance_exclusion.value.exclusion_scope]
237+
content {
238+
scope = exclusion_options.value
239+
}
240+
}
234241
}
235242
}
236243
}

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ variable "maintenance_start_time" {
109109
}
110110

111111
variable "maintenance_exclusions" {
112-
type = list(object({ name = string, start_time = string, end_time = string }))
112+
type = list(object({ name = string, start_time = string, end_time = string, exclusion_scope = string }))
113113
description = "List of maintenance exclusions. A cluster can have up to three"
114114
default = []
115115
}

modules/beta-public-cluster/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ Then perform the following commands on the root folder:
184184
| logging\_enabled\_components | List of services to monitor: SYSTEM\_COMPONENTS, WORKLOADS. Empty list is default GKE configuration. | `list(string)` | `[]` | no |
185185
| logging\_service | The logging service that the cluster should write logs to. Available options include logging.googleapis.com, logging.googleapis.com/kubernetes (beta), and none | `string` | `"logging.googleapis.com/kubernetes"` | no |
186186
| maintenance\_end\_time | Time window specified for recurring maintenance operations in RFC3339 format | `string` | `""` | no |
187-
| maintenance\_exclusions | List of maintenance exclusions. A cluster can have up to three | `list(object({ name = string, start_time = string, end_time = string }))` | `[]` | no |
187+
| maintenance\_exclusions | List of maintenance exclusions. A cluster can have up to three | `list(object({ name = string, start_time = string, end_time = string, exclusion_scope = string }))` | `[]` | no |
188188
| maintenance\_recurrence | Frequency of the recurring maintenance window in RFC5545 format. | `string` | `""` | no |
189189
| maintenance\_start\_time | Time window specified for daily or recurring maintenance operations in RFC3339 format | `string` | `"05:00"` | no |
190190
| master\_authorized\_networks | List of master authorized networks. If none are provided, disallow external access (except the cluster node IPs, which GKE automatically whitelists). | `list(object({ cidr_block = string, display_name = string }))` | `[]` | no |

modules/beta-public-cluster/cluster.tf

+7
Original file line numberDiff line numberDiff line change
@@ -231,6 +231,13 @@ resource "google_container_cluster" "primary" {
231231
exclusion_name = maintenance_exclusion.value.name
232232
start_time = maintenance_exclusion.value.start_time
233233
end_time = maintenance_exclusion.value.end_time
234+
235+
dynamic "exclusion_options" {
236+
for_each = maintenance_exclusion.value.exclusion_scope == null ? [] : [maintenance_exclusion.value.exclusion_scope]
237+
content {
238+
scope = exclusion_options.value
239+
}
240+
}
234241
}
235242
}
236243
}

modules/beta-public-cluster/variables.tf

+1-1
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ variable "maintenance_start_time" {
109109
}
110110

111111
variable "maintenance_exclusions" {
112-
type = list(object({ name = string, start_time = string, end_time = string }))
112+
type = list(object({ name = string, start_time = string, end_time = string, exclusion_scope = string }))
113113
description = "List of maintenance exclusions. A cluster can have up to three"
114114
default = []
115115
}

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ Then perform the following commands on the root folder:
192192
| kubernetes\_version | The Kubernetes version of the masters. If set to 'latest' it will pull latest available version in the selected region. | `string` | `"latest"` | no |
193193
| logging\_service | The logging service that the cluster should write logs to. Available options include logging.googleapis.com, logging.googleapis.com/kubernetes (beta), and none | `string` | `"logging.googleapis.com/kubernetes"` | no |
194194
| maintenance\_end\_time | Time window specified for recurring maintenance operations in RFC3339 format | `string` | `""` | no |
195-
| maintenance\_exclusions | List of maintenance exclusions. A cluster can have up to three | `list(object({ name = string, start_time = string, end_time = string }))` | `[]` | no |
195+
| maintenance\_exclusions | List of maintenance exclusions. A cluster can have up to three | `list(object({ name = string, start_time = string, end_time = string, exclusion_scope = string }))` | `[]` | no |
196196
| maintenance\_recurrence | Frequency of the recurring maintenance window in RFC5545 format. | `string` | `""` | no |
197197
| maintenance\_start\_time | Time window specified for daily or recurring maintenance operations in RFC3339 format | `string` | `"05:00"` | no |
198198
| master\_authorized\_networks | List of master authorized networks. If none are provided, disallow external access (except the cluster node IPs, which GKE automatically whitelists). | `list(object({ cidr_block = string, display_name = string }))` | `[]` | no |

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

+7
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,13 @@ resource "google_container_cluster" "primary" {
146146
exclusion_name = maintenance_exclusion.value.name
147147
start_time = maintenance_exclusion.value.start_time
148148
end_time = maintenance_exclusion.value.end_time
149+
150+
dynamic "exclusion_options" {
151+
for_each = maintenance_exclusion.value.exclusion_scope == null ? [] : [maintenance_exclusion.value.exclusion_scope]
152+
content {
153+
scope = exclusion_options.value
154+
}
155+
}
149156
}
150157
}
151158
}

0 commit comments

Comments
 (0)