Skip to content

Commit

Permalink
Leaving default node pool for sanbox to decrease provisioning time
Browse files Browse the repository at this point in the history
  • Loading branch information
arueth committed Mar 29, 2024
1 parent cd069f0 commit bbff3bb
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 2 deletions.
3 changes: 3 additions & 0 deletions best-practices/ml-platform/examples/platform/sandbox/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -156,10 +156,13 @@ module "gke" {

cluster_name = format("%s-%s", var.cluster_name, var.environment_name)
env = var.environment_name
initial_node_count = 1
machine_type = "n2-standard-8"
master_auth_networks_ipcidr = var.subnet_01_ip
network = module.create-vpc.vpc
project_id = data.google_project.environment.project_id
region = var.subnet_01_region
remove_default_node_pool = false
subnet = module.create-vpc.subnet-1
zone = "${var.subnet_01_region}-a"
}
Expand Down
6 changes: 4 additions & 2 deletions best-practices/ml-platform/terraform/modules/cluster/gke.tf
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,13 @@ resource "google_container_cluster" "mlp" {

deletion_protection = false
enable_shielded_nodes = true
initial_node_count = 1
initial_node_count = var.initial_node_count
location = var.region
name = var.cluster_name
network = var.network
node_locations = ["${var.region}-a", "${var.region}-b", "${var.region}-c"]
project = var.project_id
remove_default_node_pool = true
remove_default_node_pool = var.remove_default_node_pool
subnetwork = var.subnet

addons_config {
Expand Down Expand Up @@ -165,6 +165,8 @@ resource "google_container_cluster" "mlp" {
}

node_config {
machine_type = var.machine_type

shielded_instance_config {
enable_integrity_monitoring = true
enable_secure_boot = true
Expand Down
18 changes: 18 additions & 0 deletions best-practices/ml-platform/terraform/modules/cluster/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,18 @@ variable "env" {
type = string
}

variable "initial_node_count" {
default = 1
description = "The number of nodes to create in this cluster's default node pool. In regional or multi-zonal clusters, this is the number of nodes per zone. Must be set if node_pool is not set. If you're using google_container_node_pool objects with no default node pool, you'll need to set this to a value of at least 1, alongside setting remove_default_node_pool to true."
type = number
}

variable "machine_type" {
default = "e2-medium"
description = "The name of a Google Compute Engine machine type."
type = string
}

variable "master_auth_networks_ipcidr" {
description = "master authorized network"
type = string
Expand All @@ -45,6 +57,12 @@ variable "region" {
type = string
}

variable "remove_default_node_pool" {
default = true
description = "If true, deletes the default node pool upon cluster creation. If you're using google_container_node_pool resources with no default node pool, this should be set to true, alongside setting initial_node_count to at least 1."
type = bool
}

variable "subnet" {
description = "subnetwork where the cluster will be created"
type = string
Expand Down

0 comments on commit bbff3bb

Please sign in to comment.