diff --git a/README.md b/README.md index 49fc3077bfbab83123ed593f28137e571b1600d4..361fa7f9166062a11b10c7914fde106addb03f6d 100644 --- a/README.md +++ b/README.md @@ -240,7 +240,7 @@ local kp = { ['kubernetes-' + name]: kp.kubernetesMixin[name] for name in std.objectFields(kp.kubernetesMixin) } { ['node-exporter-' + name]: kp.nodeExporter[name] for name in std.objectFields(kp.nodeExporter) } + { ['prometheus-' + name]: kp.prometheus[name] for name in std.objectFields(kp.prometheus) } + -{ ['prometheus-adapter-' + name]: kp.prometheusAdapter[name] for name in std.objectFields(kp.prometheusAdapter) } + +{ ['prometheus-adapter-' + name]: kp.prometheusAdapter[name] for name in std.objectFields(kp.prometheusAdapter) } ``` And here's the [build.sh](build.sh) script (which uses `vendor/` to render all manifests in a json structure of `{filename: manifest-content}`): @@ -596,7 +596,7 @@ In order to monitor additional namespaces, the Prometheus server requires the ap ```jsonnet local kp = (import 'kube-prometheus/main.libsonnet') + { values+:: { - common+: { + common+: { namespace: 'monitoring', }, diff --git a/docs/EKS-cni-support.md b/docs/EKS-cni-support.md index 90bef138ed0b61ceec905af3192846d1eaae7dec..4cb36bc975ea9b4351a403eb34f9fb8233ac219b 100644 --- a/docs/EKS-cni-support.md +++ b/docs/EKS-cni-support.md @@ -10,7 +10,7 @@ You can monitor the `awscni` using kube-promethus with : local kp = (import 'kube-prometheus/main.libsonnet') + (import 'kube-prometheus/platforms/eks.libsonnet') + { values+:: { - common+: { + common+: { namespace: 'monitoring', }, }, diff --git a/docs/developing-prometheus-rules-and-grafana-dashboards.md b/docs/developing-prometheus-rules-and-grafana-dashboards.md index 514fd03e74001524f26cf936ce7c3b0c990651c2..31babf72a80cf03e9005c6ed049b59b5207e38fe 100644 --- a/docs/developing-prometheus-rules-and-grafana-dashboards.md +++ b/docs/developing-prometheus-rules-and-grafana-dashboards.md @@ -44,7 +44,7 @@ local kp = { ['kubernetes-' + name]: kp.kubernetesMixin[name] for name in std.objectFields(kp.kubernetesMixin) } { ['node-exporter-' + name]: kp.nodeExporter[name] for name in std.objectFields(kp.nodeExporter) } + { ['prometheus-' + name]: kp.prometheus[name] for name in std.objectFields(kp.prometheus) } + -{ ['prometheus-adapter-' + name]: kp.prometheusAdapter[name] for name in std.objectFields(kp.prometheusAdapter) } + +{ ['prometheus-adapter-' + name]: kp.prometheusAdapter[name] for name in std.objectFields(kp.prometheusAdapter) } ``` ## Prometheus rules diff --git a/docs/weave-net-support.md b/docs/weave-net-support.md index 0ef65680ef492fdda3ced8babcebf6d326440ab3..8766bfc8388bf77e8ad5d6813895286166028621 100644 --- a/docs/weave-net-support.md +++ b/docs/weave-net-support.md @@ -18,14 +18,14 @@ Using kube-prometheus and kubectl you will be able install the following for mon [embedmd]:# (../examples/weave-net-example.jsonnet) ```jsonnet local kp = (import 'kube-prometheus/main.libsonnet') + - (import 'kube-prometheus/addons/weave-net.libsonnet') + { + (import 'kube-prometheus/addons/weave-net/weave-net.libsonnet') + { values+:: { common+: { namespace: 'monitoring', }, }, prometheus+: { - prometheusRule+: { + prometheusRuleWeaveNet+: { spec+: { groups: std.map( function(group) diff --git a/jsonnet/kube-prometheus/addons/config-mixins.libsonnet b/jsonnet/kube-prometheus/addons/config-mixins.libsonnet index ff8fd2979f506e96ec0c464f4435a19044ed7c20..79f25044b1f8756293e40fd786d0cbc440353abd 100644 --- a/jsonnet/kube-prometheus/addons/config-mixins.libsonnet +++ b/jsonnet/kube-prometheus/addons/config-mixins.libsonnet @@ -1,4 +1,18 @@ -local l = import 'lib/lib.libsonnet'; +local imageName(image) = + local parts = std.split(image, '/'); + local len = std.length(parts); + if len == 3 then + // registry.com/org/image + parts[2] + else if len == 2 then + // org/image + parts[1] + else if len == 1 then + // image, ie. busybox + parts[0] + else + error 'unknown image format: ' + image; + // withImageRepository is a mixin that replaces all images prefixes by repository. eg. // quay.io/coreos/addon-resizer -> $repository/addon-resizer @@ -6,8 +20,8 @@ local l = import 'lib/lib.libsonnet'; local withImageRepository(repository) = { local oldRepos = super._config.imageRepos, local substituteRepository(image, repository) = - if repository == null then image else repository + '/' + l.imageName(image), - _config+:: { + if repository == null then image else repository + '/' + imageName(image), + values+:: { imageRepos:: { [field]: substituteRepository(oldRepos[field], repository) for field in std.objectFields(oldRepos) diff --git a/jsonnet/kube-prometheus/addons/custom-metrics.libsonnet b/jsonnet/kube-prometheus/addons/custom-metrics.libsonnet index 55e03bd7186ed77579e31d0ea5301946f98a3972..06e9c5a0b22a53a4c56994fa40dd315281f899aa 100644 --- a/jsonnet/kube-prometheus/addons/custom-metrics.libsonnet +++ b/jsonnet/kube-prometheus/addons/custom-metrics.libsonnet @@ -78,7 +78,7 @@ }, }, - prometheusAdapter+:: { + prometheusAdapter+: { customMetricsApiService: { apiVersion: 'apiregistration.k8s.io/v1', kind: 'APIService', diff --git a/jsonnet/kube-prometheus/addons/static-etcd.libsonnet b/jsonnet/kube-prometheus/addons/static-etcd.libsonnet index d029d6c1ea6afa1c10a929a95db22aaf62bd4424..d49bc63392d2c440185ff6a94937b649fb99012b 100644 --- a/jsonnet/kube-prometheus/addons/static-etcd.libsonnet +++ b/jsonnet/kube-prometheus/addons/static-etcd.libsonnet @@ -9,7 +9,7 @@ insecureSkipVerify: null, }, }, - prometheus+:: { + prometheus+: { serviceEtcd: { apiVersion: 'v1', kind: 'Service',