kube-thanos/example.jsonnet
Matthias Loibl e4f37ef1d6
Move thanos-query and thanos-store to functions with parameters
Hopefully this will scope the component's features better and going
forward will make it more obvious what each component supports (by
looking at it's default at the top, to check what can be passed to it),
the component will even do some safety checks (using assert) on the
merged configuration it'll use and give back some Kubernetes objects.

If there are some limitations that, after discussing the component
shouldn't support, everybody is still able to merge additional features
on top of the generated objects.

Signed-off-by: Matthias Loibl <mail@matthiasloibl.com>
2020-09-17 12:46:34 +02:00

41 lines
1.1 KiB
Jsonnet

// Usually this should be an absolute import paths.
// In this instance, however, we use a local symlink cause this is within the same repository.
local thanos = import 'kube-thanos/thanos.libsonnet';
// This is a config shared across components.
// Before passing the params to the component this config is merged with the component's config.
local config = {
namespace: 'thanos',
version: 'v0.15.0',
image: 'quay.io/thanos/thanos:' + self.version,
objectStorageConfig: {
name: 'thanos-objectstorage',
key: 'thanos.yaml',
},
volumeClaimTemplate: {
spec: {
accessModes: ['ReadWriteOnce'],
resources: {
requests: {
storage: '10Gi',
},
},
},
},
};
local store = thanos.store(config {
name: 'thanos-store',
replicas: 1,
serviceMonitor: true,
});
local query = thanos.query(config {
replicas: 1,
replicaLabels: ['prometheus_replica', 'rule_replica'],
serviceMonitor: true,
});
{ ['thanos-store-' + name]: store[name] for name in std.objectFields(store) } +
{ ['thanos-query-' + name]: query[name] for name in std.objectFields(query) }