From 766fd809a8a487446983e2859427b5957b392b34 Mon Sep 17 00:00:00 2001 From: Liam Date: Sun, 22 Sep 2024 02:30:42 +0100 Subject: [PATCH] flux alerting --- ...kubernetes-grafana.local.fascinated.cc.yml | 18 ++++++++++++++++++ infrastructure/alerting/flux/alert.yaml | 19 +++++++++++++++++++ .../alerting/flux/discord-secret.yaml | 18 ++++++++++++++++++ .../alerting/flux/kustomization.yaml | 6 ++++++ infrastructure/kustomization.yaml | 1 + 5 files changed, 62 insertions(+) create mode 100644 apps/production/traefik/external-services/kubernetes-grafana.local.fascinated.cc.yml create mode 100644 infrastructure/alerting/flux/alert.yaml create mode 100644 infrastructure/alerting/flux/discord-secret.yaml create mode 100644 infrastructure/alerting/flux/kustomization.yaml diff --git a/apps/production/traefik/external-services/kubernetes-grafana.local.fascinated.cc.yml b/apps/production/traefik/external-services/kubernetes-grafana.local.fascinated.cc.yml new file mode 100644 index 0000000..deb5ee8 --- /dev/null +++ b/apps/production/traefik/external-services/kubernetes-grafana.local.fascinated.cc.yml @@ -0,0 +1,18 @@ +apiVersion: traefik.io/v1alpha1 +kind: IngressRoute +metadata: + name: kubernetes-grafana-external-ingress + namespace: monitoring + annotations: + kubernetes.io/ingress.class: traefik-external +spec: + entryPoints: + - websecure + routes: + - match: Host(`kubernetes-grafana.local.fascinated.cc`) + kind: Rule + services: + - name: kube-prometheus-stack-grafana + port: 80 + tls: + secretName: mcutils-xyz diff --git a/infrastructure/alerting/flux/alert.yaml b/infrastructure/alerting/flux/alert.yaml new file mode 100644 index 0000000..45bf105 --- /dev/null +++ b/infrastructure/alerting/flux/alert.yaml @@ -0,0 +1,19 @@ +apiVersion: notification.toolkit.fluxcd.io/v1beta3 +kind: Alert +metadata: + name: discord-alert + namespace: flux-system +spec: + summary: "Discord Alert" + # eventMetadata: + # env: "production" + # cluster: "my-cluster" + # region: "us-east-2" + providerRef: + name: discord-webhook + eventSeverity: info + eventSources: + - kind: GitRepository + name: "*" + - kind: Kustomization + name: "*" diff --git a/infrastructure/alerting/flux/discord-secret.yaml b/infrastructure/alerting/flux/discord-secret.yaml new file mode 100644 index 0000000..481652e --- /dev/null +++ b/infrastructure/alerting/flux/discord-secret.yaml @@ -0,0 +1,18 @@ +--- +apiVersion: notification.toolkit.fluxcd.io/v1beta3 +kind: Provider +metadata: + name: discord + namespace: flux-system +spec: + type: discord + secretRef: + name: discord-webhook +--- +apiVersion: v1 +kind: Secret +metadata: + name: discord-webhook + namespace: flux-system +stringData: + address: "https://discord.com/api/webhooks/1287224007820574841/4lZh3e3OxI6Qu0BnzyEBzbGBc3tdhzWG66Dh9t8RdVbenClhOOAnqooclrw1amRoY5nB" diff --git a/infrastructure/alerting/flux/kustomization.yaml b/infrastructure/alerting/flux/kustomization.yaml new file mode 100644 index 0000000..4ccc119 --- /dev/null +++ b/infrastructure/alerting/flux/kustomization.yaml @@ -0,0 +1,6 @@ +--- +apiVersion: kustomize.config.k8s.io/v1beta1 +kind: Kustomization +resources: + - discord-secret.yaml + - alert.yaml diff --git a/infrastructure/kustomization.yaml b/infrastructure/kustomization.yaml index 7827d60..fd41c47 100644 --- a/infrastructure/kustomization.yaml +++ b/infrastructure/kustomization.yaml @@ -4,3 +4,4 @@ kind: Kustomization resources: - crds - nfs + - alerting/flux