From de87bcf50b8a439cac4f61f2ed2a2822c578e1d4 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?S=C3=B6ren=20Henning?= <post@soeren-henning.de>
Date: Mon, 11 May 2020 11:26:24 +0200
Subject: [PATCH] Add prometheues configuration

---
 .../prometheus/cluster-role-binding.yaml       | 12 ++++++++++++
 .../prometheus/cluster-role.yaml               | 18 ++++++++++++++++++
 .../infrastructure/prometheus/prometheus.yaml  | 15 +++++++++++++++
 .../prometheus/service-account.yaml            |  4 ++++
 4 files changed, 49 insertions(+)
 create mode 100644 execution/infrastructure/prometheus/cluster-role-binding.yaml
 create mode 100644 execution/infrastructure/prometheus/cluster-role.yaml
 create mode 100644 execution/infrastructure/prometheus/prometheus.yaml
 create mode 100644 execution/infrastructure/prometheus/service-account.yaml

diff --git a/execution/infrastructure/prometheus/cluster-role-binding.yaml b/execution/infrastructure/prometheus/cluster-role-binding.yaml
new file mode 100644
index 000000000..5369e02aa
--- /dev/null
+++ b/execution/infrastructure/prometheus/cluster-role-binding.yaml
@@ -0,0 +1,12 @@
+apiVersion: rbac.authorization.k8s.io/v1beta1
+kind: ClusterRoleBinding
+metadata:
+  name: prometheus
+roleRef:
+  apiGroup: rbac.authorization.k8s.io
+  kind: ClusterRole
+  name: prometheus
+subjects:
+- kind: ServiceAccount
+  name: prometheus
+  namespace: titan-scalability
\ No newline at end of file
diff --git a/execution/infrastructure/prometheus/cluster-role.yaml b/execution/infrastructure/prometheus/cluster-role.yaml
new file mode 100644
index 000000000..299ebd0a3
--- /dev/null
+++ b/execution/infrastructure/prometheus/cluster-role.yaml
@@ -0,0 +1,18 @@
+apiVersion: rbac.authorization.k8s.io/v1beta1
+kind: ClusterRole
+metadata:
+  name: prometheus
+rules:
+- apiGroups: [""]
+  resources:
+  - nodes
+  - services
+  - endpoints
+  - pods
+  verbs: ["get", "list", "watch"]
+- apiGroups: [""]
+  resources:
+  - configmaps
+  verbs: ["get"]
+- nonResourceURLs: ["/metrics"]
+  verbs: ["get"]
\ No newline at end of file
diff --git a/execution/infrastructure/prometheus/prometheus.yaml b/execution/infrastructure/prometheus/prometheus.yaml
new file mode 100644
index 000000000..2cec39877
--- /dev/null
+++ b/execution/infrastructure/prometheus/prometheus.yaml
@@ -0,0 +1,15 @@
+apiVersion: monitoring.coreos.com/v1
+kind: Prometheus
+metadata:
+  name: prometheus
+spec:
+  serviceAccountName: prometheus
+  serviceMonitorSelector:
+    matchLabels:
+      #app: cp-kafka
+      appScope: titan-ccp
+  resources:
+    requests:
+      memory: 400Mi
+  #scrapeInterval: 1s
+  enableAdminAPI: true
\ No newline at end of file
diff --git a/execution/infrastructure/prometheus/service-account.yaml b/execution/infrastructure/prometheus/service-account.yaml
new file mode 100644
index 000000000..f671fc5ab
--- /dev/null
+++ b/execution/infrastructure/prometheus/service-account.yaml
@@ -0,0 +1,4 @@
+apiVersion: v1
+kind: ServiceAccount
+metadata:
+  name: prometheus
\ No newline at end of file
-- 
GitLab