Skip to content

Commit 02f97f7

Browse files
committed
wip: allow alertmanager alert routing to email/webhook
Signed-off-by: sami <sami@appscode.com>
1 parent 112b96d commit 02f97f7

9 files changed

Lines changed: 225 additions & 8 deletions

File tree

apis/installer/v1alpha1/opscenter_features_types.go

Lines changed: 35 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -50,16 +50,45 @@ type OpscenterFeaturesSpec struct {
5050
FullnameOverride string `json:"fullnameOverride"`
5151

5252
// +optional
53-
OfflineInstaller bool `json:"offlineInstaller"`
54-
Image shared.ImageRegistrySpec `json:"image"`
55-
Helm OpscenterHelmSpec `json:"helm"`
56-
Registry shared.RegistryInfo `json:"registry"`
57-
ClusterMetadata kmapi.ClusterInfo `json:"clusterMetadata"`
58-
LicenseServer LicenseServerSpec `json:"licenseServer"`
53+
OfflineInstaller bool `json:"offlineInstaller"`
54+
Image shared.ImageRegistrySpec `json:"image"`
55+
Helm OpscenterHelmSpec `json:"helm"`
56+
Registry shared.RegistryInfo `json:"registry"`
57+
ClusterMetadata kmapi.ClusterInfo `json:"clusterMetadata"`
58+
Alertmanager AlertmanagerNotificationsSpec `json:"alertmanager"`
59+
LicenseServer LicenseServerSpec `json:"licenseServer"`
5960
// +optional
6061
Distro shared.DistroSpec `json:"distro"`
6162
}
6263

64+
type AlertmanagerNotificationsSpec struct {
65+
Email AlertmanagerEmailNotificationSpec `json:"email"`
66+
Webhook AlertmanagerWebhookNotificationSpec `json:"webhook"`
67+
}
68+
69+
type AlertmanagerEmailNotificationSpec struct {
70+
Enabled bool `json:"enabled"`
71+
Continue bool `json:"continue"`
72+
To string `json:"to"`
73+
From string `json:"from"`
74+
Smarthost string `json:"smarthost"`
75+
AuthUsername string `json:"authUsername"`
76+
AuthSecretName string `json:"authSecretName"`
77+
AuthSecretKey string `json:"authSecretKey"`
78+
AuthPassword string `json:"authPassword"`
79+
RequireTLS bool `json:"requireTLS"`
80+
SendResolved bool `json:"sendResolved"`
81+
}
82+
83+
type AlertmanagerWebhookNotificationSpec struct {
84+
Enabled bool `json:"enabled"`
85+
Continue bool `json:"continue"`
86+
URLSecretName string `json:"urlSecretName"`
87+
URLSecretKey string `json:"urlSecretKey"`
88+
URL string `json:"url"`
89+
SendResolved bool `json:"sendResolved"`
90+
}
91+
6392
type OpscenterHelmSpec struct {
6493
CreateNamespace bool `json:"createNamespace"`
6594
Repositories map[string]*shared.HelmRepository `json:"repositories"`

apis/installer/v1alpha1/zz_generated.deepcopy.go

Lines changed: 48 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

charts/ace-installer-certified/templates/featuresets/opscenter-core/opscenter-features.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,4 +56,3 @@ spec:
5656

5757
{{- end }}
5858
{{- end }}
59-

charts/ace-installer/templates/featuresets/opscenter-core/opscenter-features.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,4 +56,3 @@ spec:
5656

5757
{{- end }}
5858
{{- end }}
59-

charts/opscenter-features/README.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,23 @@ The following table lists the configurable parameters of the `opscenter-features
162162
| helm.releases.inbox-server.version | | <code>"v2025.2.28"</code> |
163163
| helm.releases.inbox-agent.version | | <code>"v2024.12.30"</code> |
164164
| helm.releases.inbox-ui.version | | <code>"v2026.3.30"</code> |
165+
| alertmanager.email.enabled | | <code>false</code> |
166+
| alertmanager.email.continue | | <code>true</code> |
167+
| alertmanager.email.to | | <code>""</code> |
168+
| alertmanager.email.from | | <code>""</code> |
169+
| alertmanager.email.smarthost | | <code>""</code> |
170+
| alertmanager.email.authUsername | | <code>""</code> |
171+
| alertmanager.email.authSecretName | | <code>""</code> |
172+
| alertmanager.email.authSecretKey | | <code>""</code> |
173+
| alertmanager.email.authPassword | | <code>""</code> |
174+
| alertmanager.email.requireTLS | | <code>true</code> |
175+
| alertmanager.email.sendResolved | | <code>true</code> |
176+
| alertmanager.webhook.enabled | | <code>false</code> |
177+
| alertmanager.webhook.continue | | <code>true</code> |
178+
| alertmanager.webhook.urlSecretName | | <code>""</code> |
179+
| alertmanager.webhook.urlSecretKey | | <code>""</code> |
180+
| alertmanager.webhook.url | | <code>""</code> |
181+
| alertmanager.webhook.sendResolved | | <code>true</code> |
165182
| licenseServer.baseURL | | <code>""</code> |
166183
| licenseServer.token | | <code>""</code> |
167184
| distro.openshift | | <code>false</code> |
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
{{- $ns := "monitoring" -}}
2+
{{- if eq (include "distro.openshift" .) "true" -}}
3+
{{- $ns = "openshift-user-workload-monitoring" -}}
4+
{{- else if eq (include "distro.rancher" .) "true" -}}
5+
{{- $ns = "cattle-monitoring-system" -}}
6+
{{- end -}}
7+
8+
{{- if and (ne $ns "openshift-user-workload-monitoring") (ne $ns "cattle-monitoring-system") }}
9+
apiVersion: v1
10+
kind: Namespace
11+
metadata:
12+
name: {{ $ns }}
13+
---
14+
{{- end }}
15+
16+
{{- if and .Values.alertmanager.email.enabled .Values.alertmanager.email.authSecretName .Values.alertmanager.email.authSecretKey .Values.alertmanager.email.authPassword }}
17+
apiVersion: v1
18+
kind: Secret
19+
metadata:
20+
name: {{ .Values.alertmanager.email.authSecretName }}
21+
namespace: {{ $ns }}
22+
stringData:
23+
{{ .Values.alertmanager.email.authSecretKey }}: {{ .Values.alertmanager.email.authPassword | quote }}
24+
---
25+
{{- end }}
26+
27+
{{- if and .Values.alertmanager.webhook.enabled .Values.alertmanager.webhook.urlSecretName .Values.alertmanager.webhook.urlSecretKey .Values.alertmanager.webhook.url }}
28+
apiVersion: v1
29+
kind: Secret
30+
metadata:
31+
name: {{ .Values.alertmanager.webhook.urlSecretName }}
32+
namespace: {{ $ns }}
33+
stringData:
34+
{{ .Values.alertmanager.webhook.urlSecretKey }}: {{ .Values.alertmanager.webhook.url | quote }}
35+
{{- end }}

charts/opscenter-features/templates/featuresets/opscenter-observability/monitoring/grafana-operator.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22

33
{{ $vals := dig "grafana-operator" "values" (dict) .Values.helm.releases }}
44
{{ $vals = mergeOverwrite $defaults $vals }}
5+
{{ $vals = mergeOverwrite $vals (dict "alertmanager" (dict
6+
"email" .Values.alertmanager.email
7+
"webhook" .Values.alertmanager.webhook
8+
)) }}
59

610
{{- if eq (include "distro.openshift" $) "true" }}
711
{{ $vals = mergeOverwrite $vals (dict "distro" .Values.distro) }}

charts/opscenter-features/values.openapiv3_schema.yaml

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,69 @@
11
properties:
2+
alertmanager:
3+
properties:
4+
email:
5+
properties:
6+
authPassword:
7+
type: string
8+
authSecretKey:
9+
type: string
10+
authSecretName:
11+
type: string
12+
authUsername:
13+
type: string
14+
continue:
15+
type: boolean
16+
enabled:
17+
type: boolean
18+
from:
19+
type: string
20+
requireTLS:
21+
type: boolean
22+
sendResolved:
23+
type: boolean
24+
smarthost:
25+
type: string
26+
to:
27+
type: string
28+
required:
29+
- authPassword
30+
- authSecretKey
31+
- authSecretName
32+
- authUsername
33+
- continue
34+
- enabled
35+
- from
36+
- requireTLS
37+
- sendResolved
38+
- smarthost
39+
- to
40+
type: object
41+
webhook:
42+
properties:
43+
continue:
44+
type: boolean
45+
enabled:
46+
type: boolean
47+
sendResolved:
48+
type: boolean
49+
url:
50+
type: string
51+
urlSecretKey:
52+
type: string
53+
urlSecretName:
54+
type: string
55+
required:
56+
- continue
57+
- enabled
58+
- sendResolved
59+
- url
60+
- urlSecretKey
61+
- urlSecretName
62+
type: object
63+
required:
64+
- email
65+
- webhook
66+
type: object
267
clusterMetadata:
368
properties:
469
capi:
@@ -152,6 +217,7 @@ properties:
152217
type: array
153218
type: object
154219
required:
220+
- alertmanager
155221
- clusterMetadata
156222
- fullnameOverride
157223
- helm

charts/opscenter-features/values.yaml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -240,6 +240,26 @@ helm:
240240
version: "v2024.12.30"
241241
inbox-ui:
242242
version: "v2026.3.30"
243+
alertmanager:
244+
email:
245+
enabled: false
246+
continue: true
247+
to: ""
248+
from: ""
249+
smarthost: ""
250+
authUsername: ""
251+
authSecretName: ""
252+
authSecretKey: ""
253+
authPassword: ""
254+
requireTLS: true
255+
sendResolved: true
256+
webhook:
257+
enabled: false
258+
continue: true
259+
urlSecretName: ""
260+
urlSecretKey: ""
261+
url: ""
262+
sendResolved: true
243263
licenseServer:
244264
baseURL: ""
245265
token: ""

0 commit comments

Comments
 (0)