Skip to content
Snippets Groups Projects
Commit 9a681fad authored by Benjamin's avatar Benjamin
Browse files

Add thanos v0.5.0 support & remove deprecated thanos gossip


Signed-off-by: default avatarBenjamin <benjamin@yunify.com>
parent 98b87e28
Branches
Tags ghost-0.79.0
No related merge requests found
...@@ -5,7 +5,7 @@ local servicePort = k.core.v1.service.mixin.spec.portsType; ...@@ -5,7 +5,7 @@ local servicePort = k.core.v1.service.mixin.spec.portsType;
{ {
_config+:: { _config+:: {
versions+:: { versions+:: {
thanos: 'v0.3.2', thanos: 'v0.5.0',
}, },
imageRepos+:: { imageRepos+:: {
thanos: 'improbable/thanos', thanos: 'improbable/thanos',
...@@ -20,53 +20,13 @@ local servicePort = k.core.v1.service.mixin.spec.portsType; ...@@ -20,53 +20,13 @@ local servicePort = k.core.v1.service.mixin.spec.portsType;
prometheus+:: { prometheus+:: {
prometheus+: { prometheus+: {
spec+: { spec+: {
podMetadata+: {
labels+: { 'thanos-peers': 'true' },
},
thanos+: { thanos+: {
peers: 'thanos-peers.' + $._config.namespace + '.svc:10900',
version: $._config.versions.thanos, version: $._config.versions.thanos,
baseImage: $._config.imageRepos.thanos, baseImage: $._config.imageRepos.thanos,
objectStorageConfig: $._config.thanos.objectStorageConfig, objectStorageConfig: $._config.thanos.objectStorageConfig,
}, },
}, },
}, },
thanosPeerService:
service.new('thanos-peers', { 'thanos-peers': 'true' }, [
servicePort.newNamed('cluster', 10900, 10900),
servicePort.newNamed('http', 10902, 10902),
]) +
service.mixin.metadata.withNamespace($._config.namespace) +
service.mixin.metadata.withLabels({ 'thanos-peers': 'true' }) +
service.mixin.spec.withType('ClusterIP') +
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.v1.deployment; local deployment = k.apps.v1.deployment;
local container = k.apps.v1.deployment.mixin.spec.template.spec.containersType; local container = k.apps.v1.deployment.mixin.spec.template.spec.containersType;
...@@ -77,26 +37,31 @@ local servicePort = k.core.v1.service.mixin.spec.portsType; ...@@ -77,26 +37,31 @@ local servicePort = k.core.v1.service.mixin.spec.portsType;
container.withPorts([ container.withPorts([
containerPort.newNamed(10902, 'http'), containerPort.newNamed(10902, 'http'),
containerPort.newNamed(10901, 'grpc'), containerPort.newNamed(10901, 'grpc'),
containerPort.newNamed(10900, 'cluster'),
]) + ]) +
container.withArgs([ container.withArgs([
'query', 'query',
'--log.level=debug', '--log.level=debug',
'--query.replica-label=prometheus_replica', '--query.replica-label=prometheus_replica',
'--query.auto-downsampling', '--query.auto-downsampling',
'--cluster.peers=thanos-peers.' + $._config.namespace + '.svc:10900', '--store=dnssrv+thanos-sidecar.' + $._config.namespace + '.svc',
]); ]);
local podLabels = { app: 'thanos-query', 'thanos-peers': 'true' }; local podLabels = { app: 'thanos-query' };
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) +
deployment.mixin.spec.selector.withMatchLabels(podLabels) + deployment.mixin.spec.selector.withMatchLabels(podLabels) +
deployment.mixin.spec.template.spec.withServiceAccountName('prometheus-' + $._config.prometheus.name), deployment.mixin.spec.template.spec.withServiceAccountName('prometheus-' + $._config.prometheus.name),
thanosQueryService: thanosQueryService:
local thanosQueryPort = servicePort.newNamed('http-query', 9090, 'http'); local thanosQueryPort = servicePort.newNamed('http', 9090, 'http');
service.new('thanos-query', { app: 'thanos-query' }, thanosQueryPort) + service.new('thanos-query', { app: 'thanos-query' }, thanosQueryPort) +
service.mixin.metadata.withNamespace($._config.namespace) + service.mixin.metadata.withNamespace($._config.namespace) +
service.mixin.metadata.withLabels({ app: 'thanos-query' }), service.mixin.metadata.withLabels({ app: 'thanos-query' }),
thanosSidecarService:
local thanosSidecarPort = servicePort.newNamed('grpc', 10901, 'grpc');
service.new('thanos-sidecar', { app: 'thanos-sidecar' }, thanosSidecarPort) +
service.mixin.metadata.withNamespace($._config.namespace) +
service.mixin.metadata.withLabels({ app: 'thanos-sidecar' }) +
service.mixin.spec.withSelector({ prometheus: 'k8s' }),
thanosStoreStatefulset: thanosStoreStatefulset:
local statefulSet = k.apps.v1.statefulSet; local statefulSet = k.apps.v1.statefulSet;
...@@ -105,7 +70,7 @@ local servicePort = k.core.v1.service.mixin.spec.portsType; ...@@ -105,7 +70,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-peers': 'true' }; local labels = { app: 'thanos' };
local c = local c =
container.new('thanos-store', $._config.imageRepos.thanos + ':' + $._config.versions.thanos) + container.new('thanos-store', $._config.imageRepos.thanos + ':' + $._config.versions.thanos) +
...@@ -113,7 +78,6 @@ local servicePort = k.core.v1.service.mixin.spec.portsType; ...@@ -113,7 +78,6 @@ local servicePort = k.core.v1.service.mixin.spec.portsType;
'store', 'store',
'--log.level=debug', '--log.level=debug',
'--data-dir=/var/thanos/store', '--data-dir=/var/thanos/store',
'--cluster.peers=thanos-peers.' + $._config.namespace + '.svc:10900',
'--objstore.config=$(OBJSTORE_CONFIG)', '--objstore.config=$(OBJSTORE_CONFIG)',
]) + ]) +
container.withEnv([ container.withEnv([
...@@ -124,7 +88,6 @@ local servicePort = k.core.v1.service.mixin.spec.portsType; ...@@ -124,7 +88,6 @@ local servicePort = k.core.v1.service.mixin.spec.portsType;
), ),
]) + ]) +
container.withPorts([ container.withPorts([
{ name: 'cluster', containerPort: 10900 },
{ name: 'grpc', containerPort: 10901 }, { name: 'grpc', containerPort: 10901 },
{ name: 'http', containerPort: 10902 }, { name: 'http', containerPort: 10902 },
]) + ]) +
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment