monitoring: global: implement
This creates a basic Global instance, running Victoria Metrics on k0.
Change-Id: Ib03003213d79b41cc54efe40cd2c4837f652c0f4
diff --git a/ops/monitoring/lib/cluster.libsonnet b/ops/monitoring/lib/cluster.libsonnet
index 9b64f05..511d426 100644
--- a/ops/monitoring/lib/cluster.libsonnet
+++ b/ops/monitoring/lib/cluster.libsonnet
@@ -2,8 +2,10 @@
{
// 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.
+ // and cAdvisor metrics, and possibly ships over metrics to the global tier via set
+ // upstreams.
Cluster(name):: {
local cluster = self,
local cfg = cluster.cfg,
@@ -18,6 +20,17 @@
storageClasses: {
prometheus: error "storageClasses.prometheus must be set",
},
+
+ // Username used to authenticate to upstreams.
+ username: error "username must be set",
+
+ // Global tier upstreams that this cluster should ship metrics off to.
+ // List of
+ // {
+ // remote: URL of upstream
+ // password: password used to authenticate, in conjunction with cfg.username.
+ //
+ upstreams: [],
},
namespace: kube.Namespace(cfg.namespace),
@@ -105,6 +118,17 @@
],
},
],
+
+ remote_write: [
+ {
+ url: u.remote,
+ basic_auth: {
+ username: cluster.cfg.username,
+ password: u.password,
+ },
+ }
+ for u in cluster.cfg.upstreams
+ ],
},
configmap: kube.ConfigMap("prometheus-cluster") {
@@ -152,9 +176,7 @@
"/bin/prometheus",
"--config.file=/etc/prometheus/prometheus.yml",
"--storage.tsdb.path=/prometheus",
- # TODO(q3k): reduce this once we have a long-term storage
- # solution.
- "--storage.tsdb.retention.time=120d",
+ "--storage.tsdb.retention.size=10GB",
"--web.console.libraries=/usr/share/prometheus/console_libraries",
"--web.console.templates=/usr/share/prometheus/consoles",
"--web.enable-lifecycle",
@@ -198,7 +220,7 @@
accessModes: ["ReadWriteOnce"],
resources: {
requests: {
- storage: "32Gi",
+ storage: "16Gi",
},
},
},