Skip to content

Commit

Permalink
Add a data & scratch GCS bucket
Browse files Browse the repository at this point in the history
- Data bucket for storing per-hub data products
- Scratch bucket for *per-user* data stuff
  • Loading branch information
yuvipanda committed Jun 3, 2021
1 parent 6cbef58 commit 83f5a65
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 0 deletions.
3 changes: 3 additions & 0 deletions config/hubs/meom-ige.cluster.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@ hubs:
name: SWOT Ocean Pangeo Team
url: https://meom-group.github.io/
singleuser:
extraEnv:
DATA_BUCKET: gcs://meom-ige-data
SCRATCH_BUCKET: 'gcs://meom-ige-scratch/$(JUPYTERHUB_USER)'
profileList:
# The mem-guarantees are here so k8s doesn't schedule other pods
# on these nodes. They need to be just under total allocatable
Expand Down
18 changes: 18 additions & 0 deletions terraform/buckets.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
/**
* GCS buckets for use by hub users
*/

resource "google_storage_bucket" "user_buckets" {
for_each = var.user_buckets
name = "${var.prefix}-${each.key}"
location = var.region
project = var.project_id
}

resource "google_storage_bucket_iam_member" "member" {

for_each = var.user_buckets
bucket = google_storage_bucket.user_buckets[each.key].name
role = "roles/storage.admin"
member = "serviceAccount:${google_service_account.cluster_sa.email}"
}
5 changes: 5 additions & 0 deletions terraform/projects/meom-ige.tfvars
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,8 @@ notebook_nodes = {
machine_type : "e2-standard-32"
}
}

user_buckets = [
"scratch",
"data"
]
6 changes: 6 additions & 0 deletions terraform/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -84,3 +84,9 @@ variable "enable_network_policy" {
default = true
description = "Enable kubernetes network policy for access to fine-grained firewall rules"
}

variable "user_buckets" {
type = set(any)
default = []
description = "Buckets to create for the project, they will be prefixed with {var.prefix}-"
}

0 comments on commit 83f5a65

Please sign in to comment.