From d4c48539a09a63bd34a45425f19e5e5a64d136c8 Mon Sep 17 00:00:00 2001
From: paulfantom <pawel@krupa.net.pl>
Date: Fri, 15 Jan 2021 11:49:43 +0100
Subject: [PATCH] jsonnet: fix too much nesting of data in PrometheusRules

Signed-off-by: paulfantom <pawel@krupa.net.pl>
---
 jsonnet/kube-prometheus/alertmanager/alertmanager.libsonnet   | 4 ++--
 .../kube-state-metrics/kube-state-metrics.libsonnet           | 4 ++--
 jsonnet/kube-prometheus/mixin/custom.libsonnet                | 4 ++--
 jsonnet/kube-prometheus/mixin/kubernetes.libsonnet            | 4 ++--
 jsonnet/kube-prometheus/node-exporter/node-exporter.libsonnet | 4 ++--
 .../prometheus-operator/prometheus-operator.libsonnet         | 4 ++--
 jsonnet/kube-prometheus/prometheus/prometheus.libsonnet       | 4 ++--
 7 files changed, 14 insertions(+), 14 deletions(-)

diff --git a/jsonnet/kube-prometheus/alertmanager/alertmanager.libsonnet b/jsonnet/kube-prometheus/alertmanager/alertmanager.libsonnet
index 452a2cc2..5e992176 100644
--- a/jsonnet/kube-prometheus/alertmanager/alertmanager.libsonnet
+++ b/jsonnet/kube-prometheus/alertmanager/alertmanager.libsonnet
@@ -86,8 +86,8 @@ function(params) {
       namespace: am.config.namespace,
     },
     spec: {
-      local r = if std.objectHasAll(am.mixin, 'prometheusRules') then am.mixin.prometheusRules else {},
-      local a = if std.objectHasAll(am.mixin, 'prometheusAlerts') then am.mixin.prometheusAlerts else {},
+      local r = if std.objectHasAll(am.mixin, 'prometheusRules') then am.mixin.prometheusRules.groups else [],
+      local a = if std.objectHasAll(am.mixin, 'prometheusAlerts') then am.mixin.prometheusAlerts.groups else [],
       groups: a + r,
     },
   },
diff --git a/jsonnet/kube-prometheus/kube-state-metrics/kube-state-metrics.libsonnet b/jsonnet/kube-prometheus/kube-state-metrics/kube-state-metrics.libsonnet
index c3236589..fdfe3bd5 100644
--- a/jsonnet/kube-prometheus/kube-state-metrics/kube-state-metrics.libsonnet
+++ b/jsonnet/kube-prometheus/kube-state-metrics/kube-state-metrics.libsonnet
@@ -59,8 +59,8 @@ function(params) (import 'github.com/kubernetes/kube-state-metrics/jsonnet/kube-
       namespace: ksm.config.namespace,
     },
     spec: {
-      local r = if std.objectHasAll(ksm.mixin, 'prometheusRules') then ksm.mixin.prometheusRules else {},
-      local a = if std.objectHasAll(ksm.mixin, 'prometheusAlerts') then ksm.mixin.prometheusAlerts else {},
+      local r = if std.objectHasAll(ksm.mixin, 'prometheusRules') then ksm.mixin.prometheusRules.groups else [],
+      local a = if std.objectHasAll(ksm.mixin, 'prometheusAlerts') then ksm.mixin.prometheusAlerts.groups else [],
       groups: a + r,
     },
   },
diff --git a/jsonnet/kube-prometheus/mixin/custom.libsonnet b/jsonnet/kube-prometheus/mixin/custom.libsonnet
index 278ddc76..13c36332 100644
--- a/jsonnet/kube-prometheus/mixin/custom.libsonnet
+++ b/jsonnet/kube-prometheus/mixin/custom.libsonnet
@@ -34,8 +34,8 @@ function(params) {
       namespace: m.config.namespace,
     },
     spec: {
-      local r = if std.objectHasAll(m.mixin, 'prometheusRules') then m.mixin.prometheusRules else {},
-      local a = if std.objectHasAll(m.mixin, 'prometheusAlerts') then m.mixin.prometheusAlerts else {},
+      local r = if std.objectHasAll(m.mixin, 'prometheusRules') then m.mixin.prometheusRules.groups else [],
+      local a = if std.objectHasAll(m.mixin, 'prometheusAlerts') then m.mixin.prometheusAlerts.groups else [],
       groups: a + r,
     },
   },
diff --git a/jsonnet/kube-prometheus/mixin/kubernetes.libsonnet b/jsonnet/kube-prometheus/mixin/kubernetes.libsonnet
index f399a529..f9e5791f 100644
--- a/jsonnet/kube-prometheus/mixin/kubernetes.libsonnet
+++ b/jsonnet/kube-prometheus/mixin/kubernetes.libsonnet
@@ -41,8 +41,8 @@ function(params) {
       namespace: m.config.namespace,
     },
     spec: {
-      local r = if std.objectHasAll(m.mixin, 'prometheusRules') then m.mixin.prometheusRules else {},
-      local a = if std.objectHasAll(m.mixin, 'prometheusAlerts') then m.mixin.prometheusAlerts else {},
+      local r = if std.objectHasAll(m.mixin, 'prometheusRules') then m.mixin.prometheusRules.groups else {},
+      local a = if std.objectHasAll(m.mixin, 'prometheusAlerts') then m.mixin.prometheusAlerts.groups else {},
       groups: a + r,
     },
   },
diff --git a/jsonnet/kube-prometheus/node-exporter/node-exporter.libsonnet b/jsonnet/kube-prometheus/node-exporter/node-exporter.libsonnet
index 1c4321b1..c5b82498 100644
--- a/jsonnet/kube-prometheus/node-exporter/node-exporter.libsonnet
+++ b/jsonnet/kube-prometheus/node-exporter/node-exporter.libsonnet
@@ -54,8 +54,8 @@ function(params) {
       namespace: ne.config.namespace,
     },
     spec: {
-      local r = if std.objectHasAll(ne.mixin, 'prometheusRules') then ne.mixin.prometheusRules else {},
-      local a = if std.objectHasAll(ne.mixin, 'prometheusAlerts') then ne.mixin.prometheusAlerts else {},
+      local r = if std.objectHasAll(ne.mixin, 'prometheusRules') then ne.mixin.prometheusRules.groups else [],
+      local a = if std.objectHasAll(ne.mixin, 'prometheusAlerts') then ne.mixin.prometheusAlerts.groups else [],
       groups: a + r,
     },
   },
diff --git a/jsonnet/kube-prometheus/prometheus-operator/prometheus-operator.libsonnet b/jsonnet/kube-prometheus/prometheus-operator/prometheus-operator.libsonnet
index b1497416..8114f91c 100644
--- a/jsonnet/kube-prometheus/prometheus-operator/prometheus-operator.libsonnet
+++ b/jsonnet/kube-prometheus/prometheus-operator/prometheus-operator.libsonnet
@@ -54,8 +54,8 @@ function(params)
         namespace: config.namespace,
       },
       spec: {
-        local r = if std.objectHasAll(po.mixin, 'prometheusRules') then po.mixin.prometheusRules else {},
-        local a = if std.objectHasAll(po.mixin, 'prometheusAlerts') then po.mixin.prometheusAlerts else {},
+        local r = if std.objectHasAll(po.mixin, 'prometheusRules') then po.mixin.prometheusRules.groups else [],
+        local a = if std.objectHasAll(po.mixin, 'prometheusAlerts') then po.mixin.prometheusAlerts.groups else [],
         groups: a + r,
       },
     },
diff --git a/jsonnet/kube-prometheus/prometheus/prometheus.libsonnet b/jsonnet/kube-prometheus/prometheus/prometheus.libsonnet
index 1673c9e7..76a251ff 100644
--- a/jsonnet/kube-prometheus/prometheus/prometheus.libsonnet
+++ b/jsonnet/kube-prometheus/prometheus/prometheus.libsonnet
@@ -60,8 +60,8 @@ function(params) {
       namespace: p.config.namespace,
     },
     spec: {
-      local r = if std.objectHasAll(p.mixin, 'prometheusRules') then p.mixin.prometheusRules else {},
-      local a = if std.objectHasAll(p.mixin, 'prometheusAlerts') then p.mixin.prometheusAlerts else {},
+      local r = if std.objectHasAll(p.mixin, 'prometheusRules') then p.mixin.prometheusRules.groups else [],
+      local a = if std.objectHasAll(p.mixin, 'prometheusAlerts') then p.mixin.prometheusAlerts.groups else [],
       groups: a + r,
     },
   },
-- 
GitLab