Skip to content

Commit a4fcf69

Browse files
committed
feat(flux): add Flux Alerts
1 parent c97c9f2 commit a4fcf69

File tree

10 files changed

+188
-1
lines changed

10 files changed

+188
-1
lines changed
File renamed without changes.

Diff for: kube/deploy/apps/collabora/kustomization.yaml

+10
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,13 @@ kind: Kustomization
44
resources:
55
- ns.yaml
66
- ks.yaml
7+
transformers:
8+
- |-
9+
apiVersion: builtin
10+
kind: NamespaceTransformer
11+
metadata:
12+
name: not-used
13+
namespace: collabora
14+
unsetOnly: true
15+
components:
16+
- ../../core/flux-system/alerts/template/
+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
---
2+
# yaml-language-server: $schema=https://crds.jank.ing/notification.toolkit.fluxcd.io/alert_v1beta3.json
3+
apiVersion: notification.toolkit.fluxcd.io/v1beta3
4+
kind: Alert
5+
metadata:
6+
name: github
7+
spec:
8+
providerRef:
9+
name: github
10+
eventSeverity: error
11+
eventSources:
12+
- kind: Kustomization
13+
name: "*"
14+
exclusionList:
15+
- "error.*lookup github\\.com"
16+
- "error.*lookup raw\\.githubusercontent\\.com"
17+
- "dial.*tcp.*timeout"
18+
- "waiting.*socket"
19+
suspend: false

Diff for: kube/deploy/core/flux-system/alerts/github/es.yaml

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
---
2+
# yaml-language-server: $schema=https://crds.jank.ing/external-secrets.io/externalsecret_v1beta1.json
3+
apiVersion: external-secrets.io/v1beta1
4+
kind: ExternalSecret
5+
metadata:
6+
name: &name flux-system-github
7+
spec:
8+
refreshInterval: 1m
9+
secretStoreRef:
10+
kind: ClusterSecretStore
11+
name: 1p
12+
dataFrom:
13+
- extract:
14+
key: "Flux Alerts - ${CLUSTER_NAME}"
15+
target:
16+
creationPolicy: Owner
17+
deletionPolicy: Retain
18+
name: *name
19+
template:
20+
type: Opaque
21+
data:
22+
token: '{{ .SECRET_FLUX_ALERTS_GITHUB }}'
+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
---
2+
# yaml-language-server: $schema=https://crds.jank.ing/notification.toolkit.fluxcd.io/provider_v1beta3.json
3+
apiVersion: notification.toolkit.fluxcd.io/v1beta3
4+
kind: Provider
5+
metadata:
6+
name: github
7+
spec:
8+
type: github
9+
address: https://github.com/JJGadgets/Biohazard
10+
secretRef:
11+
name: flux-system-github
+54
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
---
2+
# yaml-language-server: $schema=https://crds.jank.ing/notification.toolkit.fluxcd.io/alert_v1beta3.json
3+
apiVersion: notification.toolkit.fluxcd.io/v1beta3
4+
kind: Alert
5+
metadata:
6+
name: alertmanager
7+
spec:
8+
providerRef:
9+
name: alertmanager
10+
eventSeverity: error
11+
eventSources:
12+
- kind: GitRepository
13+
name: "*"
14+
- kind: HelmRelease
15+
name: "*"
16+
- kind: HelmRepository
17+
name: "*"
18+
- kind: Kustomization
19+
name: "*"
20+
- kind: OCIRepository
21+
name: "*"
22+
exclusionList:
23+
- "error.*lookup github\\.com"
24+
- "error.*lookup raw\\.githubusercontent\\.com"
25+
- "dial.*tcp.*timeout"
26+
- "waiting.*socket"
27+
suspend: false
28+
---
29+
# yaml-language-server: $schema=https://crds.jank.ing/notification.toolkit.fluxcd.io/alert_v1beta3.json
30+
apiVersion: notification.toolkit.fluxcd.io/v1beta3
31+
kind: Alert
32+
metadata:
33+
name: discord
34+
spec:
35+
providerRef:
36+
name: discord
37+
eventSeverity: info
38+
eventSources:
39+
- kind: GitRepository
40+
name: "*"
41+
- kind: HelmRelease
42+
name: "*"
43+
- kind: HelmRepository
44+
name: "*"
45+
- kind: Kustomization
46+
name: "*"
47+
- kind: OCIRepository
48+
name: "*"
49+
exclusionList:
50+
- "error.*lookup github\\.com"
51+
- "error.*lookup raw\\.githubusercontent\\.com"
52+
- "dial.*tcp.*timeout"
53+
- "waiting.*socket"
54+
suspend: false

Diff for: kube/deploy/core/flux-system/alerts/template/es.yaml

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
---
2+
# yaml-language-server: $schema=https://crds.jank.ing/external-secrets.io/externalsecret_v1beta1.json
3+
apiVersion: external-secrets.io/v1beta1
4+
kind: ExternalSecret
5+
metadata:
6+
name: &name flux-system-discord
7+
spec:
8+
refreshInterval: 1m
9+
secretStoreRef:
10+
kind: ClusterSecretStore
11+
name: 1p
12+
dataFrom:
13+
- extract:
14+
key: "Flux Alerts - ${CLUSTER_NAME}"
15+
target:
16+
creationPolicy: Owner
17+
deletionPolicy: Retain
18+
name: *name
19+
template:
20+
type: Opaque
21+
data:
22+
address: '{{ .SECRET_FLUX_ALERTS_DISCORD }}'
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
---
2+
# yaml-language-server: $schema=https://json.schemastore.org/kustomization
3+
apiVersion: kustomize.config.k8s.io/v1alpha1
4+
kind: Component
5+
resources:
6+
- ./es.yaml
7+
- ./provider.yaml
8+
- ./alert.yaml
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
---
2+
# yaml-language-server: $schema=https://crds.jank.ing/notification.toolkit.fluxcd.io/provider_v1beta3.json
3+
apiVersion: notification.toolkit.fluxcd.io/v1beta3
4+
kind: Provider
5+
metadata:
6+
name: discord
7+
spec:
8+
type: discord
9+
secretRef:
10+
name: flux-system-discord
11+
---
12+
# yaml-language-server: $schema=https://crds.jank.ing/notification.toolkit.fluxcd.io/provider_v1beta3.json
13+
apiVersion: notification.toolkit.fluxcd.io/v1beta3
14+
kind: Provider
15+
metadata:
16+
name: alertmanager
17+
spec:
18+
type: alertmanager
19+
address: http://alertmanager-local.monitoring.svc.cluster.local:9093/api/v2/alerts/

Diff for: kube/deploy/core/flux-system/ks.yaml

+23-1
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,26 @@ spec:
2020
path: ./kube/deploy/core/flux-system/misc
2121
dependsOn:
2222
- name: 1-core-kyverno-crds
23-
- name: 1-core-kyverno-app
23+
- name: 1-core-kyverno-app
24+
---
25+
apiVersion: kustomize.toolkit.fluxcd.io/v1
26+
kind: Kustomization
27+
metadata:
28+
name: zzz-flux-alerts-github
29+
namespace: flux-system
30+
spec:
31+
path: ./kube/deploy/core/flux-system/alerts/github
32+
targetNamespace: flux-system
33+
dependsOn:
34+
- name: 1-core-secrets-es-1p
35+
---
36+
apiVersion: kustomize.toolkit.fluxcd.io/v1
37+
kind: Kustomization
38+
metadata:
39+
name: zzz-flux-alerts
40+
namespace: flux-system
41+
spec:
42+
path: ./kube/deploy/core/flux-system/alerts/template
43+
targetNamespace: flux-system
44+
dependsOn:
45+
- name: 1-core-secrets-es-1p

0 commit comments

Comments
 (0)