Compare commits

...

23 Commits

Author SHA1 Message Date
Raffael H
e0af833bff Update alertmanager config 2023-10-17 16:07:57 +02:00
Thomas Philipona
7c36030329
Add mailcatcher config 2023-10-16 22:50:14 +02:00
Thomas Philipona
226156b36a
Fix Thanos ruler 2023-10-16 22:30:44 +02:00
Thomas Philipona
c2f4139315
Update AM config 2023-10-16 21:32:39 +02:00
Thomas Philipona
9e1610443f
Fix am 2023-10-16 20:35:08 +02:00
Thomas Philipona
530acdb363
add AM resources 2023-10-16 19:47:48 +02:00
Thomas Philipona
d5ebb49393
Merge pull request #1 from acend/add/mailcatcher
Add mailcatcher templates
2023-10-16 19:44:20 +02:00
Raffael H
a747f04036 Update thanos sidecar and store config 2023-10-16 13:51:48 +02:00
Thomas Philipona
1afef4726f
don't pull always 2023-10-15 18:35:36 +02:00
Thomas Philipona
b52f889da1 Reorder values 2023-10-15 12:48:36 +02:00
Thomas Philipona
e47ae75947 Fix blackbox svc name 2023-10-15 12:24:00 +02:00
Thomas Philipona
753c3dd95f Add Grafana service monitor and simplify datasource 2023-10-14 13:00:47 +02:00
Thomas Philipona
628f64b1e8 Remove Grafana Datasource 2023-10-14 11:59:06 +02:00
Thomas Philipona
a88b2af56d Initial values.yaml default 2023-10-14 11:56:47 +02:00
Thomas Philipona
faecd0aa8d Add Prometheus Service Monitor 2023-10-14 11:44:56 +02:00
madchr1st
909ac9b911 Add mailcatcher templates 2023-10-13 15:26:01 +00:00
Raffael H
905d5a2d09 Add blackboxexporter 2023-10-12 18:21:37 +02:00
Raffael H
0ad1aae355 Fix thanos version and store 2023-10-12 18:09:34 +02:00
Thomas Philipona
dbb0cc23da
Fix layout 2023-10-12 12:20:48 +02:00
Thomas Philipona
73c8c6435f
Update Scrape interval 2023-10-12 11:36:53 +02:00
Thomas Philipona
7385c2af41
Remove User Value from Argo App 2023-10-12 10:04:05 +02:00
Thomas Philipona
4482493d5f
Fixes Argo App Setup 2023-10-12 09:26:43 +02:00
Raffael H
00ba693670 Change structure of argo applications 2023-10-11 15:26:13 +02:00
22 changed files with 292 additions and 80 deletions

View File

@ -11,11 +11,8 @@ spec:
project: default
source:
repoURL: 'https://gitea.training.cluster.acend.ch/<user>/prometheus-training-lab-setup'
path: charts/user-monitoring-demo/
path: user-demo/
targetRevision: main
helm:
values: |
user: <user>
syncPolicy:
automated:
prune: true

View File

@ -13,27 +13,6 @@ spec:
repoURL: 'https://gitea.training.cluster.acend.ch/<user>/prometheus-training-lab-setup'
path: charts/user-monitoring/
targetRevision: main
helm:
values: |
user: <user>
# alertmanager
alertmanager:
enabled: false
# grafana
grafana:
enabled: false
# prometheus
prometheus:
enabled: false
# pushgateway
pushgateway:
enabled: false
# thanos-ruler
ruler:
enabled: false
# thanos-query
query:
enabled: false
syncPolicy:
automated:
prune: true

View File

@ -16,6 +16,6 @@ spec:
spec:
containers:
- image: quay.io/acend/example-web-python
imagePullPolicy: Always
imagePullPolicy: IfNotPresent
name: example-web-python
restartPolicy: Always

View File

@ -15,7 +15,7 @@ type: application
# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/)
version: 0.2.5
version: 0.2.6
# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application. Versions are not expected to

View File

@ -0,0 +1,23 @@
{{- define "alertmanager.config-mailcatcher" }}
---
apiVersion: monitoring.coreos.com/v1alpha1
kind: AlertmanagerConfig
metadata:
name: {{ .Values.user }}-mailcatcher
labels:
alertmanagerConfig: {{ .Values.user }}-alertmanager
spec:
route:
groupBy: ['job']
groupWait: 30s
groupInterval: 5m
repeatInterval: 12h
receiver: 'mailcatcher'
receivers:
- name: 'mailcatcher'
emailConfigs:
- to: alert@localhost
from: prometheus-operator@localhost
smarthost: mailcatcher:1025
requireTLS: false
{{- end }}

View File

@ -0,0 +1,21 @@
{{- define "alertmanager.servicemonitor" }}
---
apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
labels:
app.kubernetes.io/name: mariadb
name: alertmanager
spec:
endpoints:
- interval: 60s
port: web
scheme: http
path: /metrics
namespaceSelector:
matchNames:
- {{ .Values.user }}-monitoring
selector:
matchLabels:
operated-alertmanager: 'true'
{{- end }}

View File

@ -4,7 +4,51 @@ apiVersion: monitoring.coreos.com/v1
kind: Alertmanager
metadata:
labels:
app.kubernetes.io/name: {{ .Values.user }}-am
name: {{ .Values.user }}-am
spec: {}
app.kubernetes.io/name: {{ .Values.user }}-alertmanager
name: {{ .Values.user }}-alertmanager
spec:
alertmanagerConfigNamespaceSelector:
matchLabels:
user: {{ .Values.user }}-alertmanager
alertmanagerConfigSelector:
matchLabels:
alertmanagerConfig: {{ .Values.user }}-alertmanager
image: quay.io/prometheus/alertmanager:v0.25.0
replicas: 1
resources:
requests:
cpu: 10m
memory: 40Mi
storage:
volumeClaimTemplate:
spec:
resources:
requests:
storage: 100Mi
---
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
annotations:
haproxy.org/auth-secret: basic-auth
haproxy.org/auth-type: basic-auth
haproxy.org/auth-realm: Authentication Required
name: {{ .Values.user }}-alertmanager
spec:
ingressClassName: haproxy
rules:
- host: {{ .Values.user }}-alertmanager.training.cluster.acend.ch
http:
paths:
- backend:
service:
name: alertmanager-operated
port:
number: 9093
path: /
pathType: ImplementationSpecific
tls:
- hosts:
- {{ .Values.user }}-alertmanager.training.cluster.acend.ch
secretName: acend-wildcard
{{- end }}

View File

@ -0,0 +1,18 @@
{{- define "blackboxexporter.svc" }}
---
apiVersion: v1
kind: Service
metadata:
name: blackbox
labels:
app.kubernetes.io/name: blackbox-exporter
spec:
ports:
- name: http
port: 9115
protocol: TCP
targetPort: 9115
selector:
app.kubernetes.io/name: blackbox-exporter
type: ClusterIP
{{- end }}

View File

@ -16,7 +16,7 @@ stringData:
access: proxy
editable: false
type: prometheus
url: http://thanos-query.{{ .Values.user }}-monitoring.svc.cluster.local:10902
url: http://thanos-query:10902
version: 1
{{- if .Values.grafana.datasources }}
{{- toYaml .Values.grafana.datasources | nindent 6 }}

View File

@ -0,0 +1,23 @@
{{- define "grafana.servicemonitor" }}
---
apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
name: grafana-monitor
spec:
endpoints:
- basicAuth:
password:
name: basic-auth
key: {{ .Values.user }}
username:
name: basic-auth
key: grafana_user
interval: 60s
port: http
scheme: http
path: /metrics
selector:
matchLabels:
app.kubernetes.io/name: grafana
{{- end }}

View File

@ -0,0 +1,28 @@
{{- define "mailcatcher.deploy" }}
---
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
app.kubernetes.io/name: mailcatcher
name: mailcatcher
namespace: {{ .Values.user }}-monitoring
spec:
replicas: 1
selector:
matchLabels:
app.kubernetes.io/name: mailcatcher
template:
metadata:
labels:
app.kubernetes.io/name: mailcatcher
spec:
containers:
- image: sj26/mailcatcher:v0.9.0
name: mailcatcher
ports:
- containerPort: 1080
name: http
- containerPort: 1025
name: smtp
{{- end }}

View File

@ -0,0 +1,30 @@
{{- define "mailcatcher.ingress" }}
---
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
annotations:
haproxy.org/auth-secret: basic-auth
haproxy.org/auth-type: basic-auth
haproxy.org/auth-realm: Authentication Required
labels:
app.kubernetes.io/name: {{ .Values.user }}-mailcatcher
name: {{ .Values.user }}-mailcatcher
spec:
ingressClassName: haproxy
rules:
- host: {{ .Values.user }}-mailcatcher.training.cluster.acend.ch
http:
paths:
- backend:
service:
name: mailcatcher
port:
number: 1080
path: /
pathType: ImplementationSpecific
tls:
- hosts:
- {{ .Values.user }}-mailcatcher.training.cluster.acend.ch
secretName: acend-wildcard
{{- end }}

View File

@ -0,0 +1,22 @@
{{- define "mailcatcher.svc" }}
---
apiVersion: v1
kind: Service
metadata:
name: mailcatcher
labels:
app.kubernetes.io/name: mailcatcher
spec:
ports:
- name: http
port: 1080
protocol: TCP
targetPort: http
- name: smtp
port: 1025
protocol: TCP
targetPort: smtp
selector:
app.kubernetes.io/name: mailcatcher
type: ClusterIP
{{- end }}

View File

@ -0,0 +1,20 @@
{{- define "prometheus.servicemonitor" }}
---
apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
labels:
app.kubernetes.io/name: prometheus
user: {{ .Values.user }}
name: {{ .Values.user }}-prometheus-servicemonitor
spec:
endpoints:
- path: /metrics
port: web
namespaceSelector:
matchNames:
- {{ .Values.user }}-monitoring
selector:
matchLabels:
operated-prometheus: 'true'
{{- end }}

View File

@ -7,7 +7,11 @@ metadata:
app.kubernetes.io/name: prometheus
name: prometheus
spec:
scrapeInterval: 10s
{{- if .Values.query.enabled }}
thanos:
image: quay.io/thanos/thanos:v0.32.3
{{- end }}
scrapeInterval: 60s
serviceAccountName: prometheus-{{ .Values.user }}
serviceMonitorNamespaceSelector:
matchLabels:

View File

@ -25,9 +25,11 @@ spec:
- --query.replica-label=thanos_ruler_replica
- --endpoint=prometheus-operated.{{ .Values.user }}-monitoring.svc.cluster.local:10901
- --endpoint=thanos-ruler-operated.{{ .Values.user }}-monitoring.svc.cluster.local:10901
- --endpoint=prometheus-operated.monitoring.svc.cluster.local:10901
- --store=dnssrv+prometheus-operated.{{ .Values.user }}-monitoring.svc.cluster.local
- --store=dnssrv+_web._tcp.prometheus-operated.{{ .Values.user }}-monitoring.svc.cluster.local
- --store=dnssrv+_grpc._tcp.kube-prometheus-stack-thanos-discovery.monitoring.svc.cluster.local
- --store.unhealthy-timeout=3d
image: quay.io/thanos/thanos:v0.25.1
image: quay.io/thanos/thanos:v0.32.3
name: thanos-query
ports:
- containerPort: 10902

View File

@ -7,12 +7,26 @@ metadata:
app.kubernetes.io/name: thanos-ruler
name: thanos-ruler
spec:
alertQueryUrl: {{ .Values.user }}-thanos-query.training.cluster.acend.ch
image: quay.io/thanos/thanos:v0.28.1
evaluationInterval: 10s
queryEndpoints:
- thanos-query.{{ .Values.user }}-monitoring.svc.cluster.local:10902
- dnssrv+_http._tcp.thanos-query:10902
ruleSelector: {}
ruleNamespaceSelector:
matchLabels:
user: {{ .Values.user }}
alertmanagersConfig:
key: alertmanager-configs.yaml
name: thanosruler-alertmanager-config
---
apiVersion: v1
kind: Secret
metadata:
name: thanosruler-alertmanager-config
stringData:
alertmanager-configs.yaml: |-
alertmanagers:
- static_configs:
- "dnssrv+_web._tcp.alertmanager-operated.{{ .Values.user }}-monitoring.svc.cluster.local"
api_version: v2
{{- end }}

View File

@ -2,6 +2,18 @@
{{- if .Values.alertmanager.enabled }}
{{- template "alertmanager.alertmanager" . }}
{{- template "alertmanager.servicemonitor" . }}
{{- template "alertmanager.config-mailcatcher" . }}
{{- template "mailcatcher.deploy" . }}
{{- template "mailcatcher.svc" . }}
{{- template "mailcatcher.ingress" . }}
{{- end }}
# blackboxexporter
{{- if .Values.blackboxexporter.enabled }}
{{- template "blackboxexporter.cm" . }}
{{- template "blackboxexporter.deploy" . }}
{{- template "blackboxexporter.svc" . }}
{{- end }}
# grafana
@ -12,6 +24,7 @@
{{- template "grafana.svc" . }}
{{- template "grafana.sa" . }}
{{- template "grafana.deploy" . }}
{{- template "grafana.servicemonitor" . }}
{{- template "grafana.ingress" . }}
{{- end }}
@ -19,6 +32,7 @@
{{- if .Values.prometheus.enabled }}
{{- template "prometheus.ingress" . }}
{{- template "prometheus.prometheus" . }}
{{- template "prometheus.servicemonitor" . }}
{{- template "prometheus.role" . }}
{{- template "prometheus.rolebinding" . }}
{{- template "prometheus.sa" . }}

View File

@ -2,7 +2,7 @@ apiVersion: v1
data:
admin: JDEkSzNRZUlsOHAkZVZZb1h2RERNWk40b3RJT2tBc3AwLw== # $(openssl passwd -1 admin)
{{ .Values.user }}: JDEkSzNRZUlsOHAkZVZZb1h2RERNWk40b3RJT2tBc3AwLw== # $(openssl passwd -1 admin)
grafana_user: {{ .Values.user }}
grafana_user: {{ .Values.user | b64enc }}
kind: Secret
metadata:
labels:

View File

@ -1,31 +1,22 @@
user: userX # Replace me
# alertmanager
alertmanager:
enabled: false
# grafana
grafana:
datasources:
- name: prometheus
access: proxy
editable: false
type: prometheus
url: http://prometheus-operated.user4-monitoring.svc.cluster.local:9090
enabled: true
user: <user> # Replace me
# prometheus
prometheus:
enabled: false
# pushgateway
pushgateway:
enabled: false
# thanos-ruler
ruler:
enabled: false
# thanos-query
query:
enabled: false
# grafana
grafana:
enabled: false
# blackboxexporter
blackboxexporter:
enabled: false
# pushgateway
pushgateway:
enabled: false
# alertmanager
alertmanager:
enabled: false
# thanos-ruler
ruler:
enabled: false

3
user-demo/README.md Normal file
View File

@ -0,0 +1,3 @@
# Readme
This is the location for the user demo app.

View File

@ -1,21 +0,0 @@
---
apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
name: <user>-umbrella
namespace: argocd
spec:
destination:
namespace: argocd
server: https://kubernetes.default.svc
project: default
source:
repoURL: 'https://gitea.training.cluster.acend.ch/<user>/prometheus-training-lab-setup'
path: apps/
targetRevision: main
syncPolicy:
automated:
prune: true
selfHeal: true
syncOptions:
- Replace=true