From 35b90df7600c88436952ec653c70256a9f5a4deb Mon Sep 17 00:00:00 2001 From: WrenIX Date: Wed, 29 Nov 2023 10:32:40 +0100 Subject: [PATCH] fix(alertmanager-matrix): add flow for logging operator --- alertmanager-matrix/Chart.yaml | 4 +-- alertmanager-matrix/README.md | 9 +++-- alertmanager-matrix/templates/_helpers.tpl | 13 +++++++ alertmanager-matrix/templates/flow.yaml | 41 ++++++++++++++++++++++ alertmanager-matrix/values.yaml | 31 ++++++++++------ publish.sh | 2 +- 6 files changed, 85 insertions(+), 15 deletions(-) create mode 100644 alertmanager-matrix/templates/flow.yaml diff --git a/alertmanager-matrix/Chart.yaml b/alertmanager-matrix/Chart.yaml index 8cf061c..7218f48 100644 --- a/alertmanager-matrix/Chart.yaml +++ b/alertmanager-matrix/Chart.yaml @@ -2,8 +2,8 @@ apiVersion: v2 name: alertmanager-matrix description: Service for managing and receiving Alertmanager alerts on Matrix type: application -version: 0.1.3 +version: 0.1.4 appVersion: "latest" keywords: - matrix - - alertmanager \ No newline at end of file + - alertmanager diff --git a/alertmanager-matrix/README.md b/alertmanager-matrix/README.md index c90fc31..24301db 100644 --- a/alertmanager-matrix/README.md +++ b/alertmanager-matrix/README.md @@ -1,6 +1,6 @@ # alertmanager-matrix -![Version: 0.1.3](https://img.shields.io/badge/Version-0.1.3-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: latest](https://img.shields.io/badge/AppVersion-latest-informational?style=flat-square) +![Version: 0.1.4](https://img.shields.io/badge/Version-0.1.4-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: latest](https://img.shields.io/badge/AppVersion-latest-informational?style=flat-square) Service for managing and receiving Alertmanager alerts on Matrix @@ -60,7 +60,7 @@ helm uninstall alertmanager-matrix-release | bot.messageType | string | `"m.notice"` | | | bot.showLabels | bool | `false` | | | bot.template.html | string | `"{{ range .Alerts }}\n \n {{.StatusString|icon}}\n {{.StatusString|upper}}\n {{.AlertName}}:\n \n {{.Summary}}\n {{if ne .Fingerprint \"\"}}\n ({{.Fingerprint}})\n {{end}}\n {{if $.ShowLabels}}\n
\n Labels:\n {{.LabelString}}\n {{end}}\n
\n{{- end -}}\n"` | | -| bot.template.text | string | `"{{ range .Alerts }}\n {{.StatusString|icon}}\n {{.StatusString|upper}}\n {{.AlertName}}:\n {{.Summary}}\n {{if ne .Fingerprint \"\"}}\n ({{.Fingerprint}})\n {{end}}\n {{if $.ShowLabels}}\n , labels:\n {{.LabelString}}\n {{end}}\n \\n\n{{ end -}}\n"` | | +| bot.template.text | string | `"{{ range .Alerts }}\n {{- .StatusString|icon}} {{ .StatusString|upper }}{{ .AlertName }}: {{ .Summary }} {{ if ne .Fingerprint \"\" -}}\n ({{.Fingerprint}})\n {{- end}}\n {{- if $.ShowLabels -}}\n , labels:\n {{- .LabelString}}\n {{- end }}\n{{ end -}}\n"` | | | fullnameOverride | string | `""` | | | image.pullPolicy | string | `"IfNotPresent"` | | | image.registry | string | `"docker.io"` | | @@ -74,6 +74,11 @@ helm uninstall alertmanager-matrix-release | ingress.hosts[0].paths[0].path | string | `"/"` | | | ingress.hosts[0].paths[0].pathType | string | `"ImplementationSpecific"` | | | ingress.tls | list | `[]` | | +| logging.additionalFilters | list | `[]` | Add other filters to Flow | +| logging.dedot | string | `nil` | if an filter (here or global) for dedot is active - for disable set `null` | +| logging.enabled | bool | `false` | Deploy Flow for [Logging-Operator](https://kube-logging.github.io/docs/) | +| logging.globalOutputRefs | list | `["default"]` | Flows globalOutputRefs for use of ClusterOutputs | +| logging.localOutputRefs | list | `[]` | Flows localOutputRefs for use of Outputs | | nameOverride | string | `""` | | | nodeSelector | object | `{}` | | | podAnnotations | object | `{}` | | diff --git a/alertmanager-matrix/templates/_helpers.tpl b/alertmanager-matrix/templates/_helpers.tpl index a6f61c5..9522fad 100644 --- a/alertmanager-matrix/templates/_helpers.tpl +++ b/alertmanager-matrix/templates/_helpers.tpl @@ -50,6 +50,19 @@ app.kubernetes.io/name: {{ include "alertmanager-matrix.name" . }} app.kubernetes.io/instance: {{ .Release.Name }} {{- end }} +{{/* +Selector Log labels +*/}} +{{- define "alertmanager-matrix.selectorLogLabels" -}} +{{- if .Values.logging.dedot }} +app{{.Values.logging.dedot }}kubernetes{{.Values.logging.dedot }}io/name: {{ include "alertmanager-matrix.name" . }} +app{{.Values.logging.dedot }}kubernetes{{.Values.logging.dedot }}io/instance: {{ .Release.Name }} +{{- else }} +{{ include "alertmanager-matrix.selectorLabels" . }} +{{- end }} +{{- end }} + + {{/* Create the name of the service account to use */}} diff --git a/alertmanager-matrix/templates/flow.yaml b/alertmanager-matrix/templates/flow.yaml new file mode 100644 index 0000000..1c4b4e1 --- /dev/null +++ b/alertmanager-matrix/templates/flow.yaml @@ -0,0 +1,41 @@ +{{- with .Values.logging }} +{{- if .enabled }} +--- +apiVersion: logging.banzaicloud.io/v1beta1 +kind: Flow +metadata: + name: {{ include "alertmanager-matrix.fullname" $ }} +spec: + match: + - select: + labels: + {{- include "alertmanager-matrix.selectorLogLabels" $ | nindent 10 }} + container_names: + - "{{ $.Chart.Name }}" + filters: + - parser: + reserve_data: true + remove_key_name_field: true + parse: + type: "multi_format" + patterns: + - format: "regexp" + expression: '^(?