diff --git a/chart/chart-index/Chart.yaml b/chart/chart-index/Chart.yaml index 1139b5fc77..7abc7e7562 100644 --- a/chart/chart-index/Chart.yaml +++ b/chart/chart-index/Chart.yaml @@ -71,7 +71,7 @@ dependencies: version: 7.10.0 repository: https://prometheus-community.github.io/helm-charts - name: prometheus-msteams - version: 0.4.4 + version: 0.7.1 repository: https://prometheus-msteams.github.io/prometheus-msteams/ - name: promtail version: 6.16.6 diff --git a/charts/prometheus-msteams/Chart.yaml b/charts/prometheus-msteams/Chart.yaml index 75f9bee66a..15451a7e5c 100644 --- a/charts/prometheus-msteams/Chart.yaml +++ b/charts/prometheus-msteams/Chart.yaml @@ -1,5 +1,11 @@ apiVersion: v1 -appVersion: v1.3.3 +appVersion: v1.4.1 description: A Helm chart for Kubernetes +home: https://github.com/prometheus-msteams/prometheus-msteams +maintainers: +- name: bzon + url: https://github.com/bzon +- name: Knappek + url: https://github.com/Knappek name: prometheus-msteams -version: 0.4.4 +version: 0.7.1 diff --git a/charts/prometheus-msteams/README.md b/charts/prometheus-msteams/README.md index ce71d99abb..bec76c05de 100644 --- a/charts/prometheus-msteams/README.md +++ b/charts/prometheus-msteams/README.md @@ -2,12 +2,12 @@ -* [Download the chart](#download-the-chart) -* [Prepare the Deployment configuration](#prepare-the-deployment-configuration) -* [Deploy to Kubernetes cluster](#deploy-to-kubernetes-cluster) -* [When using with Prometheus Operator](#when-using-with-prometheus-operator) -* [Customise messages to MS Teams](#customise-messages-to-ms-teams) -* [Helm Configuration](#helm-configuration) +- [Download the chart](#download-the-chart) +- [Prepare the Deployment configuration](#prepare-the-deployment-configuration) +- [Deploy to Kubernetes cluster](#deploy-to-kubernetes-cluster) +- [When using with Prometheus Operator](#when-using-with-prometheus-operator) +- [Customise messages to MS Teams](#customise-messages-to-ms-teams) +- [Helm Configuration](#helm-configuration) @@ -17,7 +17,7 @@ Clone this repository. ```bash -helm repo add prometheus-msteams https://prometheus-msteams.github.io/helm-chart/ +helm repo add prometheus-msteams https://prometheus-msteams.github.io/prometheus-msteams/ ``` ### Prepare the Deployment configuration @@ -30,10 +30,13 @@ Create a helm values file to configure your Microsoft Teams channel connectors a replicaCount: 1 image: repository: quay.io/prometheusmsteams/prometheus-msteams - tag: v1.3.3 + tag: v1.4.1 + connectors: -- high_priority_channel: https://outlook.office.com/webhook/xxxx/xxxx -- low_priority_channel: https://outlook.office.com/webhook/xxxx/xxxx +# in alertmanager, this will be used as http://prometheus-msteams:2000/bar +- bar: https://outlook.office.com/webhook/xxxx/xxxx +# in alertmanager, this will be used as http://prometheus-msteams:2000/foo +- foo: https://outlook.office.com/webhook/xxxx/xxxx # extraEnvs is useful for adding extra environment variables such as proxy settings extraEnvs: @@ -60,7 +63,7 @@ See [Helm Configuration](#helm-configuration) and [App Configuration](https://gi ```bash helm upgrade --install prometheus-msteams \ --namespace default -f config.yaml - charts/prometheus-msteams + prometheus-msteams/prometheus-msteams ``` ### When using with Prometheus Operator @@ -69,16 +72,16 @@ Please see [Prometheus Operator alerting docs](https://github.com/coreos/prometh ### Customise messages to MS Teams -This application uses a [Default Teams Message Card Template](./prometheus-msteams/card.tmpl) to convert incoming Prometheus alerts to teams message cards. -This template can be customised by specifying the value of `customCardTemplate` parameter. +This application uses a [Default Teams Message Card Template](./prometheus-msteams/card.tmpl) to convert incoming Prometheus alerts to teams message cards. +This template can be customised by specifying the value of `customCardTemplate` parameter. Simply create a new file that you want to use as your custom template (for example, `custom-card.tmpl`). You can use the `--set-file` flag to set the value from this file: ```bash -helm install --name prometheus-msteams \ - ./prometheus-msteams --namespace monitoring \ +helm upgrade --install prometheus-msteams \ + --namespace default -f config.yaml \ --set-file customCardTemplate=custom-card.tmpl \ - -f config.yaml + prometheus-msteams/prometheus-msteams ``` Otherwise you can also set the value by specifying the template data directly via values file. @@ -87,22 +90,25 @@ Otherwise you can also set the value by specifying the template data directly vi ### Helm Configuration | Parameter | Description | Default | -| --- | --- | --- | -| `image.repository` | Image repository | `quay.io/prometheusmsteams/prometheus-msteams` | -| `image.tag` | Image tag | `v1.3.3` | +| ------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------- | +| `image.repository` | Image repository | `quay.io/prometheusmsteams/prometheus-msteams` | +| `image.tag` | Image tag | `v1.4.1` | | `image.pullPolicy` | Image pull policy | `Always` | +| `imagePullSecrets` | Configuration for [imagePullSecrets](https://kubernetes.io/docs/tasks/configure-pod-container/pull-image-private-registry/#create-a-pod-that-uses-your-secret) so that you can use a private registry for your image | `[]` | | `extraEnvs` | Extra environment variables | `{}` | -| `connectors` | Add your own Microsoft Teams connectors. | `{}` | -| `connectors_with_custom_templates` | Add your own Microsoft Teams connectors with custom template file. | `{}` | +| `connectors` | Add your own Microsoft Teams connectors. | `[]` | +| `connectors_with_custom_templates` | Add your own Microsoft Teams connectors with custom template file. | `[]` | | `service.port` | Service port | `2000` | | `service.type` | Service type | `ClusterIP` | | `container.port` | Container port | `2000` | | `container.additionalArgs` | additional prometheus-msteams flags to use | `{}` | -| `resources` | Pod resources | See [default](./prometheus-msteams/values.yaml) | +| `resources` | Pod resources | See [default](./values.yaml) | | `nodeSelector` | Pod nodeSelector | `{}` | | `affinity` | Pod affinity | `{}` | | `tolerations` | Pod tolerations | `{}` | +| `priorityClassName` | Pod priority class | `""` | | `podAnnotations` | Pod annotations | `{}` | +| `podSecurityContext` | Pod securityContext | See [default](./values.yaml) | | `customCardTemplate` | Custom message card template for MS teams | `""` | | `metrics.serviceMonitor.enabled` | Set this to `true` to create ServiceMonitor for Prometheus operator | `false` | | `metrics.serviceMonitor.additionalLabels` | Additional labels that can be used so ServiceMonitor will be discovered by Prometheus | `{}` | diff --git a/charts/prometheus-msteams/card.tmpl b/charts/prometheus-msteams/card.tmpl index c1a887391b..36f64f9c28 100644 --- a/charts/prometheus-msteams/card.tmpl +++ b/charts/prometheus-msteams/card.tmpl @@ -10,14 +10,18 @@ {{- else -}}808080{{- end -}}", "summary": "{{- if eq .CommonAnnotations.summary "" -}} {{- if eq .CommonAnnotations.message "" -}} - {{- .CommonLabels.alertname -}} + {{- if eq .CommonLabels.alertname "" -}} + Prometheus Alert + {{- else -}} + {{- .CommonLabels.alertname -}} + {{- end -}} {{- else -}} {{- .CommonAnnotations.message -}} {{- end -}} {{- else -}} {{- .CommonAnnotations.summary -}} {{- end -}}", - "title": "Prometheus Alert ({{ .Status }})", + "title": "Prometheus Alert ({{ .Status | title }})", "sections": [ {{$externalUrl := .ExternalURL}} {{- range $index, $alert := .Alerts }}{{- if $index }},{{- end }} { @@ -25,8 +29,10 @@ "facts": [ {{- range $key, $value := $alert.Annotations }} { - "name": "{{ $key }}", - "value": "{{ $value }}" + {{- if ne $key "description" -}} + "name": "{{ $key }}", + "value": "{{ $value }}" + {{- end -}} }, {{- end -}} {{$c := counter}}{{ range $key, $value := $alert.Labels }}{{if call $c}},{{ end }} diff --git a/charts/prometheus-msteams/templates/_helpers.tpl b/charts/prometheus-msteams/templates/_helpers.tpl index 85c6df1f89..caabd76bed 100644 --- a/charts/prometheus-msteams/templates/_helpers.tpl +++ b/charts/prometheus-msteams/templates/_helpers.tpl @@ -38,6 +38,6 @@ Return the appropriate apiVersion for deployment. {{- if semverCompare ">=1.9-0" .Capabilities.KubeVersion.GitVersion -}} {{- print "apps/v1" -}} {{- else -}} -{{- print "apps/v1" -}} +{{- print "apps/v1beta2" -}} {{- end -}} {{- end -}} diff --git a/charts/prometheus-msteams/templates/deployment.yaml b/charts/prometheus-msteams/templates/deployment.yaml index 84532280f5..3c9abf6642 100644 --- a/charts/prometheus-msteams/templates/deployment.yaml +++ b/charts/prometheus-msteams/templates/deployment.yaml @@ -7,9 +7,6 @@ metadata: chart: {{ template "app.chart" . }} release: {{ .Release.Name }} heritage: {{ .Release.Service }} - {{- if .Values.annotations }} - annotations: {{ toYaml .Values.annotations | nindent 4 }} - {{- end }} spec: replicas: {{ .Values.replicaCount }} selector: @@ -21,15 +18,17 @@ spec: labels: app: {{ template "app.name" . }} release: {{ .Release.Name }} - {{- if .Values.podAnnotations }} annotations: + checksum/config: {{ include (print $.Template.BasePath "/configMapConfig.yaml") . | sha256sum }} + checksum/msteams-card-templates: {{ include (print $.Template.BasePath "/configMapTemplate.yaml") . | sha256sum }} + {{- if .Values.podAnnotations }} {{ toYaml .Values.podAnnotations | indent 8 }} {{- end }} spec: - {{- with .Values.imagePullSecrets }} + {{- if .Values.imagePullSecrets }} imagePullSecrets: - {{- toYaml . | nindent 8 }} - {{- end }} +{{ toYaml .Values.imagePullSecrets | indent 8 }} + {{- end}} volumes: - name: config-volume configMap: @@ -57,6 +56,7 @@ spec: {{- with .Values.container.additionalArgs }} {{ toYaml . | indent 12 }} {{- end}} + imagePullPolicy: {{ .Values.image.pullPolicy }} ports: - name: http containerPort: {{ .Values.container.port }} @@ -75,6 +75,10 @@ spec: periodSeconds: 20 resources: {{ toYaml .Values.resources | indent 12 }} + {{- with .Values.podSecurityContext }} + securityContext: +{{ toYaml . | indent 8 }} + {{- end }} {{- with .Values.nodeSelector }} nodeSelector: {{ toYaml . | indent 8 }} @@ -87,3 +91,6 @@ spec: tolerations: {{ toYaml . | indent 8 }} {{- end }} + {{- if .Values.priorityClassName }} + priorityClassName: {{ .Values.priorityClassName }} + {{- end }} diff --git a/charts/prometheus-msteams/values.yaml b/charts/prometheus-msteams/values.yaml index 1576c0b1d4..7f3abf6215 100644 --- a/charts/prometheus-msteams/values.yaml +++ b/charts/prometheus-msteams/values.yaml @@ -3,9 +3,11 @@ replicaCount: 1 image: repository: quay.io/prometheusmsteams/prometheus-msteams - tag: v1.3.3 + tag: v1.4.1 pullPolicy: Always +imagePullSecrets: [] + extraEnvs: container: @@ -30,21 +32,23 @@ tolerations: [] affinity: {} +podSecurityContext: + runAsUser: 1000 + runAsNonRoot: true + +priorityClassName: "" + metrics: serviceMonitor: enabled: false additionalLabels: {} scrapeInterval: 30s -connectors: {} -connectors_with_custom_templates: {} - +connectors: [] +connectors_with_custom_templates: [] ## Specify the custom message card template for MS teams # customCardTemplate: | # {{ define "teams.card" }} -# { -# -# } +# {...} # {{ end }} -