-
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.
Enable monitoring of olm and marketplace operators
- Loading branch information
Showing
7 changed files
with
271 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,112 @@ | ||
local cm = import 'lib/cert-manager.libsonnet'; | ||
local com = import 'lib/commodore.libjsonnet'; | ||
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 catalogOperatorMonitor = prom.ServiceMonitor('openshift-marketplace-operator') { | ||
metadata+: { | ||
namespace: nsName, | ||
}, | ||
spec+: { | ||
endpoints: [ | ||
{ | ||
bearerTokenFile: '/var/run/secrets/kubernetes.io/serviceaccount/token', | ||
interval: '30s', | ||
metricRelabelings: [ | ||
{ | ||
action: 'drop', | ||
regex: 'etcd_(debugging|disk|request|server).*', | ||
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', | ||
}, | ||
}, | ||
}, | ||
}; | ||
|
||
local olmOperatorMonitor = prom.ServiceMonitor('openshift-olm-operator') { | ||
metadata+: { | ||
namespace: nsName, | ||
}, | ||
spec+: { | ||
endpoints: [ | ||
{ | ||
bearerTokenFile: '/var/run/secrets/kubernetes.io/serviceaccount/token', | ||
interval: '30s', | ||
metricRelabelings: [ | ||
{ | ||
action: 'drop', | ||
regex: 'etcd_(debugging|disk|request|server).*', | ||
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', | ||
}, | ||
}, | ||
}, | ||
}; | ||
|
||
if params.monitoring.enabled && std.member(inv.applications, 'prometheus') then | ||
{ | ||
monitoring: [ | ||
prom.RegisterNamespace( | ||
kube.Namespace(nsName), | ||
instance=promInstance | ||
), | ||
catalogOperatorMonitor, | ||
olmOperatorMonitor, | ||
], | ||
} | ||
else | ||
std.trace( | ||
'Monitoring disabled or component `prometheus` not present, ' | ||
+ 'not deploying ServiceMonitors', | ||
{} | ||
) |
66 changes: 66 additions & 0 deletions
66
...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,66 @@ | ||
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__ | ||
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-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__ | ||
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 |
66 changes: 66 additions & 0 deletions
66
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,66 @@ | ||
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__ | ||
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-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__ | ||
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 |
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 |