diff --git a/README.md b/README.md index 1dd9952258bf1cdcb2d9201d03ca4e41830aa0b1..528199e882fb4c062283cb6155ae34507a9f734f 100644 --- a/README.md +++ b/README.md @@ -376,7 +376,7 @@ These mixins are selectable via the `platform` field of kubePrometheus: (import 'kube-prometheus/main.libsonnet') + { values+:: { - kubePrometheus+: { + common+: { platform: 'example-platform', }, }, diff --git a/examples/jsonnet-snippets/platform.jsonnet b/examples/jsonnet-snippets/platform.jsonnet index a3ad9c3d8f924d7b0051350ab8e19ea6f0122397..e3a588049d91d6fe82ad7de69713f377e3b30553 100644 --- a/examples/jsonnet-snippets/platform.jsonnet +++ b/examples/jsonnet-snippets/platform.jsonnet @@ -1,7 +1,7 @@ (import 'kube-prometheus/main.libsonnet') + { values+:: { - kubePrometheus+: { + common+: { platform: 'example-platform', }, }, diff --git a/jsonnet/kube-prometheus/main.libsonnet b/jsonnet/kube-prometheus/main.libsonnet index a9b68896b7cc4b3194ca15cf6db8fc9334d6b6f5..e1dc0b5955c2e065eaac9abe98b14852088316df 100644 --- a/jsonnet/kube-prometheus/main.libsonnet +++ b/jsonnet/kube-prometheus/main.libsonnet @@ -16,6 +16,7 @@ local platformPatch = import './platforms/platforms.libsonnet'; values:: { common: { namespace: 'default', + platform: null, ruleLabels: { role: 'alert-rules', prometheus: $.values.prometheus.name, @@ -102,9 +103,6 @@ local platformPatch = import './platforms/platforms.libsonnet'; version: $.values.common.versions.prometheusOperator, image: $.values.common.images.prometheusOperator, configReloaderImage: $.values.common.images.prometheusOperatorReloader, - commonLabels+: { - 'app.kubernetes.io/part-of': 'kube-prometheus', - }, mixin+: { ruleLabels: $.values.common.ruleLabels }, kubeRbacProxyImage: $.values.common.images.kubeRbacProxy, }, @@ -112,11 +110,6 @@ local platformPatch = import './platforms/platforms.libsonnet'; namespace: $.values.common.namespace, mixin+: { ruleLabels: $.values.common.ruleLabels }, }, - kubePrometheus: { - namespace: $.values.common.namespace, - mixin+: { ruleLabels: $.values.common.ruleLabels }, - platform: null, - }, }, alertmanager: alertmanager($.values.alertmanager), @@ -128,12 +121,17 @@ local platformPatch = import './platforms/platforms.libsonnet'; prometheusAdapter: prometheusAdapter($.values.prometheusAdapter), prometheusOperator: prometheusOperator($.values.prometheusOperator), kubernetesControlPlane: kubernetesControlPlane($.values.kubernetesControlPlane), - kubePrometheus: customMixin($.values.kubePrometheus) + { + kubePrometheus: customMixin( + { + namespace: $.values.common.namespace, + mixin+: { ruleLabels: $.values.common.ruleLabels }, + } + ) + { namespace: { apiVersion: 'v1', kind: 'Namespace', metadata: { - name: $.values.kubePrometheus.namespace, + name: $.values.common.namespace, }, }, }, diff --git a/jsonnet/kube-prometheus/platforms/platforms.libsonnet b/jsonnet/kube-prometheus/platforms/platforms.libsonnet index 979190f21e62040a68073b23238bb983bee24cd9..a3978a6cad2d9afc259679325b04a02cf091764b 100644 --- a/jsonnet/kube-prometheus/platforms/platforms.libsonnet +++ b/jsonnet/kube-prometheus/platforms/platforms.libsonnet @@ -26,7 +26,7 @@ local platformPatch(p) = if p != null && std.objectHas(platforms, p) then platfo prometheusOperator: {}, kubernetesControlPlane: {}, kubePrometheus: {}, - } + platformPatch($.values.kubePrometheus.platform), + } + platformPatch($.values.common.platform), alertmanager+: p.alertmanager, blackboxExporter+: p.blackboxExporter,