Move out the slack message format so that we can customize it easily
Change-Id: I5dca828d672c00d871c657c68b130b4e71721a29
diff --git a/logging/opendistro_setting/Chart.yaml b/logging/opendistro_setting/Chart.yaml
index 6bf7895..33643af 100644
--- a/logging/opendistro_setting/Chart.yaml
+++ b/logging/opendistro_setting/Chart.yaml
@@ -18,7 +18,7 @@
# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/)
-version: 0.1.1
+version: 0.1.2
# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application. Versions are not expected to
diff --git a/logging/opendistro_setting/templates/configmap-script.yml b/logging/opendistro_setting/templates/configmap-script.yml
index 77715c7..f28c55a 100644
--- a/logging/opendistro_setting/templates/configmap-script.yml
+++ b/logging/opendistro_setting/templates/configmap-script.yml
@@ -108,6 +108,7 @@
for k in $(jq ' keys | .[]' "$config_file"); do
file=$dir/$(jq -r ".[$k].file" "$config_file");
dest_name=$(jq -r ".[$k].destination" "$config_file");
+ format=$(jq -r ".[$k].format" "$config_file");
dest_id=$(check_destination "$dest_name")
if [ -z "$dest_id" ]; then
@@ -116,11 +117,15 @@
fi
name=$(jq -r '.name' "$file")
+
+ ## Replace the slack output format
+ FILENAME=$(mktemp)
+ jq --arg slack "${format}" '.triggers[0].actions[0].message_template.source=$slack' "$file" > "$FILENAME"
monitor_id=$(check_monitor "$name")
if [ "$monitor_id" = "null" ]; then
- create_monitor "$file" "$dest_id"
+ create_monitor "$FILENAME" "$dest_id"
else
- update_monitor "$file" "$dest_id" "$monitor_id"
+ update_monitor "$FILENAME" "$dest_id" "$monitor_id"
fi
done