Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions component/main.jsonnet
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// main template for rollout-operator
local alertpatching = import 'lib/alert-patching.libsonnet';
local kap = import 'lib/kapitan.libjsonnet';
local kube = import 'lib/kube.libjsonnet';
local prom = import 'lib/prom.libsonnet';
local inv = kap.inventory();

Expand Down Expand Up @@ -31,8 +31,11 @@ local prometheusRules = prom.generateRules('rollout-operator', { 'rollout-operat
},
};

local has_monitoring = std.member(inv.applications, 'prometheus') || std.member(inv.applications, 'openshift4-monitoring');
local has_alerts = std.length(params.alerts.rules) > 0;

// Define outputs below
{
'00_namespace': namespace,
[if params.monitoring then '20_prometheus_rule']: prometheusRules,
[if params.monitoring && has_monitoring && has_alerts then '20_prometheus_rule']: prometheusRules,
}
10 changes: 8 additions & 2 deletions tests/defaults.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,15 @@
applications:
- prometheus

parameters:
kapitan:
dependencies:
- type: https
source: https://raw.githubusercontent.com/appuio/component-openshift4-monitoring/master/lib/openshift4-monitoring-alert-patching.libsonnet
source: https://raw.githubusercontent.com/projectsyn/component-prometheus/master/lib/prometheus-alert-patching.libsonnet
output_path: vendor/lib/alert-patching.libsonnet
- type: https
source: https://raw.githubusercontent.com/appuio/component-openshift4-monitoring/master/lib/openshift4-monitoring-prom.libsonnet
source: https://raw.githubusercontent.com/projectsyn/component-prometheus/master/lib/prometheus-prom.libsonnet
output_path: vendor/lib/prom.libsonnet
- type: https
source: https://raw.githubusercontent.com/projectsyn/component-prometheus/master/lib/prometheus.libsonnet
output_path: vendor/lib/prometheus.libsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ metadata:
labels:
app.kubernetes.io/managed-by: commodore
app.kubernetes.io/name: rollout-operator
monitoring.syn.tools/enabled: 'true'
name: rollout-operator
name: rollout-operator
namespace: syn-rollout-operator
Expand Down
3 changes: 3 additions & 0 deletions tests/openshift.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
applications:
- openshift4-monitoring

parameters:
kapitan:
dependencies:
Expand Down
Loading