|
| 1 | +locals { |
| 2 | + feast_postgres_secret_name = "${var.name_prefix}-postgres-secret" |
| 3 | + feast_helm_values = { |
| 4 | + redis = { |
| 5 | + enabled = false |
| 6 | + } |
| 7 | + |
| 8 | + kafka = { |
| 9 | + enabled = true |
| 10 | + externalAccess = { |
| 11 | + enabled = true |
| 12 | + service = { |
| 13 | + types = "LoadBalancer" |
| 14 | + port = 9094 |
| 15 | + loadBalancerIPs = [google_compute_address.kafka_broker.address] |
| 16 | + loadBalancerSourceRanges = ["10.0.0.0/8"] |
| 17 | + annotations = { |
| 18 | + "cloud.google.com/load-balancer-type" = "Internal" |
| 19 | + } |
| 20 | + } |
| 21 | + } |
| 22 | + } |
| 23 | + |
| 24 | + grafana = { |
| 25 | + enabled = false |
| 26 | + } |
| 27 | + |
| 28 | + |
| 29 | + postgresql = { |
| 30 | + existingSecret = local.feast_postgres_secret_name |
| 31 | + } |
| 32 | + |
| 33 | + feast-core = { |
| 34 | + postgresql = { |
| 35 | + existingSecret = local.feast_postgres_secret_name |
| 36 | + } |
| 37 | + } |
| 38 | + |
| 39 | + feast-online-serving = { |
| 40 | + enabled = true |
| 41 | + "application-override.yaml" = { |
| 42 | + feast = { |
| 43 | + core-host = "${var.name_prefix}-feast-core" |
| 44 | + core-grpc-port = 6565 |
| 45 | + active_store = "online_store" |
| 46 | + stores = [ |
| 47 | + { |
| 48 | + name = "online_store" |
| 49 | + type = "REDIS" |
| 50 | + config = { |
| 51 | + host = google_redis_instance.online_store.host |
| 52 | + port = 6379 |
| 53 | + subscriptions = [ |
| 54 | + { |
| 55 | + name = "*" |
| 56 | + project = "*" |
| 57 | + } |
| 58 | + ] |
| 59 | + } |
| 60 | + } |
| 61 | + ] |
| 62 | + } |
| 63 | + } |
| 64 | + } |
| 65 | + |
| 66 | + feast-jupyter = { |
| 67 | + enabled = true |
| 68 | + envOverrides = { |
| 69 | + feast_redis_host = google_redis_instance.online_store.host, |
| 70 | + feast_redis_port = 6379, |
| 71 | + feast_spark_launcher = "dataproc" |
| 72 | + feast_dataproc_cluster_name = google_dataproc_cluster.feast_dataproc_cluster.name |
| 73 | + feast_dataproc_project = var.gcp_project_name |
| 74 | + feast_dataproc_region = var.region |
| 75 | + feast_spark_staging_location = "gs://${var.dataproc_staging_bucket}/artifacts/" |
| 76 | + feast_historical_feature_output_location : "gs://${var.dataproc_staging_bucket}/out/" |
| 77 | + feast_historical_feature_output_format : "parquet" |
| 78 | + demo_kafka_brokers : "${google_compute_address.kafka_broker.address}:9094" |
| 79 | + demo_data_location : "gs://${var.dataproc_staging_bucket}/test-data/" |
| 80 | + } |
| 81 | + gcpServiceAccount = { |
| 82 | + enabled = true |
| 83 | + name = var.feast_sa_secret_name |
| 84 | + key = "credentials.json" |
| 85 | + } |
| 86 | + } |
| 87 | + } |
| 88 | +} |
| 89 | + |
| 90 | +resource "random_password" "feast-postgres-password" { |
| 91 | + length = 16 |
| 92 | + special = false |
| 93 | +} |
| 94 | + |
| 95 | +resource "kubernetes_secret" "feast-postgres-secret" { |
| 96 | + metadata { |
| 97 | + name = local.feast_postgres_secret_name |
| 98 | + } |
| 99 | + data = { |
| 100 | + postgresql-password = random_password.feast-postgres-password.result |
| 101 | + } |
| 102 | +} |
| 103 | + |
| 104 | +resource "google_compute_address" "kafka_broker" { |
| 105 | + project = var.gcp_project_name |
| 106 | + region = var.region |
| 107 | + subnetwork = var.subnetwork |
| 108 | + name = "${var.name_prefix}-kafka" |
| 109 | + address_type = "INTERNAL" |
| 110 | +} |
| 111 | + |
| 112 | +resource "helm_release" "feast" { |
| 113 | + depends_on = [kubernetes_secret.feast-postgres-secret, kubernetes_secret.feast_sa_secret] |
| 114 | + |
| 115 | + name = var.name_prefix |
| 116 | + chart = "../../charts/feast" |
| 117 | + |
| 118 | + values = [ |
| 119 | + yamlencode(local.feast_helm_values) |
| 120 | + ] |
| 121 | +} |
0 commit comments