Skip to content

Commit 5bdd99f

Browse files
committed
feat: support maintenance_exclusion
1 parent 4a7e6e4 commit 5bdd99f

File tree

29 files changed

+98
-24
lines changed

29 files changed

+98
-24
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ Then perform the following commands on the root folder:
160160
| issue\_client\_certificate | Issues a client certificate to authenticate to the cluster endpoint. To maximize the security of your cluster, leave this option disabled. Client certificates don't automatically rotate and aren't easily revocable. WARNING: changing this after cluster creation is destructive! | `bool` | `false` | no |
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 |
163-
| maintenance\_exclusions | List of maintenance exclusions. A cluster can have up to three | `list(object({ name = string, start_time = string, end_time = string }))` | `[]` | no |
163+
| 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 |
164164
| maintenance\_start\_time | Time window specified for daily or recurring maintenance operations in RFC3339 format | `string` | `"05:00"` | no |
165165
| 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 |
166166
| monitoring\_service | The monitoring service that the cluster should write metrics to. Automatically send metrics from pods in the cluster to the Google Cloud Monitoring API. VM metrics will be collected by Google Compute Engine regardless of this setting Available options include monitoring.googleapis.com, monitoring.googleapis.com/kubernetes (beta) and none | `string` | `"monitoring.googleapis.com/kubernetes"` | no |

autogen/main/cluster.tf.tmpl

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -260,19 +260,24 @@ resource "google_container_cluster" "primary" {
260260
}
261261
}
262262

263+
{% else %}
264+
daily_maintenance_window {
265+
start_time = var.maintenance_start_time
266+
}
267+
{% endif %}
268+
263269
dynamic "maintenance_exclusion" {
264270
for_each = var.maintenance_exclusions
265271
content {
266272
exclusion_name = maintenance_exclusion.value.name
267273
start_time = maintenance_exclusion.value.start_time
268274
end_time = maintenance_exclusion.value.end_time
275+
276+
exclusion_options {
277+
exclusion_scope = maintenance_exclusion.value.exclusion_options == null ? "NO_UPGRADES" : maintenance_exclusion.value.exclusion_options
278+
}
269279
}
270280
}
271-
{% else %}
272-
daily_maintenance_window {
273-
start_time = var.maintenance_start_time
274-
}
275-
{% endif %}
276281
}
277282

278283
{% if autopilot_cluster != true %}

autogen/main/variables.tf.tmpl

Lines changed: 1 addition & 1 deletion
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
}

cluster.tf

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,19 @@ resource "google_container_cluster" "primary" {
127127
daily_maintenance_window {
128128
start_time = var.maintenance_start_time
129129
}
130+
131+
dynamic "maintenance_exclusion" {
132+
for_each = var.maintenance_exclusions
133+
content {
134+
exclusion_name = maintenance_exclusion.value.name
135+
start_time = maintenance_exclusion.value.start_time
136+
end_time = maintenance_exclusion.value.end_time
137+
138+
exclusion_options {
139+
exclusion_scope = maintenance_exclusion.value.exclusion_options == null ? "NO_UPGRADES" : maintenance_exclusion.value.exclusion_options
140+
}
141+
}
142+
}
130143
}
131144

132145
lifecycle {

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

Lines changed: 1 addition & 1 deletion
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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,12 +114,17 @@ resource "google_container_cluster" "primary" {
114114
}
115115
}
116116

117+
117118
dynamic "maintenance_exclusion" {
118119
for_each = var.maintenance_exclusions
119120
content {
120121
exclusion_name = maintenance_exclusion.value.name
121122
start_time = maintenance_exclusion.value.start_time
122123
end_time = maintenance_exclusion.value.end_time
124+
125+
exclusion_options {
126+
exclusion_scope = maintenance_exclusion.value.exclusion_options == null ? "NO_UPGRADES" : maintenance_exclusion.value.exclusion_options
127+
}
123128
}
124129
}
125130
}

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

Lines changed: 1 addition & 1 deletion
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

Lines changed: 1 addition & 1 deletion
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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,12 +114,17 @@ resource "google_container_cluster" "primary" {
114114
}
115115
}
116116

117+
117118
dynamic "maintenance_exclusion" {
118119
for_each = var.maintenance_exclusions
119120
content {
120121
exclusion_name = maintenance_exclusion.value.name
121122
start_time = maintenance_exclusion.value.start_time
122123
end_time = maintenance_exclusion.value.end_time
124+
125+
exclusion_options {
126+
exclusion_scope = maintenance_exclusion.value.exclusion_options == null ? "NO_UPGRADES" : maintenance_exclusion.value.exclusion_options
127+
}
123128
}
124129
}
125130
}

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

Lines changed: 1 addition & 1 deletion
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

Lines changed: 1 addition & 1 deletion
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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -225,12 +225,17 @@ resource "google_container_cluster" "primary" {
225225
}
226226
}
227227

228+
228229
dynamic "maintenance_exclusion" {
229230
for_each = var.maintenance_exclusions
230231
content {
231232
exclusion_name = maintenance_exclusion.value.name
232233
start_time = maintenance_exclusion.value.start_time
233234
end_time = maintenance_exclusion.value.end_time
235+
236+
exclusion_options {
237+
exclusion_scope = maintenance_exclusion.value.exclusion_options == null ? "NO_UPGRADES" : maintenance_exclusion.value.exclusion_options
238+
}
234239
}
235240
}
236241
}

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

Lines changed: 1 addition & 1 deletion
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

Lines changed: 1 addition & 1 deletion
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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -225,12 +225,17 @@ resource "google_container_cluster" "primary" {
225225
}
226226
}
227227

228+
228229
dynamic "maintenance_exclusion" {
229230
for_each = var.maintenance_exclusions
230231
content {
231232
exclusion_name = maintenance_exclusion.value.name
232233
start_time = maintenance_exclusion.value.start_time
233234
end_time = maintenance_exclusion.value.end_time
235+
236+
exclusion_options {
237+
exclusion_scope = maintenance_exclusion.value.exclusion_options == null ? "NO_UPGRADES" : maintenance_exclusion.value.exclusion_options
238+
}
234239
}
235240
}
236241
}

modules/beta-private-cluster/variables.tf

Lines changed: 1 addition & 1 deletion
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

Lines changed: 1 addition & 1 deletion
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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -225,12 +225,17 @@ resource "google_container_cluster" "primary" {
225225
}
226226
}
227227

228+
228229
dynamic "maintenance_exclusion" {
229230
for_each = var.maintenance_exclusions
230231
content {
231232
exclusion_name = maintenance_exclusion.value.name
232233
start_time = maintenance_exclusion.value.start_time
233234
end_time = maintenance_exclusion.value.end_time
235+
236+
exclusion_options {
237+
exclusion_scope = maintenance_exclusion.value.exclusion_options == null ? "NO_UPGRADES" : maintenance_exclusion.value.exclusion_options
238+
}
234239
}
235240
}
236241
}

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

Lines changed: 1 addition & 1 deletion
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

Lines changed: 1 addition & 1 deletion
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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -225,12 +225,17 @@ resource "google_container_cluster" "primary" {
225225
}
226226
}
227227

228+
228229
dynamic "maintenance_exclusion" {
229230
for_each = var.maintenance_exclusions
230231
content {
231232
exclusion_name = maintenance_exclusion.value.name
232233
start_time = maintenance_exclusion.value.start_time
233234
end_time = maintenance_exclusion.value.end_time
235+
236+
exclusion_options {
237+
exclusion_scope = maintenance_exclusion.value.exclusion_options == null ? "NO_UPGRADES" : maintenance_exclusion.value.exclusion_options
238+
}
234239
}
235240
}
236241
}

modules/beta-public-cluster/variables.tf

Lines changed: 1 addition & 1 deletion
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
}

0 commit comments

Comments
 (0)