Add jupyterhub

This commit is contained in:
Giambattista Bloisi 2024-11-06 14:04:33 +01:00
parent c0788fcd10
commit ac2fbbb9f9
4 changed files with 102 additions and 17 deletions

41
main.tf
View File

@ -1,24 +1,31 @@
module "minio" {
source = "./modules/minio"
kube_context = var.kube_context
namespace_prefix=var.namespace_prefix
buckets = var.minio_buckets
source = "./modules/minio"
kube_context = var.kube_context
namespace_prefix = var.namespace_prefix
buckets = var.minio_buckets
}
module "airflow" {
source = "./modules/airflow"
kube_context = var.kube_context
admin_user = var.admin_user
admin_password = var.admin_password
namespace_prefix= var.namespace_prefix
admin_hash = var.admin_hash
env = var.env
domain = var.domain
s3_endpoint = var.s3_endpoint
s3_key = var.s3_key
s3_secret = var.s3_secret
branch_name = var.dag_branch_name
dag_path= var.dag_path_name
source = "./modules/airflow"
kube_context = var.kube_context
admin_user = var.admin_user
admin_password = var.admin_password
namespace_prefix = var.namespace_prefix
admin_hash = var.admin_hash
env = var.env
domain = var.domain
s3_endpoint = var.s3_endpoint
s3_key = var.s3_key
s3_secret = var.s3_secret
branch_name = var.dag_branch_name
dag_path = var.dag_path_name
}
module "jupyterhub" {
source = "./modules/jupyterhub"
kube_context = var.kube_context
namespace_prefix = var.namespace_prefix
domain = var.domain
}

View File

@ -0,0 +1,44 @@
resource "helm_release" "jupyterhub" {
name = "jupyterhub"
chart = "jupyterhub"
repository = "https://hub.jupyter.org/helm-chart/"
create_namespace = "true"
namespace = "${var.namespace_prefix}spark-jobs"
dependency_update = "true"
version = "3.3.8"
set {
name = "ingress.enabled"
value = "true"
}
set {
name = "ingress.ingressClassName"
value = "nginx"
}
set {
name = "ingress.hosts[0]"
value = "jupyter.${var.domain}"
}
set {
name = "singleuser.image.name"
value = "jupyter/all-spark-notebook"
}
set {
name = "singleuser.image.tag"
value = "spark-3.5.0"
}
set {
name = "singleuser.cmd"
value = "start-notebook.py"
}
set {
name = "singleuser.serviceAccountName"
value = "spark"
}
}

View File

@ -0,0 +1,9 @@
terraform {
required_providers {
helm = {
}
kubernetes = {
}
}
}

View File

@ -0,0 +1,25 @@
variable "env" {
type = string
default = "local"
}
variable "kube_config" {
type = string
default = "~/.kube/config"
}
variable "kube_context" {
type = string
default = "default"
}
variable "namespace_prefix" {
type = string
default = "lot1-"
}
variable "domain" {
type = string
default = "local-dataplatform"
}