diff --git a/workflow-guides/smcn/genai-inference-at-the-edge/terraform/managed_k8s.tf b/workflow-guides/smcn/genai-inference-at-the-edge/terraform/managed_k8s.tf index 0d19a69e0..4bb63e373 100644 --- a/workflow-guides/smcn/genai-inference-at-the-edge/terraform/managed_k8s.tf +++ b/workflow-guides/smcn/genai-inference-at-the-edge/terraform/managed_k8s.tf @@ -1,5 +1,5 @@ resource "volterra_k8s_cluster" "mk8s" { - name = format("%s-xcop", var.project_prefix) + name = format("%s-mk8s", var.project_prefix) namespace = "system" use_default_cluster_role_bindings = true use_default_cluster_roles = true diff --git a/workflow-guides/smcn/genai-inference-at-the-edge/terraform/outputs.tf b/workflow-guides/smcn/genai-inference-at-the-edge/terraform/outputs.tf index 742854a60..71ccc7c7d 100644 --- a/workflow-guides/smcn/genai-inference-at-the-edge/terraform/outputs.tf +++ b/workflow-guides/smcn/genai-inference-at-the-edge/terraform/outputs.tf @@ -1,6 +1,6 @@ -#output "xc_lb_name" { -# value = nonsensitive(volterra_http_loadbalancer.lb_https.name) -#} +output "xc_lb_name" { + value = nonsensitive(volterra_http_loadbalancer.lb_https.name) +} output "endpoint" { value = var.app_domain diff --git a/workflow-guides/smcn/genai-inference-at-the-edge/terraform/versions.tf b/workflow-guides/smcn/genai-inference-at-the-edge/terraform/versions.tf index 394dafc1a..a8c20c05d 100644 --- a/workflow-guides/smcn/genai-inference-at-the-edge/terraform/versions.tf +++ b/workflow-guides/smcn/genai-inference-at-the-edge/terraform/versions.tf @@ -5,9 +5,5 @@ terraform { source = "volterraedge/volterra" version = ">= 0.11.34" } - azurerm = { - source = "hashicorp/azurerm" - version = ">=3.18.0" - } } } diff --git a/workflow-guides/smcn/genai-inference-at-the-edge/terraform/xc_loadbalancer.tf b/workflow-guides/smcn/genai-inference-at-the-edge/terraform/xc_loadbalancer.tf new file mode 100644 index 000000000..2f3f9d0e4 --- /dev/null +++ b/workflow-guides/smcn/genai-inference-at-the-edge/terraform/xc_loadbalancer.tf @@ -0,0 +1,79 @@ +# Wait for appstack CE site creation +resource "null_resource" "wait_for_aws_ce_site"{ + count = var.user_site ? 1 : 0 + depends_on = [volterra_tf_params_action.apply_aws_vpc] +} + +# Create XC LB config +resource "volterra_origin_pool" "op" { + depends_on = [null_resource.wait_for_aws_ce_site] + name = format("%s-xcop", var.project_prefix) + namespace = var.xc_namespace + description = format("Origin pool pointing to origin server for %s", var.project_prefix) + + dynamic "origin_servers" { + for_each = var.k8s_pool ? [1] : [] + content { + k8s_service { + service_name = var.serviceName + vk8s_networks = true + outside_network = true + site_locator { + site { + name = var.site_name + namespace = "system" + tenant = var.xc_tenant + } + } + } + } + } + + no_tls = true + port = var.serviceport + endpoint_selection = "LOCAL_PREFERRED" + loadbalancer_algorithm = "LB_OVERRIDE" +} + +resource "volterra_http_loadbalancer" "lb_https" { + depends_on = [volterra_origin_pool.op] + name = format("%s-xclb", var.project_prefix) + namespace = var.xc_namespace + description = format("HTTP loadbalancer object for %s origin server", var.project_prefix) + domains = [var.app_domain] + advertise_on_public_default_vip = true + + dynamic "https_auto_cert" { + for_each = var.http_only ? [] : [1] + content { + add_hsts = false + http_redirect = true + no_mtls = true + enable_path_normalize = true + tls_config { + default_security = true + } + } + } + + default_route_pools { + pool { + name = volterra_origin_pool.op.name + namespace = var.xc_namespace + } + weight = 1 +} + + disable_waf = false + round_robin = true + service_policies_from_namespace = true + user_id_client_ip = true + source_ip_stickiness = true + + dynamic "more_option" { + for_each = var.k8s_pool ? [1] : [] + content { + idle_timeout = 600000 + } + } +}