Skip to content

Feature gatekeeper #10

Merged
merged 7 commits into from
Apr 17, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# tfmod-kiali

Kiali is a web console for the Istio Service Mesh. It is analogous to how the Kubernetes Dashboard is a web console for Kubernetes, ie. it is a web interface for viewing configurations and operations of the system. Additionally, the same as the Kubernetes Dashboard, we deploy Kiali in a read-only manner, given mesh objects should only be configured through code and pipelines, not modification through web or command line. Kiali provides a useful tool for reviewing configurations and topology, observing mesh health and performance, and tracing along with its associated details. Additional details about Kiali can be reviewed at the [Kiali website](https://kiali.io/).

This module deploys and configures Kiali via its operator and integrates it with Istio and the other telemetry oriented tools of the cluster.

<!-- BEGIN_TF_DOCS -->
## Requirements

Expand Down
19 changes: 9 additions & 10 deletions kiali-operator/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,20 +1,19 @@
apiVersion: v2
appVersion: v2.7.1
description: Kiali is an open source project for service mesh observability, refer
to https://www.kiali.io for details.
name: kiali-operator
description: Kiali is an open source project for service mesh observability, refer to https://www.kiali.io for details.
version: 0.0.0
appVersion: 0.0.0
home: https://github.com/kiali/kiali-operator
icon: https://raw.githubusercontent.com/kiali/kiali.io/current/assets/icons/logo.svg
maintainers:
- name: Kiali
email: kiali-users@googlegroups.com
url: https://kiali.io
keywords:
- istio
- kiali
- operator
maintainers:
- email: kiali-users@googlegroups.com
name: Kiali
url: https://kiali.io
name: kiali-operator
sources:
- https://github.com/kiali/kiali
- https://github.com/kiali/kiali-operator
- https://github.com/kiali/helm-charts
version: 2.7.1
icon: https://raw.githubusercontent.com/kiali/kiali.io/current/assets/icons/logo.svg
11 changes: 0 additions & 11 deletions kiali-operator/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -51,14 +51,3 @@ Selector labels
app.kubernetes.io/name: {{ include "kiali.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end }}

{{/*
Create the name of the service account to use
*/}}
{{- define "kiali.serviceAccountName" -}}
{{- if .Values.serviceAccount.create }}
{{- default (include "kiali.fullname" .) .Values.serviceAccount.name }}
{{- else }}
{{- default "default" .Values.serviceAccount.name }}
{{- end }}
{{- end }}
62 changes: 62 additions & 0 deletions kiali-server/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
{{/*
Expand the name of the chart.
*/}}
{{- define "kiali.name" -}}
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }}
{{- end }}

{{/*
Create a default fully qualified app name.
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
If release name contains chart name it will be used as a full name.
*/}}
{{- define "kiali.fullname" -}}
{{- if .Values.fullnameOverride }}
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }}
{{- else }}
{{- $name := default .Chart.Name .Values.nameOverride }}
{{- if contains $name .Release.Name }}
{{- .Release.Name | trunc 63 | trimSuffix "-" }}
{{- else }}
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }}
{{- end }}
{{- end }}
{{- end }}

{{/*
Create chart name and version as used by the chart label.
*/}}
{{- define "kiali.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
{{- end }}

{{/*
Common labels
*/}}
{{- define "kiali.labels" -}}
helm.sh/chart: {{ include "kiali.chart" . }}
{{ include "kiali.selectorLabels" . }}
{{- if .Chart.AppVersion }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
{{- end }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- end }}

{{/*
Selector labels
*/}}
{{- define "kiali.selectorLabels" -}}
app.kubernetes.io/name: {{ include "kiali.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end }}

{{/*
Create the name of the service account to use
*/}}
{{- define "kiali.serviceAccountName" -}}
{{- if .Values.serviceAccount.create }}
{{- default (include "kiali.fullname" .) .Values.serviceAccount.name }}
{{- else }}
{{- default "default" .Values.serviceAccount.name }}
{{- end }}
{{- end }}
2 changes: 1 addition & 1 deletion kiali-server/templates/kiali.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,5 +34,5 @@ spec:
provider: "tempo"
tempo_config:
org_id: "1"
datasource_uid: "fedkp0zap3uv4d"
datasource_uid: {{ .Values.tracing.tempo_config.datasource_uid }}
url_format: "grafana"
12 changes: 6 additions & 6 deletions kiali-server/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,17 +19,17 @@ grafana:
auth:
type: basic
username: "admin"
secretName:
passwordKey:
externalUrl:
internalUrl:
secretName:
passwordKey:
externalUrl:
internalUrl:

tracing:
enabled: true
internalUrl:
internalUrl:
use_grpc: false
provider: "tempo"
tempo_config:
org_id: "1"
datasource_uid:
datasource_uid:
url_format: "grafana"
18 changes: 10 additions & 8 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,17 @@ 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" {
depends_on = [module.images]
chart = "kiali-operator"

chart = "./kiali-operator"
version = var.kiali_operator_version
name = "kiali-operator"
namespace = var.namespace
repository = "./"

set {
name = "image.repo"
Expand Down Expand Up @@ -58,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 All @@ -75,9 +77,9 @@ resource "helm_release" "kiali" {
helm_release.kiali_operator,
]

chart = "./kiali-server"
name = "kiali"
namespace = var.namespace
chart = "./kiali-server"
name = "kiali"
namespace = var.namespace

set {
name = "auth.strategy"
Expand All @@ -97,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