Skip to content

Commit d494a5f

Browse files
authored
Use custom AlertManagerConfig (#70)
* Use custom AlertManagerConfig * fix env variable name
1 parent 5f8e0b6 commit d494a5f

File tree

2 files changed

+42
-7
lines changed

2 files changed

+42
-7
lines changed
Lines changed: 31 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,18 @@
11
name: Deploy alerts
2-
run-name: Deploy alerts for dapla-statbank-authenticator to test and prod
2+
run-name: Deploy alerts for Dapla Statbank Authenticator to test and prod
33

44
on:
55
push:
66
branches:
77
- master
88
paths:
99
- '.nais/alerts.yaml'
10-
- '.github/workflows/alert-deploy.yml'
10+
- '.github/workflows/alert-deploy.yaml'
11+
workflow_dispatch:
1112
permissions:
1213
id-token: write
14+
env:
15+
TEAM: dapla-stat
1316

1417
jobs:
1518
test-deploy:
@@ -18,22 +21,44 @@ jobs:
1821
steps:
1922
- name: Checkout code
2023
uses: actions/checkout@v4
24+
25+
- uses: actions/checkout@v4
26+
name: Retrieve AlertManager configuration
27+
with:
28+
repository: "statisticsnorway/nais-alert-config"
29+
path: "ext_alertconfig"
30+
sparse-checkout: |
31+
alertconfig.yaml
32+
sparse-checkout-cone-mode: false
33+
2134
- name: Deploy to test
2235
uses: nais/deploy/actions/deploy@v2
2336
env:
2437
CLUSTER: test
25-
RESOURCE: .nais/alerts.yaml
38+
RESOURCE: .nais/alerts.yaml,ext_alertconfig/alertconfig.yaml
2639
DEPLOY_SERVER: deploy.ssb.cloud.nais.io:443
27-
40+
VAR: cluster=test,team=${{ env.TEAM }}
41+
2842
prod-deploy:
2943
name: Deploy alerts to prod
3044
runs-on: ubuntu-latest
3145
steps:
3246
- name: Checkout code
3347
uses: actions/checkout@v4
48+
49+
- uses: actions/checkout@v4
50+
name: Retrieve AlertManager configuration
51+
with:
52+
repository: "statisticsnorway/nais-alert-config"
53+
path: "ext_alertconfig"
54+
sparse-checkout: |
55+
alertconfig.yaml
56+
sparse-checkout-cone-mode: false
57+
3458
- name: Deploy to prod
3559
uses: nais/deploy/actions/deploy@v2
3660
env:
3761
CLUSTER: prod
38-
RESOURCE: .nais/alerts.yaml
39-
DEPLOY_SERVER: deploy.ssb.cloud.nais.io:443
62+
RESOURCE: .nais/alerts.yaml,ext_alertconfig/alertconfig.yaml
63+
DEPLOY_SERVER: deploy.ssb.cloud.nais.io:443
64+
VAR: cluster=prod,team=${{ env.TEAM }}

.nais/alerts.yaml

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ spec:
2121
service: dapla-statbank-authenticator
2222
namespace: dapla-stat
2323
severity: critical
24+
alertmanager_custom_config: dapla-stat
25+
alert_type: custom
2426

2527
# This alert detects high CPU usage by calculating the CPU time used over 5 minutes.
2628
- alert: HighCPUUsage
@@ -34,6 +36,8 @@ spec:
3436
service: dapla-statbank-authenticator
3537
namespace: dapla-stat
3638
severity: warning
39+
alertmanager_custom_config: dapla-stat
40+
alert_type: custom
3741

3842
# This alert checks if memory usage exceeds 90% of the 12GB limit, which could cause instability.
3943
- alert: HighMemoryUsage
@@ -47,6 +51,8 @@ spec:
4751
service: dapla-statbank-authenticator
4852
namespace: dapla-stat
4953
severity: warning
54+
alertmanager_custom_config: dapla-stat
55+
alert_type: custom
5056

5157
# This alert detects a high number of error logs in dapla-statbank-authenticator.
5258
- alert: HighNumberOfErrors
@@ -60,6 +66,8 @@ spec:
6066
service: dapla-statbank-authenticator
6167
namespace: dapla-stat
6268
severity: critical
69+
alertmanager_custom_config: dapla-stat
70+
alert_type: custom
6371

6472
# This alert monitors the number of pod restarts for dapla-statbank-authenticator and triggers if more than 3 restarts occur within 15 minutes.
6573
- alert: HighPodRestarts
@@ -72,4 +80,6 @@ spec:
7280
labels:
7381
service: dapla-statbank-authenticator
7482
namespace: dapla-stat
75-
severity: warning
83+
severity: warning
84+
alertmanager_custom_config: dapla-stat
85+
alert_type: custom

0 commit comments

Comments
 (0)