diff --git a/system-apps/monitoring/templates/discord-webhook-secret.yaml b/system-apps/monitoring/templates/discord-webhook-secret.yaml new file mode 100644 index 0000000..9c96d96 --- /dev/null +++ b/system-apps/monitoring/templates/discord-webhook-secret.yaml @@ -0,0 +1,18 @@ +apiVersion: external-secrets.io/v1 +kind: ExternalSecret +metadata: + name: discord-webhook + namespace: {{ .Release.Namespace }} +spec: + refreshInterval: 1h + secretStoreRef: + name: weyma-vault + kind: ClusterSecretStore + target: + name: discord-webhook + creationPolicy: Owner + data: + - secretKey: webhook + remoteRef: + key: monitoring + property: discord_webhook \ No newline at end of file diff --git a/system-apps/monitoring/templates/discord.yaml b/system-apps/monitoring/templates/discord.yaml new file mode 100644 index 0000000..588cd68 --- /dev/null +++ b/system-apps/monitoring/templates/discord.yaml @@ -0,0 +1,66 @@ +{{- if .Values.discord.enabled }} +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: alertmanager-discord + namespace: {{ .Release.Namespace }} + labels: + app.kubernetes.io/name: alertmanager-discord + app.kubernetes.io/instance: {{ .Release.Name }} +spec: + selector: + matchLabels: + app: alertmanager-discord + template: + metadata: + labels: + app: alertmanager-discord + spec: + containers: + - name: alertmanager-discord + image: {{ .Values.discord.image | default "ghcr.io/rogerrum/alertmanager-discord:1.0.7" }} + ports: + - containerPort: 9094 + env: + - name: LISTEN_ADDRESS + value: "0.0.0.0:9094" + - name: DISCORD_WEBHOOK + valueFrom: + secretKeyRef: + name: {{ .Values.discord.secret.name | quote }} + key: {{ .Values.discord.secret.key | quote }} + {{- if .Values.discord.username }} + - name: DISCORD_USERNAME + value: {{ .Values.discord.username | quote }} + {{- end }} + {{- if .Values.discord.avatar_url }} + - name: DISCORD_AVATAR_URL + value: {{ .Values.discord.avatar_url | quote }} + {{- end }} + {{- if .Values.discord.verbose }} + - name: VERBOSE + value: "ON" + {{- end }} + resources: + requests: + memory: "128Mi" + cpu: "500m" + limits: + memory: "512Mi" + cpu: "1" +--- +apiVersion: v1 +kind: Service +metadata: + name: alertmanager-discord + namespace: {{ .Release.Namespace }} +spec: + type: ClusterIP + selector: + app: alertmanager-discord + ports: + - port: 9094 + targetPort: 9094 + protocol: TCP +{{- end }} \ No newline at end of file diff --git a/system-apps/monitoring/values.yaml b/system-apps/monitoring/values.yaml index 64f06ca..5362add 100644 --- a/system-apps/monitoring/values.yaml +++ b/system-apps/monitoring/values.yaml @@ -39,4 +39,10 @@ kube-prometheus-stack: requests: storage: 50Gi grafana: - enabled: false # Grafana is instead deployed in its own namespace in the core-apps repo \ No newline at end of file + enabled: false # Grafana is instead deployed in its own namespace in the core-apps repo +discord: + enabled: true + secret: + name: discord-webhook + key: webhook + verbose: true \ No newline at end of file