Skip to content

Commit

Permalink
Use proxy_from_environment in Alertmanager (#1782)
Browse files Browse the repository at this point in the history
* Use proxy_from_environment in Alertmanager

* move SlackApiToken condition
  • Loading branch information
TheoBrigitte authored Jan 2, 2025
1 parent c5aaab1 commit 3f42eba
Show file tree
Hide file tree
Showing 26 changed files with 440 additions and 42 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

### Changed

- Use `proxy_from_environment: true` in Alertmanager configuration to read proxy settings from the environment.

### Fixed

- Fix CVE-2024-45338 by updating golang.org/x/net to v0.33.0
Expand Down
62 changes: 20 additions & 42 deletions files/templates/alertmanager/alertmanager.yaml
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
global:
resolve_timeout: 5m
[[- if .ProxyURL ]]
http_config:
proxy_url: [[ .ProxyURL ]]
[[- end ]]
proxy_from_environment: true
[[- if .SlackApiToken ]]
slack_api_url: "https://slack.com/api/chat.postMessage"
[[- else ]]
Expand Down Expand Up @@ -180,9 +178,7 @@ receivers:
credentials: [[ .OpsgenieKey ]]
follow_redirects: true
enable_http2: true
[[- if .ProxyURL ]]
proxy_url: [[ .ProxyURL ]]
[[- end ]]
proxy_from_environment: true
url: https://api.opsgenie.com/v2/heartbeats/[[ .Installation ]]/ping
[[- end ]]

Expand All @@ -193,15 +189,13 @@ receivers:
- name: falco_noise_slack
slack_configs:
- channel: '#noise-falco'
[[- if .SlackApiToken ]]
http_config:
[[- if .SlackApiToken ]]
authorization:
type: Bearer
credentials: [[ .SlackApiToken ]]
[[- if .ProxyURL ]]
proxy_url: [[ .ProxyURL ]]
[[- end ]]
[[- end ]]
proxy_from_environment: true
send_resolved: true
actions:
- type: button
Expand Down Expand Up @@ -229,15 +223,13 @@ receivers:
[[- else ]]
- channel: '#alert-atlas-test'
[[- end ]]
[[- if .SlackApiToken ]]
http_config:
[[- if .SlackApiToken ]]
authorization:
type: Bearer
credentials: [[ .SlackApiToken ]]
[[- if .ProxyURL ]]
proxy_url: [[ .ProxyURL ]]
[[- end ]]
[[- end ]]
proxy_from_environment: true
send_resolved: true
actions:
- type: button
Expand Down Expand Up @@ -265,15 +257,13 @@ receivers:
[[- else ]]
- channel: '#alert-phoenix-test'
[[- end ]]
[[- if .SlackApiToken ]]
http_config:
[[- if .SlackApiToken ]]
authorization:
type: Bearer
credentials: [[ .SlackApiToken ]]
[[- if .ProxyURL ]]
proxy_url: [[ .ProxyURL ]]
[[- end ]]
[[- end ]]
proxy_from_environment: true
send_resolved: true
actions:
- type: button
Expand Down Expand Up @@ -301,15 +291,13 @@ receivers:
[[- else ]]
- channel: '#alert-bigmac-test'
[[- end ]]
[[- if .SlackApiToken ]]
http_config:
[[- if .SlackApiToken ]]
authorization:
type: Bearer
credentials: [[ .SlackApiToken ]]
[[- if .ProxyURL ]]
proxy_url: [[ .ProxyURL ]]
[[- end ]]
[[- end ]]
proxy_from_environment: true
send_resolved: true
actions:
- type: button
Expand Down Expand Up @@ -337,15 +325,13 @@ receivers:
[[- else ]]
- channel: '#alert-rocket-test'
[[- end ]]
[[- if .SlackApiToken ]]
http_config:
[[- if .SlackApiToken ]]
authorization:
type: Bearer
credentials: [[ .SlackApiToken ]]
[[- if .ProxyURL ]]
proxy_url: [[ .ProxyURL ]]
[[- end ]]
[[- end ]]
proxy_from_environment: true
send_resolved: true
actions:
- type: button
Expand All @@ -369,15 +355,13 @@ receivers:
- name: team_shield_slack
slack_configs:
- channel: '#alert-shield'
[[- if .SlackApiToken ]]
http_config:
[[- if .SlackApiToken ]]
authorization:
type: Bearer
credentials: [[ .SlackApiToken ]]
[[- if .ProxyURL ]]
proxy_url: [[ .ProxyURL ]]
[[- end ]]
[[- end ]]
proxy_from_environment: true
send_resolved: true
actions:
- type: button
Expand Down Expand Up @@ -405,15 +389,13 @@ receivers:
[[- else ]]
- channel: '#alert-turtles-test'
[[- end ]]
[[- if .SlackApiToken ]]
http_config:
[[- if .SlackApiToken ]]
authorization:
type: Bearer
credentials: [[ .SlackApiToken ]]
[[- if .ProxyURL ]]
proxy_url: [[ .ProxyURL ]]
[[- end ]]
[[- end ]]
proxy_from_environment: true
send_resolved: true
actions:
- type: button
Expand All @@ -437,15 +419,13 @@ receivers:
- name: team_tenet_slack
slack_configs:
- channel: '#alert-tenet'
[[- if .SlackApiToken ]]
http_config:
[[- if .SlackApiToken ]]
authorization:
type: Bearer
credentials: [[ .SlackApiToken ]]
[[- if .ProxyURL ]]
proxy_url: [[ .ProxyURL ]]
[[- end ]]
[[- end ]]
proxy_from_environment: true
send_resolved: true
actions:
- type: button
Expand All @@ -469,15 +449,13 @@ receivers:
- name: team_honeybadger_slack
slack_configs:
- channel: '#alert-honeybadger'
[[- if .SlackApiToken ]]
http_config:
[[- if .SlackApiToken ]]
authorization:
type: Bearer
credentials: [[ .SlackApiToken ]]
[[- if .ProxyURL ]]
proxy_url: [[ .ProxyURL ]]
[[- end ]]
[[- end ]]
proxy_from_environment: true
send_resolved: true
actions:
- type: button
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
global:
resolve_timeout: 5m
http_config:
proxy_from_environment: true
slack_api_url: https://slack

templates:
Expand Down Expand Up @@ -116,6 +118,8 @@ receivers:
- name: falco_noise_slack
slack_configs:
- channel: '#noise-falco'
http_config:
proxy_from_environment: true
send_resolved: true
actions:
- type: button
Expand All @@ -139,6 +143,8 @@ receivers:
- name: team_atlas_slack
slack_configs:
- channel: '#alert-atlas-test'
http_config:
proxy_from_environment: true
send_resolved: true
actions:
- type: button
Expand All @@ -162,6 +168,8 @@ receivers:
- name: team_phoenix_slack
slack_configs:
- channel: '#alert-phoenix-test'
http_config:
proxy_from_environment: true
send_resolved: true
actions:
- type: button
Expand All @@ -185,6 +193,8 @@ receivers:
- name: team_bigmac_slack
slack_configs:
- channel: '#alert-bigmac-test'
http_config:
proxy_from_environment: true
send_resolved: true
actions:
- type: button
Expand All @@ -208,6 +218,8 @@ receivers:
- name: team_rocket_slack
slack_configs:
- channel: '#alert-rocket-test'
http_config:
proxy_from_environment: true
send_resolved: true
actions:
- type: button
Expand All @@ -231,6 +243,8 @@ receivers:
- name: team_shield_slack
slack_configs:
- channel: '#alert-shield'
http_config:
proxy_from_environment: true
send_resolved: true
actions:
- type: button
Expand All @@ -254,6 +268,8 @@ receivers:
- name: team_turtles_slack
slack_configs:
- channel: '#alert-turtles-test'
http_config:
proxy_from_environment: true
send_resolved: true
actions:
- type: button
Expand All @@ -277,6 +293,8 @@ receivers:
- name: team_tenet_slack
slack_configs:
- channel: '#alert-tenet'
http_config:
proxy_from_environment: true
send_resolved: true
actions:
- type: button
Expand All @@ -300,6 +318,8 @@ receivers:
- name: team_honeybadger_slack
slack_configs:
- channel: '#alert-honeybadger'
http_config:
proxy_from_environment: true
send_resolved: true
actions:
- type: button
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
global:
resolve_timeout: 5m
http_config:
proxy_from_environment: true
slack_api_url: https://slack

templates:
Expand Down Expand Up @@ -116,6 +118,8 @@ receivers:
- name: falco_noise_slack
slack_configs:
- channel: '#noise-falco'
http_config:
proxy_from_environment: true
send_resolved: true
actions:
- type: button
Expand All @@ -139,6 +143,8 @@ receivers:
- name: team_atlas_slack
slack_configs:
- channel: '#alert-atlas-test'
http_config:
proxy_from_environment: true
send_resolved: true
actions:
- type: button
Expand All @@ -162,6 +168,8 @@ receivers:
- name: team_phoenix_slack
slack_configs:
- channel: '#alert-phoenix-test'
http_config:
proxy_from_environment: true
send_resolved: true
actions:
- type: button
Expand All @@ -185,6 +193,8 @@ receivers:
- name: team_bigmac_slack
slack_configs:
- channel: '#alert-bigmac-test'
http_config:
proxy_from_environment: true
send_resolved: true
actions:
- type: button
Expand All @@ -208,6 +218,8 @@ receivers:
- name: team_rocket_slack
slack_configs:
- channel: '#alert-rocket-test'
http_config:
proxy_from_environment: true
send_resolved: true
actions:
- type: button
Expand All @@ -231,6 +243,8 @@ receivers:
- name: team_shield_slack
slack_configs:
- channel: '#alert-shield'
http_config:
proxy_from_environment: true
send_resolved: true
actions:
- type: button
Expand All @@ -254,6 +268,8 @@ receivers:
- name: team_turtles_slack
slack_configs:
- channel: '#alert-turtles-test'
http_config:
proxy_from_environment: true
send_resolved: true
actions:
- type: button
Expand All @@ -277,6 +293,8 @@ receivers:
- name: team_tenet_slack
slack_configs:
- channel: '#alert-tenet'
http_config:
proxy_from_environment: true
send_resolved: true
actions:
- type: button
Expand All @@ -300,6 +318,8 @@ receivers:
- name: team_honeybadger_slack
slack_configs:
- channel: '#alert-honeybadger'
http_config:
proxy_from_environment: true
send_resolved: true
actions:
- type: button
Expand Down
Loading

0 comments on commit 3f42eba

Please sign in to comment.