8 Commits

Author SHA1 Message Date
Raffael H
9b00f330b3 Update grafana datasource to be dynamically added 2023-10-10 14:14:10 +02:00
Raffael H
7bf01de75f Bump Chart version 2023-10-05 13:51:08 +02:00
Raffael H
9687f504e1 Update charts with placeholders 2023-10-05 13:47:03 +02:00
Raffael H
8e43add4da Add basic auth secret to setup 2023-08-10 16:07:42 +02:00
Raffael H
7a01cc94b6 Add separators to named templates 2023-08-10 15:29:04 +02:00
Raffael H
01fe8162c3 Release version 0.2.0 - this time really 2023-08-10 14:52:03 +02:00
Raffael H
68df02b47a Release version 0.2.0 2023-08-10 14:49:17 +02:00
Raffael H
d6a569fa0a Update port name in servicemonitor pushgateway 2023-08-10 13:47:08 +02:00
29 changed files with 157 additions and 32 deletions

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.1.0
version: 0.1.1
# 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

@@ -1,20 +0,0 @@
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
name: prometheus-{{ .Values.user }}
rules:
- apiGroups: [""]
resources:
- services
- endpoints
- pods
verbs: ["get", "list", "watch"]
- apiGroups: [""]
resources:
- configmaps
verbs: ["get"]
- apiGroups:
- networking.k8s.io
resources:
- ingresses
verbs: ["get", "list", "watch"]

View File

@@ -1 +1 @@
user: user1
user: userX # Replace me

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.1.4
version: 0.2.4
# 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

@@ -1,3 +1,5 @@
{{- define "alertmanager.alertmanager" }}
---
apiVersion: monitoring.coreos.com/v1
kind: Alertmanager
metadata:
@@ -5,3 +7,4 @@ metadata:
app.kubernetes.io/name: {{ .Values.user }}-am
name: {{ .Values.user }}-am
spec: {}
{{- end }}

View File

@@ -1,3 +1,5 @@
{{- define "blackboxexporter.cm" }}
---
apiVersion: v1
kind: ConfigMap
metadata:
@@ -34,3 +36,4 @@ data:
valid_status_codes: [400, 401, 402, 403, 404, 405, 406, 407, 408, 409, 410, 411, 412, 413, 414, 415, 416, 417, 421, 422, 423, 424, 425, 426, 428, 429, 431, 451, 418, 420, 444, 449, 499]
tcp_connect:
prober: tcp
{{- end }}

View File

@@ -1,3 +1,5 @@
{{- define "blackboxexporter.deploy" }}
---
apiVersion: apps/v1
kind: Deployment
metadata:
@@ -38,3 +40,4 @@ spec:
configMap:
defaultMode: 420
name: blackbox-exporter-config
{{- end }}

View File

@@ -1,3 +1,5 @@
{{- define "grafana.dashboardprovider" }}
---
kind: ConfigMap
apiVersion: v1
metadata:
@@ -15,3 +17,4 @@ data:
path: /var/lib/grafana/dashboards/general
orgId: 1
type: file
{{- end }}

View File

@@ -1,3 +1,5 @@
{{- define "grafana.datasource" }}
---
apiVersion: v1
kind: Secret
type: Opaque
@@ -16,3 +18,7 @@ stringData:
type: prometheus
url: http://thanos-query.{{ .Values.user }}-monitoring.svc.cluster.local:10902
version: 1
{{- if .Values.grafana.datasources }}
{{- toYaml .Values.grafana.datasources | nindent 6 }}
{{- end }}
{{- end }}

View File

@@ -1,3 +1,5 @@
{{- define "grafana.deploy" }}
---
apiVersion: apps/v1
kind: Deployment
metadata:
@@ -111,3 +113,4 @@ spec:
name: dashboard-volume
- emptyDir: {}
name: datasource-volume
{{- end }}

View File

@@ -1,3 +1,5 @@
{{- define "grafana.ingress" }}
---
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
@@ -23,3 +25,4 @@ spec:
- hosts:
- {{ .Values.user }}-grafana.training.cluster.acend.ch
secretName: acend-wildcard
{{- end }}

View File

@@ -1,3 +1,5 @@
{{- define "grafana.rolebinding" }}
---
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
@@ -11,3 +13,4 @@ roleRef:
subjects:
- kind: ServiceAccount
name: grafana
{{- end }}

View File

@@ -1,6 +1,9 @@
{{- define "grafana.sa" }}
---
apiVersion: v1
kind: ServiceAccount
metadata:
labels:
app.kubernetes.io/name: grafana
name: grafana
{{- end }}

View File

@@ -1,3 +1,5 @@
{{- define "grafana.svc" }}
---
apiVersion: v1
kind: Service
metadata:
@@ -13,3 +15,4 @@ spec:
selector:
app.kubernetes.io/name: grafana
type: ClusterIP
{{- end }}

View File

@@ -1,3 +1,5 @@
{{- define "prometheus.ingress" }}
---
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
@@ -25,3 +27,4 @@ spec:
- hosts:
- {{ .Values.user }}-prometheus.training.cluster.acend.ch
secretName: acend-wildcard
{{- end }}

View File

@@ -1,3 +1,5 @@
{{- define "prometheus.role" }}
---
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
@@ -20,3 +22,4 @@ rules:
resources:
- ingresses
verbs: ["get", "list", "watch"]
{{- end }}

View File

@@ -1,3 +1,5 @@
{{- define "prometheus.rolebinding" }}
---
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
@@ -11,3 +13,4 @@ roleRef:
subjects:
- kind: ServiceAccount
name: prometheus-{{ .Values.user }}
{{- end }}

View File

@@ -1,7 +1,9 @@
{{- define "prometheus.sa" }}
---
apiVersion: v1
kind: ServiceAccount
metadata:
labels:
app.kubernetes.io/name: prometheus-{{ .Values.user }}
name: prometheus-{{ .Values.user }}
{{- end }}

View File

@@ -1,3 +1,5 @@
{{- define "prometheus.prometheus" }}
---
apiVersion: monitoring.coreos.com/v1
kind: Prometheus
metadata:
@@ -25,3 +27,4 @@ spec:
enableAdminAPI: true
externalLabels:
monitoring: {{ .Values.user }}
{{- end }}

View File

@@ -1,3 +1,5 @@
{{- define "pushgateway.deploy" }}
---
apiVersion: apps/v1
kind: Deployment
metadata:
@@ -28,3 +30,4 @@ spec:
httpGet:
path: /-/ready
port: web
{{- end }}

View File

@@ -1,3 +1,5 @@
{{- define "pushgateway.servicemonitor" }}
---
apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
@@ -7,9 +9,10 @@ metadata:
spec:
endpoints:
- interval: 30s
port: web
port: http
honorLabels: true
namespaceSelector: {}
selector:
matchLabels:
app.kubernetes.io/name: pushgateway
{{- end }}

View File

@@ -1,3 +1,5 @@
{{- define "pushgateway.svc" }}
---
apiVersion: v1
kind: Service
metadata:
@@ -13,3 +15,4 @@ spec:
selector:
app.kubernetes.io/name: pushgateway
type: ClusterIP
{{- end }}

View File

@@ -1,3 +1,5 @@
{{- define "query.deploy" }}
---
apiVersion: apps/v1
kind: Deployment
metadata:
@@ -32,3 +34,4 @@ spec:
name: http
- containerPort: 10901
name: grpc
{{- end }}

View File

@@ -1,3 +1,5 @@
{{- define "query.ingress" }}
---
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
@@ -25,3 +27,4 @@ spec:
- hosts:
- {{ .Values.user }}-thanos-query.training.cluster.acend.ch
secretName: acend-wildcard
{{- end }}

View File

@@ -1,3 +1,5 @@
{{- define "query.svc" }}
---
apiVersion: v1
kind: Service
metadata:
@@ -13,3 +15,4 @@ spec:
selector:
app.kubernetes.io/name: thanos-query
type: ClusterIP
{{- end }}

View File

@@ -1,3 +1,5 @@
{{- define "ruler.ingress" }}
---
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
@@ -5,11 +7,11 @@ metadata:
haproxy.org/auth-secret: basic-auth
haproxy.org/auth-type: basic-auth
haproxy.org/auth-realm: Authentication Required
name: user1-thanos-ruler
name: {{ .Values.user }}-thanos-ruler
spec:
ingressClassName: haproxy
rules:
- host: user1-thanos-ruler.training.cluster.acend.ch
- host: {{ .Values.user }}-thanos-ruler.training.cluster.acend.ch
http:
paths:
- backend:
@@ -21,5 +23,6 @@ spec:
pathType: ImplementationSpecific
tls:
- hosts:
- user1-thanos-ruler.training.cluster.acend.ch
- {{ .Values.user }}-thanos-ruler.training.cluster.acend.ch
secretName: acend-wildcard
{{- end }}

View File

@@ -1,3 +1,5 @@
{{- define "ruler.ruler" }}
---
apiVersion: monitoring.coreos.com/v1
kind: ThanosRuler
metadata:
@@ -13,3 +15,4 @@ spec:
ruleNamespaceSelector:
matchLabels:
user: {{ .Values.user }}
{{- end }}

View File

@@ -0,0 +1,44 @@
# alertmanager
{{- if .Values.alertmanager.enabled }}
{{- template "alertmanager.alertmanager" . }}
{{- end }}
# grafana
{{- if .Values.grafana.enabled }}
{{- template "grafana.datasource" . }}
{{- template "grafana.dashboardprovider" . }}
{{- template "grafana.rolebinding" . }}
{{- template "grafana.svc" . }}
{{- template "grafana.sa" . }}
{{- template "grafana.deploy" . }}
{{- template "grafana.ingress" . }}
{{- end }}
# prometheus
{{- if .Values.prometheus.enabled }}
{{- template "prometheus.ingress" . }}
{{- template "prometheus.prometheus" . }}
{{- template "prometheus.role" . }}
{{- template "prometheus.rolebinding" . }}
{{- template "prometheus.sa" . }}
{{- end }}
{{- if .Values.pushgateway.enabled }}
{{- template "pushgateway.deploy" . }}
{{- template "pushgateway.servicemonitor" . }}
{{- template "pushgateway.svc" . }}
{{- end }}
# thanos-ruler
{{- if .Values.ruler.enabled }}
{{- template "ruler.ruler" . }}
{{- template "ruler.ingress" . }}
{{- end }}
# thanos-query
{{- if .Values.query.enabled }}
{{- template "query.deploy" . }}
{{- template "query.ingress" . }}
{{- template "query.svc" . }}
{{- end }}

View File

@@ -1 +1,31 @@
user: user1
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
# prometheus
prometheus:
enabled: false
# pushgateway
pushgateway:
enabled: false
# thanos-ruler
ruler:
enabled: false
# thanos-query
query:
enabled: false