Skip to content
This repository has been archived by the owner on Mar 6, 2023. It is now read-only.

Commit

Permalink
Remove alertmanager_child_routes (#101)
Browse files Browse the repository at this point in the history
[minor]
  • Loading branch information
paulfantom authored Mar 28, 2020
1 parent aafc40f commit 363f8a9
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 12 deletions.
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ All variables which can be overridden are stored in [defaults/main.yml](defaults
| `alertmanager_receivers` | [] | A list of notification receivers. Configuration same as in [official docs](https://prometheus.io/docs/alerting/configuration/#<receiver>) |
| `alertmanager_inhibit_rules` | [] | List of inhibition rules. Same as in [official docs](https://prometheus.io/docs/alerting/configuration/#inhibit_rule) |
| `alertmanager_route` | {} | Alert routing. More in [official docs](https://prometheus.io/docs/alerting/configuration/#<route>) |
| `alertmanager_child_routes` | [] | List of child routes. |

## Example

Expand Down
3 changes: 0 additions & 3 deletions defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,6 @@ alertmanager_route: {}
# group_interval: 5m
# repeat_interval: 4h
# receiver: slack

alertmanager_child_routes: []
# alertmanager_child_routes:
# # This routes performs a regular expression match on alert labels to
# # catch alerts that are related to a list of services.
# - match_re:
Expand Down
4 changes: 4 additions & 0 deletions molecule/alternative/playbook.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@
group_interval: 5m
repeat_interval: 3h
receiver: slack
routes:
- match_re:
service: ^(foo1|foo2|baz)$
receiver: slack
alertmanager_mesh:
listen-address: "127.0.0.1:6783"
peers:
Expand Down
13 changes: 9 additions & 4 deletions tasks/preflight.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,11 @@
alertmanager_web_external_url: "{{ alertmanager_external_url }}"
when: alertmanager_external_url is defined

- name: Backward compatibility of variable [part 4]
set_fact:
alertmanager_route: "{{ alertmanager_route | combine({'routes': alertmanager_child_routes}) }}"
when: alertmanager_child_routes is defined

- name: HA config compatibility with alertmanager<0.15.0
set_fact:
alertmanager_cluster: "{{ alertmanager_mesh }}"
Expand Down Expand Up @@ -91,7 +96,7 @@
- alertmanager_config_file == 'alertmanager.yml.j2'
- alertmanager_route == {}

- name: Fail when child routes are defined not in proper place
fail:
msg: "Please reconfigure `alertmanager_route` so that child routes are placed in `alertmanager_child_routes`."
when: alertmanager_route.routes is defined
- name: "DEPRECATION WARNING: `alertmanager_child_routes` is no longer supported"
debug:
msg: "Please move content of `alertmanager_child_routes` to `alertmanager_route.routes` as the former variable is deprecated and will be removed in future versions."
when: alertmanager_child_routes is defined
4 changes: 0 additions & 4 deletions templates/alertmanager.yml.j2
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,3 @@ inhibit_rules:
{% endif %}
route:
{{ alertmanager_route | to_nice_yaml(indent=2) | indent(2, False) }}
{% if alertmanager_child_routes | length %}
routes:
{{ alertmanager_child_routes | to_nice_yaml(indent=2) | indent(2, False) }}
{% endif %}

0 comments on commit 363f8a9

Please sign in to comment.