Skip to content

Commit 451d57c

Browse files
raushan2016apeabody
authored andcommitted
feat(gke): add sample for flex reservation (terraform-google-modules#849)
* Adding sample for flex reservation * Fix spacing * Add provider as google-beta * formatting * Moving to separate folder and adding test skip file * fmt * Update gke/standard/zonal/dws/main.tf Co-authored-by: Andrew Peabody <[email protected]> * fmt * Validated change --------- Co-authored-by: Andrew Peabody <[email protected]>
1 parent f310ac3 commit 451d57c

File tree

2 files changed

+82
-0
lines changed

2 files changed

+82
-0
lines changed

gke/standard/zonal/dws/main.tf

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
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+
# [START gke_standard_zonal_dws_flex_cluster]
18+
# DWS Flex currently require project allowlisting, please follow steps from here
19+
# https://cloud.google.com/kubernetes-engine/docs/concepts/dws
20+
resource "google_container_cluster" "default" {
21+
name = "gke-standard-zonal-flex-cluster"
22+
location = "us-central1-a"
23+
initial_node_count = 1
24+
min_master_version = "1.32.2-gke.1652000"
25+
release_channel {
26+
# To use flex-start in GKE, your cluster must use version 1.32.2-gke.1652000 or later.
27+
channel = "RAPID"
28+
}
29+
node_config {
30+
machine_type = "e2-medium"
31+
}
32+
}
33+
# [END gke_standard_zonal_dws_flex_cluster]
34+
35+
# [START gke_standard_zonal_dws_non_q_flex]
36+
resource "google_container_node_pool" "default" {
37+
provider = google-beta
38+
name = "gke-standard-zonal-dws-non-q-flex"
39+
cluster = google_container_cluster.default.name
40+
location = google_container_cluster.default.location
41+
42+
autoscaling {
43+
total_min_node_count = 0
44+
total_max_node_count = 1
45+
}
46+
47+
queued_provisioning {
48+
enabled = false
49+
}
50+
51+
# More details on usage https://cloud.google.com/kubernetes-engine/docs/how-to/dws-flex-start-training
52+
node_config {
53+
machine_type = "a3-highgpu-8g"
54+
flex_start = true
55+
56+
reservation_affinity {
57+
consume_reservation_type = "NO_RESERVATION"
58+
}
59+
}
60+
}
61+
# [END gke_standard_zonal_dws_non_q_flex]

gke/standard/zonal/dws/test.yaml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Copyright 2025 Google LLC
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
# DWS Flex is currently behind project allowlist. https://cloud.google.com/kubernetes-engine/docs/concepts/dws#methods
16+
apiVersion: blueprints.cloud.google.com/v1alpha1
17+
kind: BlueprintTest
18+
metadata:
19+
name: gke_standard_zonal_dws
20+
spec:
21+
skip: true

0 commit comments

Comments
 (0)