Skip to content

Commit

Permalink
Fix grafana external link variable creation
Browse files Browse the repository at this point in the history
  • Loading branch information
mcgin314 committed Apr 17, 2025
1 parent 0659929 commit ae9ac08
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
7 changes: 5 additions & 2 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@ locals {
internal_hostname = format("%v.%v.svc.cluster.local", var.service_name, var.namespace)
internal_port_number = "20001"
internal_url = format("http://%s:%s/", local.internal_hostname, local.internal_port_number)
# This may seem unusual, but we cannot input/pass the grafana ingress url, since kiali is a dependency of gatekeeper
# that creates the ingress (circular dep). So, we build the ingress url here using the same variables as gatekeeper.
grafana_public_url = format("https://%s.%s", var.grafana_service_name, var.cluster_domain)
}

resource "helm_release" "kiali_operator" {
Expand Down Expand Up @@ -57,7 +60,7 @@ resource "helm_release" "kiali_operator" {
}
set {
name = "grafana.externalUrl"
value = var.grafana_public_url
value = local.grafana_public_url
}
set {
name = "grafana.internalUrl"
Expand Down Expand Up @@ -96,7 +99,7 @@ resource "helm_release" "kiali" {
}
set {
name = "grafana.externalUrl"
value = var.grafana_public_url
value = local.grafana_public_url
}
set {
name = "grafana.internalUrl"
Expand Down
9 changes: 5 additions & 4 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,15 @@ variable "grafana_secret_name" {
type = string
}

variable "grafana_public_url" {
description = "The URL incoming traffic from outisde the cluster uses to access grafana."
variable "grafana_internal_url" {
description = "The url within the cluster to use to access grafana."
type = string
}

variable "grafana_internal_url" {
description = "The url within the cluster to use to access grafana."
variable "grafana_service_name" {
description = "The name of the service used for grafana."
type = string
default = "grafana"
}

variable "prometheus_internal_url" {
Expand Down

0 comments on commit ae9ac08

Please sign in to comment.