forked from thanos-io/kube-thanos
-
Notifications
You must be signed in to change notification settings - Fork 0
/
all.jsonnet
127 lines (117 loc) · 3.19 KB
/
all.jsonnet
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
local k = import 'ksonnet/ksonnet.beta.4/k.libsonnet';
local sts = k.apps.v1.statefulSet;
local deployment = k.apps.v1.deployment;
local t = (import 'kube-thanos/thanos.libsonnet');
local commonConfig = {
config+:: {
local cfg = self,
namespace: 'thanos',
version: 'v0.12.0',
image: 'quay.io/thanos/thanos:' + cfg.version,
objectStorageConfig: {
name: 'thanos-objectstorage',
key: 'thanos.yaml',
},
volumeClaimTemplate: {
spec: {
accessModes: ['ReadWriteOnce'],
resources: {
requests: {
storage: '10Gi',
},
},
},
},
},
};
local b =
t.bucket +
commonConfig + {
config+:: {
name: 'thanos-bucket',
replicas: 1,
},
};
local c =
t.compact +
t.compact.withVolumeClaimTemplate +
t.compact.withServiceMonitor +
commonConfig + {
config+:: {
name: 'thanos-compact',
replicas: 1,
},
};
local re =
t.receive +
t.receive.withVolumeClaimTemplate +
t.receive.withServiceMonitor +
commonConfig + {
config+:: {
name: 'thanos-receive',
replicas: 1,
replicationFactor: 1,
},
};
local ru =
t.rule +
t.rule.withVolumeClaimTemplate +
t.rule.withServiceMonitor +
commonConfig + {
config+:: {
name: 'thanos-rule',
replicas: 1,
},
};
local s =
t.store +
t.store.withVolumeClaimTemplate +
t.store.withServiceMonitor +
commonConfig + {
config+:: {
name: 'thanos-store',
replicas: 1,
},
};
local swm =
t.store +
t.store.withVolumeClaimTemplate +
t.store.withServiceMonitor + t.store.withMemcachedIndexCache +
commonConfig + {
config+:: {
name: 'thanos-store',
replicas: 1,
memcached+: {
// NOTICE: <MEMCACHED_SERCIVE> is a placeholder to generate examples.
// List of memcached addresses, that will get resolved with the DNS service discovery provider.
// For DNS service discovery reference https://thanos.io/service-discovery.md/#dns-service-discovery
addresses: ['dnssrv+_client._tcp.<MEMCACHED_SERCIVE>.%s.svc.cluster.local' % commonConfig.config.namespace],
},
},
};
local q =
t.query +
t.query.withServiceMonitor +
commonConfig + {
config+:: {
name: 'thanos-query',
replicas: 1,
stores: [
'dnssrv+_grpc._tcp.%s.%s.svc.cluster.local' % [service.metadata.name, service.metadata.namespace]
for service in [re.service, ru.service, s.service]
],
replicaLabels: ['prometheus_replica', 'rule_replica'],
},
};
local finalRu = ru {
config+:: {
queriers: ['dnssrv+_http._tcp.%s.%s.svc.cluster.local' % [q.service.metadata.name, q.service.metadata.namespace]],
},
};
{ ['thanos-bucket-' + name]: b[name] for name in std.objectFields(b) } +
{ ['thanos-compact-' + name]: c[name] for name in std.objectFields(c) } +
{ ['thanos-receive-' + name]: re[name] for name in std.objectFields(re) } +
{ ['thanos-rule-' + name]: finalRu[name] for name in std.objectFields(finalRu) } +
{ ['thanos-store-' + name]: s[name] for name in std.objectFields(s) } +
{ ['thanos-query-' + name]: q[name] for name in std.objectFields(q) } +
{ 'thanos-store-statefulSet-with-memcached': swm.statefulSet }