-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Monitoring of OLM, catalog, and marketplace operators by SYN stack (#12)
- Loading branch information
Showing
8 changed files
with
387 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,118 @@ | ||
/* | ||
This file adds ServiceMonitors in combination with the Prometheus component. | ||
Warning: The operators monitored are instance independent, | ||
everything in this file must be instance independent. | ||
*/ | ||
|
||
local kap = import 'lib/kapitan.libjsonnet'; | ||
local kube = import 'lib/kube.libjsonnet'; | ||
local prom = import 'lib/prometheus.libsonnet'; | ||
local inv = kap.inventory(); | ||
// The hiera parameters for the component | ||
local params = inv.parameters.openshift4_operators; | ||
|
||
local nsName = 'syn-monitoring-openshift4-operators'; | ||
|
||
local promInstance = | ||
if params.monitoring.instance != null then | ||
params.monitoring.instance | ||
else | ||
inv.parameters.prometheus.defaultInstance; | ||
|
||
local endpoint = function(serverName) | ||
prom.ServiceMonitorHttpsEndpoint(serverName) { | ||
port: 'https-metrics', | ||
metricRelabelings: [ | ||
{ | ||
action: 'drop', | ||
regex: 'etcd_(debugging|disk|request|server).*', | ||
sourceLabels: [ | ||
'__name__', | ||
], | ||
}, | ||
prom.DropRuntimeMetrics, | ||
], | ||
}; | ||
|
||
local marketplaceOperatorMonitor = prom.ServiceMonitor('openshift-marketplace-operator') { | ||
metadata+: { | ||
namespace: nsName, | ||
}, | ||
spec+: { | ||
endpoints: [ | ||
endpoint('marketplace-operator-metrics.openshift-marketplace.svc'), | ||
], | ||
namespaceSelector: { | ||
matchNames: [ | ||
'openshift-marketplace', | ||
], | ||
}, | ||
selector: { | ||
matchLabels: { | ||
name: 'marketplace-operator', | ||
}, | ||
}, | ||
}, | ||
}; | ||
|
||
local olmOperatorMonitor = prom.ServiceMonitor('openshift-olm-operator') { | ||
metadata+: { | ||
namespace: nsName, | ||
}, | ||
spec+: { | ||
endpoints: [ | ||
endpoint('olm-operator-metrics.openshift-operator-lifecycle-manager.svc'), | ||
], | ||
namespaceSelector: { | ||
matchNames: [ | ||
'openshift-operator-lifecycle-manager', | ||
], | ||
}, | ||
selector: { | ||
matchLabels: { | ||
app: 'olm-operator', | ||
}, | ||
}, | ||
}, | ||
}; | ||
|
||
local catalogOperatorMonitor = prom.ServiceMonitor('openshift-catalog-operator') { | ||
metadata+: { | ||
namespace: nsName, | ||
}, | ||
spec+: { | ||
endpoints: [ | ||
endpoint('catalog-operator-metrics.openshift-operator-lifecycle-manager.svc'), | ||
], | ||
namespaceSelector: { | ||
matchNames: [ | ||
'openshift-operator-lifecycle-manager', | ||
], | ||
}, | ||
selector: { | ||
matchLabels: { | ||
app: 'catalog-operator', | ||
}, | ||
}, | ||
}, | ||
}; | ||
|
||
if params.monitoring.enabled && std.member(inv.applications, 'prometheus') then | ||
{ | ||
monitoring: [ | ||
prom.RegisterNamespace( | ||
kube.Namespace(nsName), | ||
instance=promInstance | ||
), | ||
marketplaceOperatorMonitor, | ||
catalogOperatorMonitor, | ||
olmOperatorMonitor, | ||
], | ||
} | ||
else | ||
std.trace( | ||
'Monitoring disabled or component `prometheus` not present, ' | ||
+ 'not deploying ServiceMonitors', | ||
{} | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
107 changes: 107 additions & 0 deletions
107
...penshift-operators-redhat/openshift-operators-redhat/openshift4-operators/monitoring.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,107 @@ | ||
apiVersion: v1 | ||
kind: Namespace | ||
metadata: | ||
annotations: {} | ||
labels: | ||
monitoring.syn.tools/infra: 'true' | ||
name: syn-monitoring-openshift4-operators | ||
name: syn-monitoring-openshift4-operators | ||
--- | ||
apiVersion: monitoring.coreos.com/v1 | ||
kind: ServiceMonitor | ||
metadata: | ||
annotations: {} | ||
labels: | ||
name: openshift-marketplace-operator | ||
name: openshift-marketplace-operator | ||
namespace: syn-monitoring-openshift4-operators | ||
spec: | ||
endpoints: | ||
- bearerTokenFile: /var/run/secrets/kubernetes.io/serviceaccount/token | ||
interval: 30s | ||
metricRelabelings: | ||
- action: drop | ||
regex: etcd_(debugging|disk|request|server).* | ||
sourceLabels: | ||
- __name__ | ||
- action: drop | ||
regex: (go_.*|process_.*|promhttp_.*) | ||
sourceLabels: | ||
- __name__ | ||
port: https-metrics | ||
scheme: https | ||
tlsConfig: | ||
caFile: /var/run/secrets/kubernetes.io/serviceaccount/service-ca.crt | ||
serverName: marketplace-operator-metrics.openshift-marketplace.svc | ||
namespaceSelector: | ||
matchNames: | ||
- openshift-marketplace | ||
selector: | ||
matchLabels: | ||
name: marketplace-operator | ||
--- | ||
apiVersion: monitoring.coreos.com/v1 | ||
kind: ServiceMonitor | ||
metadata: | ||
annotations: {} | ||
labels: | ||
name: openshift-catalog-operator | ||
name: openshift-catalog-operator | ||
namespace: syn-monitoring-openshift4-operators | ||
spec: | ||
endpoints: | ||
- bearerTokenFile: /var/run/secrets/kubernetes.io/serviceaccount/token | ||
interval: 30s | ||
metricRelabelings: | ||
- action: drop | ||
regex: etcd_(debugging|disk|request|server).* | ||
sourceLabels: | ||
- __name__ | ||
- action: drop | ||
regex: (go_.*|process_.*|promhttp_.*) | ||
sourceLabels: | ||
- __name__ | ||
port: https-metrics | ||
scheme: https | ||
tlsConfig: | ||
caFile: /var/run/secrets/kubernetes.io/serviceaccount/service-ca.crt | ||
serverName: catalog-operator-metrics.openshift-operator-lifecycle-manager.svc | ||
namespaceSelector: | ||
matchNames: | ||
- openshift-operator-lifecycle-manager | ||
selector: | ||
matchLabels: | ||
app: catalog-operator | ||
--- | ||
apiVersion: monitoring.coreos.com/v1 | ||
kind: ServiceMonitor | ||
metadata: | ||
annotations: {} | ||
labels: | ||
name: openshift-olm-operator | ||
name: openshift-olm-operator | ||
namespace: syn-monitoring-openshift4-operators | ||
spec: | ||
endpoints: | ||
- bearerTokenFile: /var/run/secrets/kubernetes.io/serviceaccount/token | ||
interval: 30s | ||
metricRelabelings: | ||
- action: drop | ||
regex: etcd_(debugging|disk|request|server).* | ||
sourceLabels: | ||
- __name__ | ||
- action: drop | ||
regex: (go_.*|process_.*|promhttp_.*) | ||
sourceLabels: | ||
- __name__ | ||
port: https-metrics | ||
scheme: https | ||
tlsConfig: | ||
caFile: /var/run/secrets/kubernetes.io/serviceaccount/service-ca.crt | ||
serverName: olm-operator-metrics.openshift-operator-lifecycle-manager.svc | ||
namespaceSelector: | ||
matchNames: | ||
- openshift-operator-lifecycle-manager | ||
selector: | ||
matchLabels: | ||
app: olm-operator |
107 changes: 107 additions & 0 deletions
107
tests/golden/openshift-operators/openshift-operators/openshift4-operators/monitoring.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,107 @@ | ||
apiVersion: v1 | ||
kind: Namespace | ||
metadata: | ||
annotations: {} | ||
labels: | ||
monitoring.syn.tools/infra: 'true' | ||
name: syn-monitoring-openshift4-operators | ||
name: syn-monitoring-openshift4-operators | ||
--- | ||
apiVersion: monitoring.coreos.com/v1 | ||
kind: ServiceMonitor | ||
metadata: | ||
annotations: {} | ||
labels: | ||
name: openshift-marketplace-operator | ||
name: openshift-marketplace-operator | ||
namespace: syn-monitoring-openshift4-operators | ||
spec: | ||
endpoints: | ||
- bearerTokenFile: /var/run/secrets/kubernetes.io/serviceaccount/token | ||
interval: 30s | ||
metricRelabelings: | ||
- action: drop | ||
regex: etcd_(debugging|disk|request|server).* | ||
sourceLabels: | ||
- __name__ | ||
- action: drop | ||
regex: (go_.*|process_.*|promhttp_.*) | ||
sourceLabels: | ||
- __name__ | ||
port: https-metrics | ||
scheme: https | ||
tlsConfig: | ||
caFile: /var/run/secrets/kubernetes.io/serviceaccount/service-ca.crt | ||
serverName: marketplace-operator-metrics.openshift-marketplace.svc | ||
namespaceSelector: | ||
matchNames: | ||
- openshift-marketplace | ||
selector: | ||
matchLabels: | ||
name: marketplace-operator | ||
--- | ||
apiVersion: monitoring.coreos.com/v1 | ||
kind: ServiceMonitor | ||
metadata: | ||
annotations: {} | ||
labels: | ||
name: openshift-catalog-operator | ||
name: openshift-catalog-operator | ||
namespace: syn-monitoring-openshift4-operators | ||
spec: | ||
endpoints: | ||
- bearerTokenFile: /var/run/secrets/kubernetes.io/serviceaccount/token | ||
interval: 30s | ||
metricRelabelings: | ||
- action: drop | ||
regex: etcd_(debugging|disk|request|server).* | ||
sourceLabels: | ||
- __name__ | ||
- action: drop | ||
regex: (go_.*|process_.*|promhttp_.*) | ||
sourceLabels: | ||
- __name__ | ||
port: https-metrics | ||
scheme: https | ||
tlsConfig: | ||
caFile: /var/run/secrets/kubernetes.io/serviceaccount/service-ca.crt | ||
serverName: catalog-operator-metrics.openshift-operator-lifecycle-manager.svc | ||
namespaceSelector: | ||
matchNames: | ||
- openshift-operator-lifecycle-manager | ||
selector: | ||
matchLabels: | ||
app: catalog-operator | ||
--- | ||
apiVersion: monitoring.coreos.com/v1 | ||
kind: ServiceMonitor | ||
metadata: | ||
annotations: {} | ||
labels: | ||
name: openshift-olm-operator | ||
name: openshift-olm-operator | ||
namespace: syn-monitoring-openshift4-operators | ||
spec: | ||
endpoints: | ||
- bearerTokenFile: /var/run/secrets/kubernetes.io/serviceaccount/token | ||
interval: 30s | ||
metricRelabelings: | ||
- action: drop | ||
regex: etcd_(debugging|disk|request|server).* | ||
sourceLabels: | ||
- __name__ | ||
- action: drop | ||
regex: (go_.*|process_.*|promhttp_.*) | ||
sourceLabels: | ||
- __name__ | ||
port: https-metrics | ||
scheme: https | ||
tlsConfig: | ||
caFile: /var/run/secrets/kubernetes.io/serviceaccount/service-ca.crt | ||
serverName: olm-operator-metrics.openshift-operator-lifecycle-manager.svc | ||
namespaceSelector: | ||
matchNames: | ||
- openshift-operator-lifecycle-manager | ||
selector: | ||
matchLabels: | ||
app: olm-operator |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,12 @@ | ||
# Overwrite parameters here | ||
applications: | ||
- prometheus | ||
|
||
# parameters: {...} | ||
parameters: | ||
kapitan: | ||
dependencies: | ||
- type: https | ||
source: https://raw.githubusercontent.com/projectsyn/component-prometheus/master/lib/prometheus.libsonnet | ||
output_path: vendor/lib/prometheus.libsonnet | ||
|
||
prometheus: | ||
defaultInstance: infra |
Oops, something went wrong.