Skip to content

Commit

Permalink
Merge pull request prometheus-operator#1678 from dnsmichi/docs-mon-na…
Browse files Browse the repository at this point in the history
…mespaces-0-8-values

Docs: Use `values` config in 'Monitoring other namespaces' example
  • Loading branch information
philipgough authored Mar 14, 2022
2 parents 2e78414 + 16f3640 commit 373e2b4
Showing 1 changed file with 27 additions and 14 deletions.
41 changes: 27 additions & 14 deletions docs/monitoring-other-namespaces.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,22 +22,35 @@ This is done in the variable `prometheus.roleSpecificNamespaces`. You usually se
Example to create the needed `Role` and `RoleBinding` for the Namespace `foo` :

```
local kp = (import 'kube-prometheus/main.libsonnet') + {
_config+:: {
namespace: 'monitoring',
local kp =
(import 'kube-prometheus/main.libsonnet') +
{
values+:: {
common+: {
namespace: 'monitoring',
},
prometheus+:: {
namespaces: ["default", "kube-system", "foo"],
prometheus+:: {
namespaces: ["default", "kube-system", "monitoring", "foo"],
},
},
},
};
{ ['00namespace-' + name]: kp.kubePrometheus[name] for name in std.objectFields(kp.kubePrometheus) } +
{ ['0prometheus-operator-' + name]: kp.prometheusOperator[name] for name in std.objectFields(kp.prometheusOperator) } +
{ ['node-exporter-' + name]: kp.nodeExporter[name] for name in std.objectFields(kp.nodeExporter) } +
{ ['kube-state-metrics-' + name]: kp.kubeStateMetrics[name] for name in std.objectFields(kp.kubeStateMetrics) } +
};
{ 'setup/0namespace-namespace': kp.kubePrometheus.namespace } +
{
['setup/prometheus-operator-' + name]: kp.prometheusOperator[name]
for name in std.filter((function(name) name != 'serviceMonitor' && name != 'prometheusRule'), std.objectFields(kp.prometheusOperator))
} +
// serviceMonitor and prometheusRule are separated so that they can be created after the CRDs are ready
{ 'prometheus-operator-serviceMonitor': kp.prometheusOperator.serviceMonitor } +
{ 'prometheus-operator-prometheusRule': kp.prometheusOperator.prometheusRule } +
{ 'kube-prometheus-prometheusRule': kp.kubePrometheus.prometheusRule } +
{ ['alertmanager-' + name]: kp.alertmanager[name] for name in std.objectFields(kp.alertmanager) } +
{ ['blackbox-exporter-' + name]: kp.blackboxExporter[name] for name in std.objectFields(kp.blackboxExporter) } +
{ ['grafana-' + name]: kp.grafana[name] for name in std.objectFields(kp.grafana) } +
{ ['kube-state-metrics-' + name]: kp.kubeStateMetrics[name] for name in std.objectFields(kp.kubeStateMetrics) } +
{ ['kubernetes-' + name]: kp.kubernetesControlPlane[name] for name in std.objectFields(kp.kubernetesControlPlane) }
{ ['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) } +
{ ['grafana-' + name]: kp.grafana[name] for name in std.objectFields(kp.grafana) }
{ ['prometheus-adapter-' + name]: kp.prometheusAdapter[name] for name in std.objectFields(kp.prometheusAdapter) }
```

0 comments on commit 373e2b4

Please sign in to comment.