|
| 1 | +/** |
| 2 | +* Copyright 2024 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 | + |
| 19 | + # DWS Flex currently require project allowlisting, please follow steps from here |
| 20 | + # https://cloud.google.com/kubernetes-engine/docs/concepts/dws |
| 21 | +resource "google_container_cluster" "default" { |
| 22 | + name = "gke-standard-zonal-flex-cluster" |
| 23 | + location = "us-central1-a" |
| 24 | + initial_node_count = 1 |
| 25 | + |
| 26 | + node_config { |
| 27 | + machine_type = "e2-medium" |
| 28 | + } |
| 29 | +} |
| 30 | +# [END gke_standard_zonal_dws_flex_cluster] |
| 31 | + |
| 32 | + |
| 33 | +# [START gke_standard_zonal_dws_non_q_flex] |
| 34 | +resource "google_container_node_pool" "dws_non_q_flex" { |
| 35 | + provider = google-beta |
| 36 | + name = "gke-standard-zonal-dws-non-q-flex" |
| 37 | + cluster = google_container_cluster.default.name |
| 38 | + location = google_container_cluster.default.location |
| 39 | + |
| 40 | + initial_node_count = 0 |
| 41 | + autoscaling { |
| 42 | + total_min_node_count = 0 |
| 43 | + total_max_node_count = 1 |
| 44 | + } |
| 45 | + |
| 46 | + # More details on usage https://cloud.google.com/kubernetes-engine/docs/how-to/dws-flex-start-training |
| 47 | + node_config { |
| 48 | + machine_type = "e2-medium" |
| 49 | + flex_start = true |
| 50 | + |
| 51 | + reservation_affinity { |
| 52 | + consume_reservation_type = "NO_RESERVATION" |
| 53 | + } |
| 54 | + } |
| 55 | +} |
| 56 | +# [END gke_standard_zonal_dws_non_q_flex] |
0 commit comments