Skip to content

Commit

Permalink
Cleanup old code from templates
Browse files Browse the repository at this point in the history
  • Loading branch information
JMGaljaard committed Sep 4, 2022
1 parent ddd9c4d commit 376b9f0
Show file tree
Hide file tree
Showing 7 changed files with 60 additions and 75 deletions.
99 changes: 51 additions & 48 deletions jupyter/terraform-gke/main.tf
Original file line number Diff line number Diff line change
@@ -1,64 +1,67 @@
# google_client_config and kubernetes provider must be explicitly specified like the following.
locals {
terraform_service_account = "${var.account_id}@${var.project_id}.iam.gserviceaccount.com"
}

data "google_client_config" "default" {}

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"]
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
source = "terraform-google-modules/kubernetes-engine/google"
project_id = var.project_id
name = var.cluster_name
region = "us-central1"
zones = ["us-central1-c"]
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
filestore_csi_driver = false
service_account = "${var.account_id}@${var.project_id}.iam.gserviceaccount.com"
service_account = local.terraform_service_account
create_service_account = false
kubernetes_version = var.kubernetes_version
node_pools = [
node_pools = [
{
name = "default-node-pool"
machine_type = "e2-medium"
node_locations = "us-central1-c"
auto_scaling = false
min_count = 0
max_count = 1
local_ssd_count = 0
spot = false
disk_size_gb = 64
disk_type = "pd-standard"
image_type = "COS_CONTAINERD"
enable_gcfs = false
enable_gvnic = false
auto_repair = true
auto_upgrade = true
service_account = "${var.account_id}@${var.project_id}.iam.gserviceaccount.com"
preemptible = false
initial_node_count = 1
name = "default-node-pool"
machine_type = "e2-medium"
node_locations = "us-central1-c"
auto_scaling = false
min_count = 0
max_count = 1
local_ssd_count = 0
spot = false
disk_size_gb = 64
disk_type = "pd-standard"
image_type = "COS_CONTAINERD"
enable_gcfs = false
enable_gvnic = false
auto_repair = true
auto_upgrade = true
service_account = local.terraform_service_account
preemptible = false
initial_node_count = 1
},
{
name = "medium-fltk-pool-1"
machine_type = "e2-medium"
node_locations = "us-central1-c"
auto_scaling = false
min_count = 0
max_count = 1
local_ssd_count = 0
spot = false
disk_size_gb = 64
disk_type = "pd-standard"
image_type = "COS_CONTAINERD"
enable_gcfs = false
enable_gvnic = false
auto_repair = true
auto_upgrade = true
service_account = "${var.account_id}@${var.project_id}.iam.gserviceaccount.com"
preemptible = false
initial_node_count = 0
name = "medium-fltk-pool-1"
machine_type = "e2-medium"
node_locations = "us-central1-c"
auto_scaling = false
min_count = 0
max_count = 1
local_ssd_count = 0
spot = false
disk_size_gb = 64
disk_type = "pd-standard"
image_type = "COS_CONTAINERD"
enable_gcfs = false
enable_gvnic = false
auto_repair = true
auto_upgrade = true
service_account = local.terraform_service_account
preemptible = false
initial_node_count = 0
},
]

Expand Down
3 changes: 1 addition & 2 deletions jupyter/terraform-gke/network.tf
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@


module "gcp-network" {
source = "terraform-google-modules/network/google"
version = ">= 4.0.1, < 5.0.0"
Expand Down Expand Up @@ -35,4 +34,4 @@ data "google_compute_subnetwork" "subnetwork" {
project = var.project_id
region = var.project_region
depends_on = [module.gcp-network]
}
}
8 changes: 4 additions & 4 deletions jupyter/terraform-gke/providers.tf
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,13 @@ data "google_service_account_access_token" "default" {
}

provider "google" {
project = var.project_id
access_token = data.google_service_account_access_token.default.access_token
project = var.project_id
access_token = data.google_service_account_access_token.default.access_token
request_timeout = "60s"
}

provider "google-beta" {
project = var.project_id
access_token = data.google_service_account_access_token.default.access_token
project = var.project_id
access_token = data.google_service_account_access_token.default.access_token
request_timeout = "60s"
}
2 changes: 2 additions & 0 deletions jupyter/terraform-gke/variables.tf
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@

variable "kubernetes_version" {
description = "Kubernetes version to use, note that kubeflow depends on version pre-1.22 for deployment as of now."
default = "1.21"
Expand All @@ -23,6 +24,7 @@ variable "project_region" {

variable "description" {
type = string
description = "Service account description"
default = "Managed by terraform FLTK testbed deployment"
}

Expand Down
20 changes: 2 additions & 18 deletions jupyter/terraform-kubeflow/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -6,28 +6,12 @@ data "google_container_cluster" "testbed_cluster" {
location = var.project_region
}

# Setup kubeflow with kubeflow "kustomization" provided by WOGRA-AG
#module "kubeflow" {
# source = "WOGRA-AG/kubeflow/kustomization"
#
# dex_user_email = "[email protected]"
#
# # Disable 'production' features of Kubeflow. Change if need, e.g. "serving" for inference.
# deploy_notebooks = false
# deploy_dashboard = false
# deploy_katib = false
# deploy_tensorboard = false
# deploy_volumes = false
# deploy_serving = false
#}


data "kustomization_build" "training-operator" {
path = "github.com/kubeflow/manifests.git/apps/training-operator/upstream/overlays/standalone?ref=${var.kubeflow_version}"
}

resource "kustomization_resource" "training-operator" {

for_each = data.kustomization_build.training-operator.ids
manifest = data.kustomization_build.training-operator.manifests[each.value]

}
}
2 changes: 0 additions & 2 deletions jupyter/terraform-kubeflow/providers.tf
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,6 @@ provider "kubectl" {
config_path = var.kubernetes_config_path
}


# Use GCP to get kubernetes configuration. However, we should aim to use the service account a bit more cleanly...
provider "kubernetes" {
host = "https://${data.google_container_cluster.testbed_cluster.endpoint}"
token = data.google_client_config.provider.access_token # Provided by Google data object
Expand Down
1 change: 0 additions & 1 deletion jupyter/terraform-kubeflow/versions.tf
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,5 @@ terraform {
version = ">= 1.13.1"
}
}

required_version = "~> 1.1"
}

0 comments on commit 376b9f0

Please sign in to comment.