From 6c0bcc403bf79d860709e8abcc547d898cd683fc Mon Sep 17 00:00:00 2001 From: elvis chan <78713260+elvischan-crypto@users.noreply.github.com> Date: Wed, 19 Oct 2022 15:17:07 +0100 Subject: [PATCH] fix jsonnet error with kube-prometheus >= v0.8 (#5687) * fix jsonnet error with kube-prometheus > v0.8 kubelet ServiceMonitor moved to kubernetesControlPlane starting from v0.8 Signed-off-by: elvis chan <78713260+elvischan-crypto@users.noreply.github.com> * Add not in custom-prometheuus.md about jsonnet version Signed-off-by: Sebastian Malton Signed-off-by: elvis chan <78713260+elvischan-crypto@users.noreply.github.com> Signed-off-by: Sebastian Malton Co-authored-by: Sebastian Malton --- jsonnet/lens/custom-prometheus.jsonnet | 2 +- troubleshooting/custom-prometheus.md | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/jsonnet/lens/custom-prometheus.jsonnet b/jsonnet/lens/custom-prometheus.jsonnet index 9c733766ba..10384fdaa5 100644 --- a/jsonnet/lens/custom-prometheus.jsonnet +++ b/jsonnet/lens/custom-prometheus.jsonnet @@ -24,7 +24,7 @@ }, }, }, - prometheus+:: { + kubernetesControlPlane+:: { serviceMonitorKubelet+: { spec+: { endpoints: std.map(function(endpoint) diff --git a/troubleshooting/custom-prometheus.md b/troubleshooting/custom-prometheus.md index 3f9b746394..d0df10fd1d 100644 --- a/troubleshooting/custom-prometheus.md +++ b/troubleshooting/custom-prometheus.md @@ -31,14 +31,15 @@ metricRelabelings: ### Jsonnet -The required label replacements are bundled in [jsonnet/lens/custom-prometheus](../jsonnet/lens/custom-prometheus.jsonnet). To install it copy the file or use -[Jsonnet Bundler](https://github.com/jsonnet-bundler/jsonnet-bundler). +The required label replacements are bundled in [jsonnet/lens/custom-prometheus](../jsonnet/lens/custom-prometheus.jsonnet). +This file is currently for jsonnet versions >= 0.8.0 +To install it copy the file or use [Jsonnet Bundler](https://github.com/jsonnet-bundler/jsonnet-bundler). ```bash jb init && jb install https://github.com/lensapp/lens/jsonnet/lens@master ``` -When the installation was successful include it into your definitions. Using the [example](https://github.com/coreos/kube-prometheus#compiling) +When the installation was successful include it into your definitions. Using the [example](https://github.com/coreos/kube-prometheus#compiling) of kube-prometheus, e.g.: ``` @@ -60,4 +61,3 @@ local kp = ``` helm upgrade --set server.global.scrape_interval=30s prometheus stable/prometheus ``` -