From aa7119a6e4ffc57610ec59677d0ab967d7d1aa3a Mon Sep 17 00:00:00 2001 From: Joseph Hanson Date: Fri, 11 Oct 2024 18:44:08 -0500 Subject: [PATCH] add alert manager silencer back --- .../apps/observability/alertmanager/ks.yaml | 23 +++++++- .../alertmanager/silencer/helmrelease.yaml | 56 +++++++++++++++++++ .../alertmanager/silencer/kustomization.yaml | 6 ++ 3 files changed, 84 insertions(+), 1 deletion(-) create mode 100644 kubernetes/apps/observability/alertmanager/silencer/helmrelease.yaml create mode 100644 kubernetes/apps/observability/alertmanager/silencer/kustomization.yaml diff --git a/kubernetes/apps/observability/alertmanager/ks.yaml b/kubernetes/apps/observability/alertmanager/ks.yaml index 1279419f..26c72087 100644 --- a/kubernetes/apps/observability/alertmanager/ks.yaml +++ b/kubernetes/apps/observability/alertmanager/ks.yaml @@ -1,5 +1,5 @@ --- -# yaml-language-server: $schema=https://raw.githubusercontent.com/fluxcd-community/flux2-schemas/main/kustomization-kustomize-v1.json +# yaml-language-server: $schema=https://ks.hsn.dev/kustomize.toolkit.fluxcd.io/kustomization_v1.json apiVersion: kustomize.toolkit.fluxcd.io/v1 kind: Kustomization metadata: @@ -21,3 +21,24 @@ spec: dependsOn: - name: external-secrets-stores - name: rook-ceph-cluster +--- +# yaml-language-server: $schema=https://ks.hsn.dev/kustomize.toolkit.fluxcd.io/kustomization_v1.json +apiVersion: kustomize.toolkit.fluxcd.io/v1 +kind: Kustomization +metadata: + name: &app alertmanager-silencer + namespace: flux-system +spec: + targetNamespace: observability + commonMetadata: + labels: + app.kubernetes.io/name: *app + path: "./kubernetes/apps/observability/alertmanager/silencer" + prune: true + sourceRef: + kind: GitRepository + name: theshire + wait: false + interval: 30m + retryInterval: 1m + timeout: 5m diff --git a/kubernetes/apps/observability/alertmanager/silencer/helmrelease.yaml b/kubernetes/apps/observability/alertmanager/silencer/helmrelease.yaml new file mode 100644 index 00000000..b304a8ea --- /dev/null +++ b/kubernetes/apps/observability/alertmanager/silencer/helmrelease.yaml @@ -0,0 +1,56 @@ +--- +# yaml-language-server: $schema=https://raw.githubusercontent.com/bjw-s/helm-charts/main/charts/other/app-template/schemas/helmrelease-helm-v2beta2.schema.json +apiVersion: helm.toolkit.fluxcd.io/v2beta2 +kind: HelmRelease +metadata: + name: alertmanager-silencer +spec: + interval: 30m + chart: + spec: + chart: app-template + version: 3.0.4 + sourceRef: + kind: HelmRepository + name: bjw-s + namespace: flux-system + install: + remediation: + retries: 3 + upgrade: + cleanupOnFail: true + remediation: + retries: 3 + strategy: rollback + dependsOn: + - name: kube-prometheus-stack + namespace: observability + values: + controllers: + alertmanager-silencer: + type: cronjob + cronjob: + schedule: "@daily" + containers: + app: + image: + repository: ghcr.io/onedr0p/kubanetics + tag: 2024.10.6 + env: + SCRIPT_NAME: alertmanager-silencer.sh + ALERTMANAGER_URL: http://alertmanager.observability.svc.cluster.local:9093 + MATCHERS_0: alertname=CephPGImbalance job=rook-ceph-exporter + securityContext: + allowPrivilegeEscalation: false + readOnlyRootFilesystem: true + capabilities: { drop: ["ALL"] } + resources: + requests: + cpu: 25m + limits: + memory: 128Mi + pod: + securityContext: + runAsUser: 568 + runAsGroup: 568 + runAsNonRoot: true diff --git a/kubernetes/apps/observability/alertmanager/silencer/kustomization.yaml b/kubernetes/apps/observability/alertmanager/silencer/kustomization.yaml new file mode 100644 index 00000000..17cbc72b --- /dev/null +++ b/kubernetes/apps/observability/alertmanager/silencer/kustomization.yaml @@ -0,0 +1,6 @@ +--- +# yaml-language-server: $schema=https://json.schemastore.org/kustomization +apiVersion: kustomize.config.k8s.io/v1beta1 +kind: Kustomization +resources: + - ./helmrelease.yaml