Skip to content

Commit 2768856

Browse files
apeabodyniharika-98
authored andcommitted
fix(gke): update rc example for del_protection (terraform-google-modules#847)
1 parent e577627 commit 2768856

File tree

5 files changed

+238
-200
lines changed

5 files changed

+238
-200
lines changed

gke/standard/zonal/no-channel-to-release-channel/main.tf

Lines changed: 0 additions & 200 deletions
This file was deleted.
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
/**
2+
* Copyright 2025 Google LLC
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
# NOTE: Locations are different in these examples to satisfy the tests.
18+
# These are intended to represent sequential steps on the same cluster.
19+
20+
# [START gke_standard_release_channel_no_minor_or_node_upgrade]
21+
resource "google_container_cluster" "default" {
22+
name = "cluster-zonal-example-none-to-rc"
23+
location = "us-central1-f"
24+
25+
release_channel {
26+
channel = "REGULAR"
27+
}
28+
29+
maintenance_policy {
30+
recurring_window {
31+
start_time = "2025-02-11T19:16:39Z"
32+
end_time = "2025-02-11T23:16:39Z"
33+
recurrence = "FREQ=DAILY"
34+
}
35+
maintenance_exclusion {
36+
exclusion_name = "no_minor_or_node_upgrades_exclusion"
37+
# NOTE: Pick an interval for your exclusion with an end_time in the future
38+
# otherwise the exclusion will have no effect.
39+
# This example assumes that the exclusion is set on 2025-02-11.
40+
start_time = "2025-02-11T23:16:39Z"
41+
# This the end of standard support for 1.31.
42+
end_time = "2025-12-22T00:00:00Z"
43+
exclusion_options {
44+
scope = "NO_MINOR_OR_NODE_UPGRADES"
45+
}
46+
}
47+
}
48+
49+
remove_default_node_pool = true
50+
initial_node_count = 1
51+
}
52+
53+
resource "google_container_node_pool" "default" {
54+
name = "cluster-zonal-example-none-to-rc-np"
55+
cluster = google_container_cluster.default.id
56+
57+
node_count = 2
58+
59+
management {
60+
auto_repair = true
61+
auto_upgrade = true
62+
}
63+
}
64+
# [END gke_standard_release_channel_no_minor_or_node_upgrade]
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
/**
2+
* Copyright 2025 Google LLC
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
# NOTE: Locations are different in these examples to satisfy the tests.
18+
# These are intended to represent sequential steps on the same cluster.
19+
20+
# [START gke_standard_release_channel_no_upgrade]
21+
resource "google_container_cluster" "default" {
22+
name = "cluster-zonal-example-none-to-rc"
23+
location = "us-central1-b"
24+
25+
release_channel {
26+
channel = "UNSPECIFIED"
27+
}
28+
29+
maintenance_policy {
30+
# A recurring window must be set to use maintenance exclusions in Terraform.
31+
recurring_window {
32+
start_time = "2025-02-11T19:16:39Z"
33+
end_time = "2025-02-11T23:16:39Z"
34+
recurrence = "FREQ=DAILY"
35+
}
36+
maintenance_exclusion {
37+
exclusion_name = "no_upgrades_exclusion"
38+
# NOTE: Pick an interval for your exclusion with an end_time in the future
39+
# otherwise the exclusion will have no effect.
40+
# This example assumes that the exclusion is set on 2025-02-11.
41+
start_time = "2025-02-11T23:16:39Z"
42+
# NO_UPGRADES exclusions are limited to 30 days.
43+
end_time = "2025-03-11T23:16:39Z"
44+
exclusion_options {
45+
scope = "NO_UPGRADES"
46+
}
47+
}
48+
}
49+
50+
remove_default_node_pool = true
51+
initial_node_count = 1
52+
}
53+
54+
resource "google_container_node_pool" "default" {
55+
name = "cluster-zonal-example-none-to-rc-np"
56+
cluster = google_container_cluster.default.id
57+
58+
node_count = 2
59+
60+
management {
61+
auto_repair = false
62+
auto_upgrade = false
63+
}
64+
}
65+
# [END gke_standard_release_channel_no_upgrade]
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
/**
2+
* Copyright 2025 Google LLC
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
# NOTE: Locations are different in these examples to satisfy the tests.
18+
# These are intended to represent sequential steps on the same cluster.
19+
20+
# [START gke_standard_release_channel_none]
21+
resource "google_container_cluster" "default" {
22+
name = "cluster-zonal-example-none-to-rc"
23+
location = "us-central1-a"
24+
25+
release_channel {
26+
channel = "UNSPECIFIED"
27+
}
28+
29+
remove_default_node_pool = true
30+
initial_node_count = 1
31+
}
32+
33+
resource "google_container_node_pool" "default" {
34+
name = "cluster-zonal-example-none-to-rc-np"
35+
cluster = google_container_cluster.default.id
36+
37+
node_count = 2
38+
39+
management {
40+
auto_repair = false
41+
auto_upgrade = false
42+
}
43+
}
44+
# [END gke_standard_release_channel_none]

0 commit comments

Comments
 (0)