-
Notifications
You must be signed in to change notification settings - Fork 139
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
323 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
resource "helm_release" "helm_chart" { | ||
chart = "kiali-operator" | ||
namespace = var.namespace | ||
create_namespace = "true" | ||
name = var.chart_name | ||
version = var.helm_version | ||
verify = var.verify | ||
repository = "https://kiali.org/helm-charts" | ||
|
||
values = [ | ||
file("${path.module}/values.yaml"), | ||
var.helm_values, | ||
] | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
# CR spec: https://kiali.io/docs/configuration/kialis.kiali.io/ | ||
cr: | ||
create: true | ||
namespace: istio-system | ||
|
||
# Kiali operator CRD spec/config | ||
# the CRD kind is "Kiali" | ||
spec: | ||
auth: | ||
strategy: anonymous | ||
|
||
external_services: | ||
prometheus: | ||
# Prometheus service name is "metrics" and is in the "telemetry" namespace | ||
url: "http://prometheus-operated.monitoring.svc:9090/" | ||
|
||
deployment: | ||
ingress: | ||
# default: additional_labels is empty | ||
additional_labels: | ||
ingressAdditionalLabel: "ingressAdditionalLabelValue" | ||
class_name: "istio" | ||
# default: enabled is undefined | ||
enabled: true | ||
# default: override_yaml is undefined | ||
override_yaml: | ||
metadata: | ||
annotations: | ||
kubernetes.io/ingress.class: istio | ||
spec: | ||
rules: | ||
- host: "kiali.kubernetes-ops.com" | ||
http: | ||
paths: | ||
- path: "/kiali" | ||
pathType: Prefix | ||
backend: | ||
service: | ||
name: kiali | ||
port: | ||
number: 20001 | ||
tls: | ||
- hosts: | ||
- "kiali.kubernetes-ops.com" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
variable helm_version { | ||
type = string | ||
default = "1.47.0" | ||
description = "Helm chart version" | ||
} | ||
|
||
variable verify { | ||
type = bool | ||
default = false | ||
description = "Verify the helm download" | ||
} | ||
|
||
variable namespace { | ||
type = string | ||
default = "kiali-operator" | ||
description = "Namespace to install in" | ||
} | ||
|
||
variable chart_name { | ||
type = string | ||
default = "kiali-operator" | ||
description = "Name to set the helm deployment to" | ||
} | ||
|
||
variable helm_values { | ||
type = string | ||
default = "" | ||
description = "Additional helm values to pass in. These values would override the default in this module." | ||
} |
81 changes: 81 additions & 0 deletions
81
terraform-modules/aws/helm/kube-prometheus-stack/README.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,84 @@ | ||
# helm chart - kube-prometheus-stack | ||
|
||
Chart source: https://github.com/prometheus-community/helm-charts/tree/main/charts/kube-prometheus-stack | ||
|
||
## AlertManager Receiver configuration | ||
You can use the helm `values.yaml` file to configure the AlertManager's configs. One problem with this | ||
is that you have to commit the "receiver's" secret into git. For example, like the Slack URL or the | ||
Pager Duty's key. | ||
|
||
An alternative way is to leave these receivers out of the helm `values.yaml` file and create the | ||
AlertManager's CR (custom resource). | ||
|
||
You can use the `../../kubernetes/menifest` module to apply arbitrary Kubernetes yamls to the cluster. | ||
|
||
You can create the `AlertmanagerConfig` CR to send alerts to slack: | ||
``` | ||
# example: https://github.com/prometheus-operator/prometheus-operator/blob/main/Documentation/user-guides/alerting.md#alertmanagerconfig-resource | ||
# API doc: | ||
# * https://github.com/prometheus-operator/prometheus-operator/blob/main/Documentation/api.md | ||
# * https://prometheus-operator.dev/docs/operator/api/#table-of-contents | ||
apiVersion: monitoring.coreos.com/v1alpha1 | ||
kind: AlertmanagerConfig | ||
metadata: | ||
name: alert-config | ||
namespace: monitoring | ||
labels: | ||
# This label has to match the `alertmanagerConfigSelector` config on what that is set to | ||
release: kube-prometheus-stack | ||
spec: | ||
# doc: https://prometheus.io/docs/alerting/latest/configuration/#route | ||
route: | ||
groupBy: ['job', 'severity'] | ||
groupWait: 30s | ||
groupInterval: 5m | ||
repeatInterval: 12h | ||
receiver: 'slack-${account_name}' | ||
matchers: | ||
## Label to match. | ||
- name: severity | ||
## Label value to match. | ||
value: critical | ||
## Match type: !=, =, =~, !~ | ||
## Match operation available with AlertManager >= v0.22.0 and takes precedence over Regex (deprecated) if non-empty. | ||
# matchType: "=" | ||
## true | False - deprecated | ||
# regex: false | ||
receivers: | ||
# https://github.com/prometheus-operator/prometheus-operator/blob/main/Documentation/api.md#slackconfig | ||
- name: 'slack-${account_name}' | ||
slackConfigs: | ||
- apiURL: | ||
# A kubernetes secret | ||
name: 'slack-key' | ||
key: 'key' | ||
sendResolved: true | ||
channel: ${channel_name} | ||
username: prom-${account_name} | ||
title: '{{ if ne .Status "firing" }}[{{ .Status | toUpper }}]{{ end }} {{ .CommonAnnotations.summary }}{{ .CommonAnnotations.message }}' | ||
titleLink: https://alertmanager.${domain_name} | ||
text: |- | ||
{{ range .Alerts }} | ||
Annotations: | ||
{{ range $key, $value := .Annotations }} - {{ $key }}: {{ $value }} | ||
{{ end }} | ||
Details: | ||
{{ range .Labels.SortedPairs }} - {{ .Name }} = {{ .Value }} | ||
{{ end }} | ||
{{ end }} | ||
# # Kubernetes Secret format | ||
# --- | ||
# apiVersion: v1 | ||
# kind: Secret | ||
# type: Opaque | ||
# metadata: | ||
# name: slack-key | ||
# namespace: monitoring | ||
# data: | ||
# key: <base64 encoded Slack URL> | ||
``` | ||
|
||
You can then place the secret into AWS Secrets and use the `../../external-secrets` module to | ||
sync the secret for this CR to use. By going this route (which is way more work), you don't | ||
have to commit the secret into git. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
resource "kubernetes_manifest" "manifest" { | ||
manifest = yamldecode(var.manifest) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
variable "manifest" { | ||
type = string | ||
default = <<EOT | ||
apiVersion: v1 | ||
kind: ConfigMap | ||
metadata: | ||
name: game-demo | ||
namespace: foobar | ||
data: | ||
# property-like keys; each key maps to a simple value | ||
player_initial_lives: "3" | ||
EOT | ||
description = "The yaml Kubernetes manifest to apply. Can input via inline or from a file." | ||
} |