Skip to content

Commit

Permalink
Switch to using local for security_context
Browse files Browse the repository at this point in the history
  • Loading branch information
bjornsen committed Mar 8, 2024
1 parent dc323d2 commit 1441567
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions modules/kuberay-cluster/kuberay.tf
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ resource "google_storage_bucket_iam_member" "gcs-bucket-iam" {
member = "serviceAccount:${var.google_service_account}@${var.project_id}.iam.gserviceaccount.com"
}

locals {
security_context = chomp(yamlencode({ for k, v in var.security_context : k => v if v != null }))
}

resource "helm_release" "ray-cluster" {
name = "example-cluster"
repository = "https://ray-project.github.io/kuberay-helm/"
Expand All @@ -30,31 +34,31 @@ resource "helm_release" "ray-cluster" {
gcs_bucket = var.gcs_bucket
k8s_service_account = var.google_service_account
grafana_host = var.grafana_host
security_context = chomp(yamlencode({ for k, v in var.security_context : k => v if v != null }))
security_context = local.security_context
secret_name = var.db_secret_name
project_id = var.project_id
db_region = var.db_region
}) : var.enable_tpu ? templatefile("${path.module}/kuberay-tpu-values.yaml", {
gcs_bucket = var.gcs_bucket
k8s_service_account = var.google_service_account
grafana_host = var.grafana_host
security_context = chomp(yamlencode({ for k, v in var.security_context : k => v if v != null }))
security_context = local.security_context
secret_name = var.db_secret_name
project_id = var.project_id
db_region = var.db_region
}) : var.enable_gpu ? templatefile("${path.module}/kuberay-gpu-values.yaml", {
gcs_bucket = var.gcs_bucket
k8s_service_account = var.google_service_account
grafana_host = var.grafana_host
security_context = chomp(yamlencode({ for k, v in var.security_context : k => v if v != null }))
security_context = local.security_context
secret_name = var.db_secret_name
project_id = var.project_id
db_region = var.db_region
}) : templatefile("${path.module}/kuberay-values.yaml", {
gcs_bucket = var.gcs_bucket
k8s_service_account = var.google_service_account
grafana_host = var.grafana_host
security_context = chomp(yamlencode({ for k, v in var.security_context : k => v if v != null }))
security_context = local.security_context
secret_name = var.db_secret_name
project_id = var.project_id
db_region = var.db_region
Expand Down

0 comments on commit 1441567

Please sign in to comment.