ops/monitoring: split up jsonnet, add simple docs
Change-Id: I8120958a6862411de0446896875766834457aba9
diff --git a/ops/monitoring/doc/index.md b/ops/monitoring/doc/index.md
new file mode 100644
index 0000000..b17287c
--- /dev/null
+++ b/ops/monitoring/doc/index.md
@@ -0,0 +1,38 @@
+Monitoring
+==========
+
+Setting up monitoring in hscloud is a work in progress.
+
+Components
+----------
+
+Currently we have a per-cluster setup with prometheus scraping Kubernetes nodes
+(kubeletes) for kubelet metrics and cAdvisor metrics.
+
+ .-----------------------------------------------------------.
+ | k0.hswaw.net |
+ |-----------------------------------------------------------|
+ | .---------------------. |
+ | | ns: metrics-cluster | .--------------------------. |
+ | |---------------------| | kubernetes.svc.cluster | |
+ | | prometheus |--> | apiserver proxy to nodes | |
+ | '---------------------' '--------------------------' |
+ | | |
+ '---------------------------------------- v ----------------'
+ .---------------------.
+ | bc0n01.hswaw.net |-.
+ Kubernetes |---------------------| |-.
+ Nodes | /metrics |-| |
+ | /metrics/cadvisor | |-|
+ '---------------------' | |
+ '---------------------' |
+ '---------------------'
+
+Everything else (dashboard, aggregation, user metrics) is a work in progress.
+
+Legacy
+------
+
+There is a legacy prometheus/grafana VM on https://metrics.hackerspace.pl/. The
+certificate is expired, but it Generally Works, and will be kept going until
+its functionality is migrated to hscloud.
diff --git a/ops/monitoring/k0.jsonnet b/ops/monitoring/k0.jsonnet
new file mode 100644
index 0000000..028a463
--- /dev/null
+++ b/ops/monitoring/k0.jsonnet
@@ -0,0 +1,11 @@
+local lib = import "lib.libsonnet";
+
+{
+ cluster: lib.Cluster("k0") {
+ cfg+: {
+ storageClasses+: {
+ prometheus: "waw-hdd-redundant-3",
+ },
+ },
+ },
+}
diff --git a/ops/monitoring/lib.libsonnet b/ops/monitoring/lib.libsonnet
new file mode 100644
index 0000000..61f49b4
--- /dev/null
+++ b/ops/monitoring/lib.libsonnet
@@ -0,0 +1,5 @@
+local cluster = import "lib/cluster.libsonnet";
+
+{
+ Cluster: cluster.Cluster,
+}
diff --git a/ops/monitoring/kube.jsonnet b/ops/monitoring/lib/cluster.libsonnet
similarity index 96%
rename from ops/monitoring/kube.jsonnet
rename to ops/monitoring/lib/cluster.libsonnet
index 919ca7d..9b64f05 100644
--- a/ops/monitoring/kube.jsonnet
+++ b/ops/monitoring/lib/cluster.libsonnet
@@ -1,8 +1,9 @@
-local kube = import "../../kube/kube.libsonnet";
+local kube = import "../../../kube/kube.libsonnet";
{
- local top = self,
- // Per-cluster components
+ // Cluster sets up all cluster-specific monitoring resources in their own namespace.
+ // Currently this consists of a prometheus server that scrapes k8s nodes for kubelet
+ // and cAdvisor metrics.
Cluster(name):: {
local cluster = self,
local cfg = cluster.cfg,
@@ -15,7 +16,7 @@
},
storageClasses: {
- prometheus: "waw-hdd-redundant-3",
+ prometheus: error "storageClasses.prometheus must be set",
},
},
@@ -223,6 +224,4 @@
},
},
},
-
- k0: top.Cluster("k0"),
}