mirror of https://git.rancher.io/charts
40 lines
1.5 KiB
YAML
40 lines
1.5 KiB
YAML
{{- $valid := list "DEBUG" "INFO" "WARNING" "ERROR" "CRITICAL" -}}
|
|
{{- if not (has .Values.prom2teams.loglevel $valid) -}}
|
|
{{- fail "Invalid log level"}}
|
|
{{- end -}}
|
|
{{- if and .Values.prom2teams.connector (hasKey .Values.prom2teams.connectors "Connector") -}}
|
|
{{- fail "Invalid configuration: prom2teams.connectors can't have a connector named Connector when prom2teams.connector is set"}}
|
|
{{- end -}}
|
|
{{/* Create the configmap when the operation is helm install and the target configmap does not exist. */}}
|
|
{{- if not (lookup "v1" "ConfigMap" (include "prom2teams.namespace" . ) (include "prom2teams.fullname" .)) }}
|
|
apiVersion: v1
|
|
kind: ConfigMap
|
|
metadata:
|
|
namespace: {{ include "prom2teams.namespace" . }}
|
|
name: {{ include "prom2teams.fullname" . }}
|
|
labels: {{ include "prom2teams.labels" . | nindent 4 }}
|
|
annotations:
|
|
"helm.sh/hook": pre-install, pre-upgrade
|
|
"helm.sh/hook-weight": "3"
|
|
"helm.sh/resource-policy": keep
|
|
data:
|
|
config.ini: |-
|
|
[HTTP Server]
|
|
Host: {{ .Values.prom2teams.host }}
|
|
Port: {{ .Values.prom2teams.port }}
|
|
[Microsoft Teams]
|
|
{{- with .Values.prom2teams.connector }}
|
|
Connector: {{ . }}
|
|
{{- end }}
|
|
{{- range $key, $val := .Values.prom2teams.connectors }}
|
|
{{ $key }}: {{ $val }}
|
|
{{- end }}
|
|
[Group Alerts]
|
|
Field: {{ .Values.prom2teams.group_alerts_by }}
|
|
[Log]
|
|
Level: {{ .Values.prom2teams.loglevel }}
|
|
[Template]
|
|
Path: {{ .Values.prom2teams.templatepath }}
|
|
teams.j2: {{ .Files.Get "files/teams.j2" | quote }}
|
|
{{- end -}}
|