Skip to content

Commit

Permalink
Make use of zonal cluster
Browse files Browse the repository at this point in the history
  • Loading branch information
JMGaljaard committed Sep 4, 2022
1 parent 376b9f0 commit 6c07694
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 9 deletions.
Original file line number Diff line number Diff line change
@@ -1,27 +1,28 @@
locals {
terraform_service_account = "${var.account_id}@${var.project_id}.iam.gserviceaccount.com"
}

data "google_client_config" "default" {}

# In case of using a gke deployment, use the GKE provider. Otherwise we create a container cluster.
module "gke" {
source = "terraform-google-modules/kubernetes-engine/google"
project_id = var.project_id
name = var.cluster_name
region = "us-central1"
zones = ["us-central1-c"]
# Create a ZONAL cluster, dissallowing the cluster to span multiple regions in a zone.
# Alternatively, for scheduling cross-regions, utilize `zone` and `regions` instead of `regional` and `region`
regional = false
region = var.project_region
network = module.gcp-network.network_name
subnetwork = module.gcp-network.subnets_names[0]
ip_range_pods = var.ip_range_pods_name
ip_range_services = var.ip_range_services_name

http_load_balancing = false
network_policy = false
horizontal_pod_autoscaling = true
horizontal_pod_autoscaling = false
filestore_csi_driver = false
service_account = local.terraform_service_account
create_service_account = false
kubernetes_version = var.kubernetes_version


node_pools = [
{
name = "default-node-pool"
Expand Down Expand Up @@ -116,4 +117,4 @@ module "gke" {
"fltk-experiment-pool-1",
]
}
}
}
35 changes: 35 additions & 0 deletions jupyter/terraform-gke/outputs.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
output "kubernetes_endpoint" {
description = "The cluster endpoint"
sensitive = true
value = module.gke.endpoint
}

output "ca_certificate" {
description = "The cluster ca certificate (base64 encoded)"
value = module.gke.ca_certificate
}

output "terraform_service_account" {
description = "The default service account used for running nodes (user-provided)"
value = module.gke.service_account
}

output "cluster_identifier" {
description = "Cluster name"
value = module.gke.name
}

output "private_network_identifier" {
description = "The name of the VPC being created (user-provided)"
value = module.gcp-network.network_name
}

output "subnet_identifier" {
description = "The name of the subnet being created (user-provided)"
value = module.gcp-network.subnets_names
}

output "subnet_ranges" {
description = "The secondary ranges associated with the subnet (pods, and services)"
value = module.gcp-network.subnets_secondary_ranges
}
1 change: 0 additions & 1 deletion jupyter/terraform-gke/resources.tf
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# resources.tf

terraform {
required_providers {
Expand Down

0 comments on commit 6c07694

Please sign in to comment.