Skip to content

Commit

Permalink
Fix structure of memcached store caches
Browse files Browse the repository at this point in the history
Signed-off-by: Matthias Loibl <mail@matthiasloibl.com>
  • Loading branch information
metalmatze committed Nov 3, 2020
1 parent 5851109 commit 6533e7c
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 19 deletions.
4 changes: 2 additions & 2 deletions all.jsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ local s = t.store(commonConfig {
serviceMonitor: true,
bucketCache: {
type: 'memcached',
config: {
config+: {
// 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
Expand All @@ -69,7 +69,7 @@ local s = t.store(commonConfig {
},
indexCache: {
type: 'memcached',
config: {
config+: {
// 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
Expand Down
8 changes: 2 additions & 6 deletions examples/all/manifests/thanos-store-statefulSet.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,7 @@ spec:
- --ignore-deletion-marks-delay=24h
- --experimental.enable-index-cache-postings-compression
- |-
--index-cache.config="addresses":
- "dnssrv+_client._tcp.<MEMCACHED_SERCIVE>.thanos.svc.cluster.local"
"config":
--index-cache.config="config":
"addresses":
- "dnssrv+_client._tcp.<MEMCACHED_SERCIVE>.thanos.svc.cluster.local"
"dns_provider_update_interval": "10s"
Expand All @@ -68,9 +66,7 @@ spec:
"timeout": "500ms"
"type": "memcached"
- |-
--store.caching-bucket.config="addresses":
- "dnssrv+_client._tcp.<MEMCACHED_SERCIVE>.thanos.svc.cluster.local"
"blocks_iter_ttl": "5m"
--store.caching-bucket.config="blocks_iter_ttl": "5m"
"chunk_object_attrs_ttl": "24h"
"chunk_subrange_size": 16000
"chunk_subrange_ttl": "24h"
Expand Down
26 changes: 15 additions & 11 deletions jsonnet/kube-thanos/kube-thanos-store.libsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,11 @@ local defaults = {
bucketCache: {},
indexCache: {},

memcachedDefaults:: {
// 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: error 'must provide memcached addresses',
addresses+: [],
memcachedDefaults+:: {
config+: {
// 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+: error 'must provide memcached addresses',
timeout: '500ms',
max_idle_connections: 100,
max_async_concurrency: 20,
Expand All @@ -34,7 +33,9 @@ local defaults = {
},
},

memcachedBucketDefaults:: defaults.memcachedDefaults {
indexCacheDefaults+:: {},

bucketCacheMemcachedDefaults+:: {
chunk_subrange_size: 16000,
max_chunks_get_range_requests: 3,
chunk_object_attrs_ttl: '24h',
Expand Down Expand Up @@ -66,11 +67,14 @@ function(params) {
// Combine the defaults and the passed params to make the component's config.
config:: defaults + params + {
// If indexCache is given and of type memcached, merge defaults with params
indexCache+: if std.objectHas(params, 'indexCache') && params.indexCache.type == 'memcached' then
defaults.memcachedDefaults + params.indexCache.config else {},
// If bucketCache is given and of type memcached, merge defaults with params
bucketCache+: if std.objectHas(params, 'bucketCache') && params.bucketCache.type == 'memcached' then
defaults.memcachedBucketDefaults + params.bucketCache.config else {},
indexCache+:
if std.objectHas(params, 'indexCache') && params.indexCache.type == 'memcached' then
defaults.memcachedDefaults + defaults.indexCacheDefaults + params.indexCache
else {},
bucketCache+:
if std.objectHas(params, 'bucketCache') && params.bucketCache.type == 'memcached' then
defaults.memcachedDefaults + defaults.bucketCacheMemcachedDefaults + params.bucketCache
else {},
},

// Safety checks for combined config of defaults and params
Expand Down

0 comments on commit 6533e7c

Please sign in to comment.