From afe0a7830c4946b43e1439f3d7b2e1dc0e9e62f2 Mon Sep 17 00:00:00 2001
From: "Xiaoguang(William) Zhang" <xz8905@att.com>
Date: Wed, 30 Sep 2020 19:09:31 +0000
Subject: [PATCH] Alerta update to slience alert in Alertmanager

Provide Alerta function to be able to slience alert in Alertmanger from Alerta

Change-Id: Iae1599f15ddcccd9f8ec05d8acee24a3dcc573d1
---
 alerta/Chart.yaml                   |  2 +-
 alerta/templates/configmap-etc.yaml |  3 +--
 alerta/values.yaml                  | 25 ++++++++++++++++++++-----
 3 files changed, 22 insertions(+), 8 deletions(-)

diff --git a/alerta/Chart.yaml b/alerta/Chart.yaml
index c340ea607..07a27d83f 100644
--- a/alerta/Chart.yaml
+++ b/alerta/Chart.yaml
@@ -15,7 +15,7 @@ apiVersion: v1
 appVersion: v8.0.2
 description: OpenStack-Helm Alerta for Alertmanager.
 name: alerta
-version: 0.1.2
+version: 0.1.3
 home: https://github.com/alerta/alerta
 sources:
   - https://github.com/alerta/alerta
diff --git a/alerta/templates/configmap-etc.yaml b/alerta/templates/configmap-etc.yaml
index c63df64ce..239160621 100644
--- a/alerta/templates/configmap-etc.yaml
+++ b/alerta/templates/configmap-etc.yaml
@@ -20,7 +20,6 @@ kind: ConfigMap
 metadata:
   name: alerta-etc
 data:
-  alertad.conf: |
-    DATABASE_URL = {{ tuple "postgresql" "internal" "admin" "postgresql" . | include "helm-toolkit.endpoints.authenticated_endpoint_uri_lookup" |quote}}
+{{- include "helm-toolkit.snippets.values_template_renderer" (dict "envAll" $envAll "template" .Values.conf.alerta.alertad_conf "key" "alertad.conf") | indent 2 }}
 {{- include "helm-toolkit.snippets.values_template_renderer" (dict "envAll" $envAll "template" .Values.conf.alerta.alerta_webui_config "key" "config.js") | indent 2 }}
 {{- end }}
diff --git a/alerta/values.yaml b/alerta/values.yaml
index b86089139..21ce99f75 100644
--- a/alerta/values.yaml
+++ b/alerta/values.yaml
@@ -20,7 +20,7 @@
 
 images:
   tags:
-    alerta: docker.io/alerta/alerta-web:8.0.2
+    alerta: docker.io/openstackhelm/alerta:8.0.2
     dep_check: quay.io/airshipit/kubernetes-entrypoint:v1.0.0
     image_repo_sync: docker.io/docker:17.07.0
     ks_user: docker.io/openstackhelm/heat:stein-ubuntu_bionic
@@ -119,6 +119,19 @@ endpoints:
     port:
       registry:
         node: 5000
+  alertmanager:
+    name: prometheus-alertmanager
+    namespace: null
+    hosts:
+      default: alerts-engine
+    host_fqdn_override:
+      default: null
+    path:
+      default: null
+    scheme: http
+    port:
+      api:
+        default: 9093
   alerta:
     name: alerta
     namespace: null
@@ -202,10 +215,12 @@ conf:
     alertaAdminKey: changeme
     alertaAPIKey: changeme
     alertadb: alerta_db
-    alerta_configs: |
-      # ref: http://docs.alerta.io/en/latest/configuration.html
-        DEBUG: false
-        AUTH_REQUIRED: true
+    alertad_conf: |
+      DEBUG = True
+      PLUGINS = ['enhance', 'forward', 'normalise', 'prometheus']
+      ALERTMANAGER_SILENCE_FROM_ACK = True
+      ALERTMANAGER_API_URL = '{{ tuple "alertmanager" "internal" "api" . | include "helm-toolkit.endpoints.keystone_endpoint_scheme_lookup" }}://{{ tuple "alertmanager" "internal" "api" . | include "helm-toolkit.endpoints.host_and_port_endpoint_uri_lookup" }}'
+      DATABASE_URL = {{ tuple "postgresql" "internal" "admin" "postgresql" . | include "helm-toolkit.endpoints.authenticated_endpoint_uri_lookup" |quote}}
     alerta_webui_config: |
       # ref: http://docs.alerta.io/en/latest/webui.html
       'use strict';