38 lines
1.2 KiB
Jsonnet
38 lines
1.2 KiB
Jsonnet
local chart = import 'chart.jsonnet';
|
|
local common = import 'common.jsonnet';
|
|
local deployment_manifest = import 'deployment_manifest.jsonnet';
|
|
|
|
if deployment_manifest.deployment.serviceMonitor.enabled == true then {
|
|
apiVersion: 'monitoring.coreos.com/v1',
|
|
kind: 'ServiceMonitor',
|
|
metadata: {
|
|
labels: common.labels,
|
|
name: chart.full_service_name(deployment_manifest.deployment.name) + '-monitor',
|
|
namespace: deployment_manifest.deployment.namespace,
|
|
annotations: common.annotations,
|
|
},
|
|
spec:
|
|
{
|
|
endpoints: [
|
|
{
|
|
honorLabels: false,
|
|
interval: deployment_manifest.deployment.serviceMonitor.interval,
|
|
path: deployment_manifest.deployment.serviceMonitor.path,
|
|
port: deployment_manifest.deployment.serviceMonitor.port,
|
|
metricRelabelings: deployment_manifest.deployment.serviceMonitor.metricRelabelings,
|
|
scrapeTimeout: deployment_manifest.deployment.serviceMonitor.scrapeTimeout,
|
|
},
|
|
],
|
|
namespaceSelector: {
|
|
matchNames: [
|
|
deployment_manifest.deployment.namespace,
|
|
],
|
|
},
|
|
//adding hard limit on scrape sample per target
|
|
sampleLimit: 20000,
|
|
selector: {
|
|
matchLabels: common.matchLabels,
|
|
},
|
|
},
|
|
}
|