Merge pull request #2297 from metalmatze/thanos-servicemonitor-peers
contrib/kube-prometheus: Add ServiceMonitor for thanos-peers
This commit is contained in:
@@ -21,7 +21,7 @@ local servicePort = k.core.v1.service.mixin.spec.portsType;
|
|||||||
prometheus+: {
|
prometheus+: {
|
||||||
spec+: {
|
spec+: {
|
||||||
podMetadata+: {
|
podMetadata+: {
|
||||||
labels+: { 'thanos-peer': 'true' },
|
labels+: { 'thanos-peers': 'true' },
|
||||||
},
|
},
|
||||||
thanos+: {
|
thanos+: {
|
||||||
peers: 'thanos-peers.' + $._config.namespace + '.svc:10900',
|
peers: 'thanos-peers.' + $._config.namespace + '.svc:10900',
|
||||||
@@ -32,11 +32,41 @@ local servicePort = k.core.v1.service.mixin.spec.portsType;
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
thanosPeerService:
|
thanosPeerService:
|
||||||
local thanosPeerPort = servicePort.newNamed('cluster', 10900, 'cluster');
|
service.new('thanos-peers', { 'thanos-peers': 'true' }, [
|
||||||
service.new('thanos-peers', { 'thanos-peer': 'true' }, thanosPeerPort) +
|
servicePort.newNamed('cluster', 10900, 'cluster'),
|
||||||
|
servicePort.newNamed('http', 10902, 'http'),
|
||||||
|
]) +
|
||||||
service.mixin.metadata.withNamespace($._config.namespace) +
|
service.mixin.metadata.withNamespace($._config.namespace) +
|
||||||
|
service.mixin.metadata.withLabels({ 'thanos-peers': 'true' }) +
|
||||||
service.mixin.spec.withType('ClusterIP') +
|
service.mixin.spec.withType('ClusterIP') +
|
||||||
service.mixin.spec.withClusterIp('None'),
|
service.mixin.spec.withClusterIp('None'),
|
||||||
|
|
||||||
|
serviceMonitorThanosPeer:
|
||||||
|
{
|
||||||
|
apiVersion: 'monitoring.coreos.com/v1',
|
||||||
|
kind: 'ServiceMonitor',
|
||||||
|
metadata: {
|
||||||
|
name: 'thanos-peers',
|
||||||
|
namespace: $._config.namespace,
|
||||||
|
labels: {
|
||||||
|
'k8s-app': 'thanos-peers',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
spec: {
|
||||||
|
jobLabel: 'k8s-app',
|
||||||
|
endpoints: [
|
||||||
|
{
|
||||||
|
port: 'http',
|
||||||
|
interval: '30s',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
selector: {
|
||||||
|
matchLabels: {
|
||||||
|
'thanos-peers': 'true',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
thanosQueryDeployment:
|
thanosQueryDeployment:
|
||||||
local deployment = k.apps.v1beta2.deployment;
|
local deployment = k.apps.v1beta2.deployment;
|
||||||
local container = k.apps.v1beta2.deployment.mixin.spec.template.spec.containersType;
|
local container = k.apps.v1beta2.deployment.mixin.spec.template.spec.containersType;
|
||||||
@@ -55,7 +85,7 @@ local servicePort = k.core.v1.service.mixin.spec.portsType;
|
|||||||
'--query.replica-label=prometheus_replica',
|
'--query.replica-label=prometheus_replica',
|
||||||
'--cluster.peers=thanos-peers.' + $._config.namespace + '.svc:10900',
|
'--cluster.peers=thanos-peers.' + $._config.namespace + '.svc:10900',
|
||||||
]);
|
]);
|
||||||
local podLabels = { app: 'thanos-query', 'thanos-peer': 'true' };
|
local podLabels = { app: 'thanos-query', 'thanos-peers': 'true' };
|
||||||
deployment.new('thanos-query', 1, thanosQueryContainer, podLabels) +
|
deployment.new('thanos-query', 1, thanosQueryContainer, podLabels) +
|
||||||
deployment.mixin.metadata.withNamespace($._config.namespace) +
|
deployment.mixin.metadata.withNamespace($._config.namespace) +
|
||||||
deployment.mixin.metadata.withLabels(podLabels) +
|
deployment.mixin.metadata.withLabels(podLabels) +
|
||||||
@@ -74,7 +104,7 @@ local servicePort = k.core.v1.service.mixin.spec.portsType;
|
|||||||
local containerEnv = container.envType;
|
local containerEnv = container.envType;
|
||||||
local containerVolumeMount = container.volumeMountsType;
|
local containerVolumeMount = container.volumeMountsType;
|
||||||
|
|
||||||
local labels = { app: 'thanos', 'thanos-peer': 'true' };
|
local labels = { app: 'thanos', 'thanos-peers': 'true' };
|
||||||
|
|
||||||
local c =
|
local c =
|
||||||
container.new('thanos-store', $._config.imageRepos.thanos + ':' + $._config.versions.thanos) +
|
container.new('thanos-store', $._config.imageRepos.thanos + ':' + $._config.versions.thanos) +
|
||||||
|
Reference in New Issue
Block a user